Create & use software environments in Azure Machine Learning with CLI v1

APPLIES TO: Azure CLI ml extension v1

In this article, learn how to create and manage Azure Machine Learning environments using CLI v1. Use the environments to track and reproduce your projects' software dependencies as they evolve. The Azure Machine Learning CLI v1 mirrors most of the functionality of the Python SDK v1. You can use it to create and manage environments.

Software dependency management is a common task for developers. You want to ensure that builds are reproducible without extensive manual software configuration. The Azure Machine Learning Environment class accounts for local development solutions such as pip and Conda and distributed cloud development through Docker capabilities.

For a high-level overview of how environments work in Azure Machine Learning, see What are ML environments? For information about managing environments in the Azure ML studio, see Manage environments in the studio. For information about configuring development environments, see Set up a Python development environment for Azure ML.

Prerequisites

Important

The Azure CLI commands in this article require the azure-cli-ml, or v1, extension for Azure Machine Learning. Support for the v1 extension will end on September 30, 2025. You will be able to install and use the v1 extension until that date.

We recommend that you transition to the ml, or v2, extension before September 30, 2025. For more information on the v2 extension, see Azure ML CLI extension and Python SDK v2.

Scaffold an environment

The following command scaffolds the files for a default environment definition in the specified directory. These files are JSON files. They work like the corresponding class in the SDK. You can use the files to create new environments that have custom settings.

az ml environment scaffold -n myenv -d myenvdir

Register an environment

Run the following command to register an environment from a specified directory:

az ml environment register -d myenvdir

List environments

Run the following command to list all registered environments:

az ml environment list

Download an environment

To download a registered environment, use the following command:

az ml environment download -n myenv -d downloaddir

Next steps