Install and set up the CLI (v2)
ml extension (preview) to the Azure CLI is the enhanced interface for Azure Machine Learning. It enables you to train and deploy models from the command line, with features that accelerate scaling data science up and out while tracking the model lifecycle.
- To use the CLI, you must have an Azure subscription. If you don't have an Azure subscription, create a free account before you begin. Try the free or paid version of Azure Machine Learning today.
- To use the CLI commands in this document from your local environment, you need the Azure CLI.
The new Machine Learning extension requires Azure CLI version
>=2.15.0. Ensure this requirement is met:
If it isn't, upgrade your Azure CLI.
Check the Azure CLI extensions you've installed:
az extension list
Ensure no conflicting extension using the
ml namespace is installed, including the
az extension remove -n azure-cli-ml az extension remove -n ml
Now, install the
az extension add -n ml -y
Run the help command to verify your installation and see available subcommands:
az ml -h
You can upgrade the extension to the latest version:
az extension update -n ml
Installation on Linux
If you're using Linux, the fastest way to install the necessary CLI version and the Machine Learning extension is:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash az extension add -n ml -y
For more, see Install the Azure CLI for Linux.
If you have access to multiple Azure subscriptions, you can set your active subscription:
az account set -s "<YOUR_SUBSCRIPTION_NAME_OR_ID>"
If it doesn't already exist, you can create the Azure resource group:
az group create -n "azureml-examples-rg" -l "eastus"
Machine learning subcommands require the
--resource-group/-g parameters. To avoid typing these repeatedly, configure defaults:
az configure --defaults group="azureml-examples-rg" workspace="main"
Most code examples assume you have set a default workspace and resource group. You can override these on the command line.
Now create the machine learning workspace:
az ml workspace create