Share via


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

Name Description Type Status
az ml compute attach

Attach an existing compute resource to a workspace.

Extension GA
az ml compute connect-ssh

Set up SSH connection to Compute Instance.

Extension Preview
az ml compute create

Create a compute target.

Extension GA
az ml compute delete

Delete a compute target.

Extension GA
az ml compute detach

Detach a previously attached compute resource from a workspace.

Extension GA
az ml compute enable-sso

Enable/Disable Single sign-on on Compute Instance.

Extension Preview
az ml compute list

List the compute targets in a workspace.

Extension GA
az ml compute list-nodes

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

Extension GA
az ml compute list-sizes

List the VM sizes available by location.

Extension GA
az ml compute list-usage

List the available usage resources for VMs.

Extension GA
az ml compute restart

Restart a ComputeInstance target.

Extension GA
az ml compute show

Show details for a compute target.

Extension GA
az ml compute start

Start a ComputeInstance target.

Extension GA
az ml compute stop

Stop a ComputeInstance target.

Extension GA
az ml compute update

Update a compute target.

Extension GA

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 workspace 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.

Default value: False
--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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az ml compute connect-ssh

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Set up SSH connection to Compute Instance.

az ml compute connect-ssh --name
                          --resource-group
                          --workspace-name
                          [--private-key-file-path]

Examples

Connect to a Compute Instance via SSH

az ml compute connect-ssh --name ci1 --resource-group my-resource-group --workspace-name my-workspace --private-key-file-path sshkey.pem

Required Parameters

--name -n

Name of the compute target. Required.

--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 workspace using az configure --defaults workspace=<name>.

Optional Parameters

--private-key-file-path -f

The path to the private key file file.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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]
                     [--enable-node-public-ip]
                     [--file]
                     [--identity-type]
                     [--idle-time-before-scale-down]
                     [--location]
                     [--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 workspace 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.

--enable-node-public-ip

Indicates whether public IP is enabled. Default: True.

--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-instance-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.

--location -l

Location of the compute. If not specified, defaults to the location of the workspace.

--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.

Default value: 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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

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

Default value: False
--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

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

Default value: False
--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az ml compute enable-sso

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Enable/Disable Single sign-on on Compute Instance.

az ml compute enable-sso --name
                         --resource-group
                         --workspace-name
                         [--disable]

Examples

Enable single sign-on a compute instance

az ml compute enable-sso --name ci1 --resource-group my-resource-group --workspace-name my-workspace

Disable single sign-on a compute instance

az ml compute enable-sso --name ci1 --resource-group my-resource-group --workspace-name my-workspace --disable

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 workspace using az configure --defaults workspace=<name>.

Optional Parameters

--disable

Disable Single sign-on. Default: False.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace 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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace using az configure --defaults workspace=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace 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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace using az configure --defaults workspace=<name>.

Optional Parameters

--location -l

Defaults to workspace location.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

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

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace using az configure --defaults workspace=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

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

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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 workspace using az configure --defaults workspace=<name>.

Optional Parameters

--no-wait

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

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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]
                     [--tags]
                     [--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 --tags key1=value1 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 workspace 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>.

Default value: []
--force-string

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

Default value: False
--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.

Default value: False
--remove

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

Default value: []
--set

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

Default value: []
--tags

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

--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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.