Azure Machine Learning CLI Documentation

Introduction to the Azure ML CLI

The Azure Machine Learning CLI (v2) is a powerful command-line interface that allows you to manage and orchestrate your machine learning workloads on Azure. It provides a consistent and efficient way to interact with Azure Machine Learning resources, from dataset registration to model deployment.

This documentation guides you through the installation, core concepts, and various commands available in the Azure ML CLI. Whether you are a data scientist, ML engineer, or DevOps professional, the CLI is an essential tool for streamlining your ML lifecycle.

Installation

To use the Azure ML CLI, you need to have the Azure CLI installed first. If you don't have it, you can install it from the official Azure CLI documentation.

Once the Azure CLI is installed, you can install the Azure ML extension:

az extension add --name ml

To verify the installation, run:

az ml --version

Getting Started

Before you can use the CLI, you need to log in to your Azure account and set your default subscription:

az login
az account set --subscription 

Next, you'll need to configure your Azure ML workspace. This can be done manually or by pointing the CLI to an existing workspace. For creating a new workspace, you can use the az ml workspace create command.

Example Workspace Creation

az ml workspace create --name my-workspace --resource-group my-resource-group --location eastus

After setting up your workspace, you can start interacting with your ML resources.

CLI Commands

The Azure ML CLI is organized into logical groups for managing different aspects of your machine learning projects.

az ml workspace

Manage your Azure Machine Learning workspaces.

Show Workspace Details

az ml workspace show --name my-workspace --resource-group my-resource-group

az ml compute

Manage compute resources for your ML workloads.

Create a Compute Cluster

az ml compute create --type amlcompute --name cpu-cluster --min-instances 0 --max-instances 4 --resource-group my-resource-group --workspace-name my-workspace

az ml environment

Manage environments for your training and inference jobs.

az ml job

Submit, manage, and monitor training jobs.

Submit a Command Job

az ml job create --file jobs/my-command-job.yml

az ml model

Register and manage your trained models.

az ml data

Register and manage your datasets.

az ml endpoint

Manage endpoints for model deployment.

az ml deployment

Manage deployments associated with endpoints.

Create an Online Endpoint and Deployment

az ml online-endpoint create --name my-online-endpoint --file endpoints/online/my-endpoint.yml
az ml online-deployment create --endpoint my-online-endpoint --name blue --file endpoints/online/my-deployment-blue.yml --all-traffic

Configuration

The Azure ML CLI relies heavily on YAML configuration files for defining resources, jobs, environments, and deployments. This declarative approach promotes reproducibility and version control.

Key configuration concepts include:

Refer to the official Azure ML YAML examples for detailed templates.

Tutorials and Examples

To further your understanding and practical application of the Azure ML CLI, explore the following resources: