az ml compute

Note

This reference is part of the ml extension for the Azure CLI (version 2.15.0 or higher). The extension will automatically install the first time you run an az ml compute command. Learn more about extensions.

Manage Azure ML compute resources.

Azure ML compute targets are designated compute resources where you can run your jobs for training or deploy your models for inference.

Commands

az ml compute attach

Attach an existing compute resource to a workspace.

az ml compute create

Create a compute target.

az ml compute delete

Delete a compute target.

az ml compute detach

Detach a previously attached compute resource from a workspace.

az ml compute list

List the compute targets in a workspace.

az ml compute list-nodes

List node details for a compute target. The only supported compute type for this command is AML compute.

az ml compute list-sizes

List the VM sizes available by location.

az ml compute list-usage

List the available usage resources for VMs.

az ml compute restart

Restart a ComputeInstance target.

az ml compute show

Show details for a compute target.

az ml compute start

Start a ComputeInstance target.

az ml compute stop

Stop a ComputeInstance target.

az ml compute update

Update a compute target.

az ml compute attach

Attach an existing compute resource to a workspace.

Kubernetes clusters and remote VMs can be attached as compute targets.

az ml compute attach --resource-group
                     --workspace-name
                     [--admin-password]
                     [--admin-username]
                     [--file]
                     [--identity-type]
                     [--name]
                     [--namespace]
                     [--no-wait]
                     [--resource-id]
                     [--ssh-port]
                     [--ssh-private-key-file]
                     [--type]
                     [--user-assigned-identities]

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--admin-password

The administrator user password that can be used to SSH into the node(s).

--admin-username

Name of the administrator user account that can be used to SSH into the node(s).

--file -f

Local path to the YAML file containing the Azure ML compute specification.

--identity-type

The type of manged identity. Allowed values: SystemAssigned, UserAssigned.

--name -n

Name of the compute target (Required if not specified in the yaml file).

--namespace

Namespace of a KubernetesCompute.

--no-wait

Do not wait for the long-running operation to finish.

--resource-id

The fully qualified ID of the resource, including the resource name and resource type (Required if not specified in the yaml file).

--ssh-port

The port number that can be used to SSH into the node(s). If not specified, the default (port 22) will be used.

--ssh-private-key-file

The file containing the SSH private key of the administrator user account.

--type -t

The type of compute target. Allowed values: virtualmachine, Kubernetes.

--user-assigned-identities -i

The user assigned identity's resource ID, required for --identity_type=UserAssigned.

az ml compute create

Create a compute target.

You can create an AmlCompute cluster, which is Azure ML's managed compute infrastructure, or a compute instance, which is a managed cloud-based workstation.

az ml compute create --resource-group
                     --workspace-name
                     [--admin-password]
                     [--admin-username]
                     [--description]
                     [--file]
                     [--identity-type]
                     [--idle-time-before-scale-down]
                     [--max-instances]
                     [--min-instances]
                     [--name]
                     [--no-wait]
                     [--set]
                     [--size]
                     [--ssh-key-value]
                     [--ssh-public-access-enabled]
                     [--subnet]
                     [--tags]
                     [--tier]
                     [--type]
                     [--user-assigned-identities]
                     [--user-object-id]
                     [--user-tenant-id]
                     [--vnet-name]

Examples

Create a compute target from a YAML specification file

az ml compute create --file compute.yml --resource-group my-resource-group --workspace-name my-workspace

Create an AmlCompute target using command options

az ml compute create --name nc6-cluster --size Standard_NC6 --min-instances 0 --max-instances 5 --type AmlCompute --resource-group my-resource-group --workspace-name my-workspace

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--admin-password

Password for the administrator user account if authentication type is 'Password'.

--admin-username

Name of the administrator user account that can be used to SSH into the node(s).

--description

Description of the compute target.

--file -f

Local path to the YAML file containing the Azure ML compute specification. The YAML reference docs for compute can be found at: https://aka.ms/ml-cli-v2-compute-aml-yaml-reference, https://aka.ms/ml-cli-v2-compute-aml-yaml-reference, https://aka.ms/ml-cli-v2-compute-vm-yaml-reference.

--identity-type

The type of managed identity. Allowed values: SystemAssigned, UserAssigned.

--idle-time-before-scale-down -d

Node idle time in seconds before scaling down the cluster. Default: 120.

--max-instances

The maximum number of nodes to use on the cluster. Default: 4.

--min-instances

The minimum number of nodes to use on the cluster. Default: 0.

--name -n

Name of the compute target. Required if --file/-f is not provided.

--no-wait

Do not wait for the long-running-operation to finish. Default is False.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--size

VM size to use for the compute target. More details can be found here: https://aka.ms/azureml-vm-details.

--ssh-key-value

SSH public key of the administrator user account.

--ssh-public-access-enabled -p

Indicates whether public SSH port is enabled.

--subnet

Name of the subnet. Can also reference a subnet in an existing vnet by ID instead of name. If subnet ID is specified then vnet-name will be ignored. Subnet ID can refer to a vnet/subnet in another RG by specifying the fully qualified subnet ID. Required when vnet name is specified.

--tags

Space-separated key-value pairs for the tags of the object.

--tier

VM priority tier. Allowed values: dedicated, low_priority.

--type -t

The type of compute target. Required if --file/-f is not provided. Allowed values: AmlCompute, ComputeInstance.

--user-assigned-identities -i

Use '[system]' to set a system assigned identity else input resource IDs separated by commas (ie ,) to set user assigned identities.

--user-object-id

AAD object ID of the assigned user.

--user-tenant-id

AAD tenant ID of the assigned user.

--vnet-name

Name of the virtual network.

az ml compute delete

Delete a compute target.

az ml compute delete --name
                     --resource-group
                     --workspace-name
                     [--no-wait]
                     [--yes]

Required Parameters

--name -n

Name of the compute target (Required if not specified in the yaml file).

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

Do not wait for the long-running-operation to finish. Default is False.

--yes -y

Do not prompt for confirmation.

az ml compute detach

Detach a previously attached compute resource from a workspace.

az ml compute detach --name
                     --resource-group
                     --workspace-name
                     [--no-wait]
                     [--yes]

Required Parameters

--name -n

Name of the compute target (Required if not specified in the yaml file).

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

Do not wait for the long-running operation to finish.

--yes -y

Do not prompt for confirmation.

az ml compute list

List the compute targets in a workspace.

az ml compute list --resource-group
                   --workspace-name
                   [--max-results]
                   [--type]

Examples

List all the compute targets in a workspace using --query argument to execute a JMESPath query on the results of commands.

az ml compute list --query "[].{Name:name}"  --output table --resource-group my-resource-group --workspace-name my-workspace

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--max-results -r

Max number of results to return.

--type

The type of compute target. Allowed values: AmlCompute, ComputeInstance, Kubernetes.

az ml compute list-nodes

List node details for a compute target. The only supported compute type for this command is AML compute.

az ml compute list-nodes --name
                         --resource-group
                         --workspace-name

Examples

List node details for an AML compute target

az ml compute list-nodes --name nc6-cluster --resource-group my-resource-group --workspace-name my-workspace

Required Parameters

--name -n

Name of the compute target (Required if not specified in the yaml file).

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

az ml compute list-sizes

List the VM sizes available by location.

az ml compute list-sizes --resource-group
                         --workspace-name
                         [--location]
                         [--type]

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--type -t

The type of compute target. Allowed values: AmlCompute, ComputeInstance.

az ml compute list-usage

List the available usage resources for VMs.

az ml compute list-usage --resource-group
                         --workspace-name
                         [--location]

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--location -l

Defaults to workspace location.

az ml compute restart

Restart a ComputeInstance target.

--no-wait option is recommended.

az ml compute restart --name
                      --resource-group
                      --workspace-name
                      [--no-wait]

Required Parameters

--name -n

Name of the compute target (Required if not specified in the yaml file).

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

Do not wait for the long-running-operation to finish. Default is False.

az ml compute show

Show details for a compute target.

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

Examples

Show details for a compute target

az ml compute show --name nc6-cluster --resource-group my-resource-group --workspace-name my-workspace

Required Parameters

--name -n

Name of the compute target (Required if not specified in the yaml file).

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

az ml compute start

Start a ComputeInstance target.

--no-wait option is recommended.

az ml compute start --name
                    --resource-group
                    --workspace-name
                    [--no-wait]

Required Parameters

--name -n

Name of the compute target (Required if not specified in the yaml file).

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

Do not wait for the long-running-operation to finish. Default is False.

az ml compute stop

Stop a ComputeInstance target.

--no-wait option is recommended.

az ml compute stop --name
                   --resource-group
                   --workspace-name
                   [--no-wait]

Required Parameters

--name -n

Name of the compute target (Required if not specified in the yaml file).

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

Do not wait for the long-running-operation to finish. Default is False.

az ml compute update

Update a compute target.

The 'tags', 'max_instances', 'min_instances', 'idle_time_before_scale_down', 'identity_type', and 'user_assigned_identities' properties can be updated.

az ml compute update --name
                     --resource-group
                     --workspace-name
                     [--add]
                     [--force-string]
                     [--identity-type]
                     [--idle-time-before-scale-down]
                     [--max-instances]
                     [--min-instances]
                     [--no-wait]
                     [--remove]
                     [--set]
                     [--user-assigned-identities]

Examples

Update the minimum number of nodes for an AmlCompute cluster

az ml compute update --name nc6-cluster --min-instances 1 --resource-group my-resource-group --workspace-name my-workspace

Update existing tags or add new tags for an AmlCompute cluster

az ml compute update --name nc6-cluster --set tags.key1=value1 tags.key2=value2 --resource-group my-resource-group --workspace-name my-workspace

Required Parameters

--name -n

Name of the compute target (Required if not specified in the yaml file).

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--identity-type

The type of managed identity. Allowed values: SystemAssigned, UserAssigned.

--idle-time-before-scale-down -d

Node idle time in seconds before scaling down the cluster. Default: 120.

--max-instances

Maximum number of nodes to use. Default: 4.

--min-instances

Minimum number of nodes to use. Default: 0.

--no-wait

Do not wait for the long-running-operation to finish. Default is False.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--user-assigned-identities -i

Use '[system]' to set a system assigned identity else input resource IDs separated by commas (ie ,) to set user assigned identities.