az vm extension

Manage extensions on VMs.

Extensions are small applications that provide post-deployment configuration and automation tasks on Azure virtual machines. For example, if a virtual machine requires software installation, anti-virus protection, or Docker configuration, a VM extension can be used to complete these tasks. Extensions can be bundled with a new virtual machine deployment or run against any existing system.

Commands

az vm extension delete Remove an extension attached to a VM.
az vm extension image Find the available VM extensions for a subscription and region.
az vm extension image list List the information on available extensions.
az vm extension image list-names List the names of available extensions.
az vm extension image list-versions List the versions for available extensions.
az vm extension image show Display information for an extension.
az vm extension list List the extensions attached to a VM.
az vm extension set Set extensions for a VM.
az vm extension show Display information about extensions attached to a VM.

az vm extension delete

Remove an extension attached to a VM.

az vm extension delete --name
--resource-group
--vm-name

Examples

Use a VM name and extension to delete an extension from a VM.

az vm extension delete -g MyResourceGroup --vm-name MyVm -n extension_name

Delete extensions with IDs containing the string "MyExtension" from a VM.

az vm extension delete --ids \
                            $(az resource list --query "[?contains(name, 'MyExtension')].id" -o tsv)

Required Parameters

--name -n

The name of the virtual machine extension.

--resource-group -g

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

--vm-name

The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.

az vm extension list

List the extensions attached to a VM.

az vm extension list --resource-group
--vm-name

Examples

List attached extensions to a named VM.

az vm extension list -g MyResourceGroup --vm-name MyVm

List attached extensions with IDs containing the string "MyExtension".

az vm extension list --ids \
                            $(az resource list --query "[?contains(name, 'MyExtension')].id" -o tsv)

Required Parameters

--resource-group -g

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

--vm-name

The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.

az vm extension set

Set extensions for a VM.

Get extension details from az vm extension image list.

az vm extension set --name
--publisher
--resource-group
--vm-name
[--no-auto-upgrade]
[--protected-settings]
[--settings]
[--version]

Examples

Add a user account to a Linux VM.

az vm extension set -n VMAccessForLinux --publisher Microsoft.OSTCExtensions --version 1.4 \
                            --vm-name MyVm --resource-group MyResourceGroup \
                            --protected-settings '{"username":"user1", "ssh_key":"ssh_rsa ..."}'

Required Parameters

--name -n
--publisher

The name of the extension publisher.

--resource-group -g

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

--vm-name

The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.

Optional Parameters

--no-auto-upgrade

By doing this, extension system will not pick the highest minor version for the specified version number, and will not auto update to the latest build/revision number on any scale set updates in future.

--protected-settings

Protected settings in JSON format for sensitive information like credentials. A JSON file path is also accepted.

--settings

Extension settings in JSON format. A JSON file path is also accepted.

--version

The version of the extension.

az vm extension show

Display information about extensions attached to a VM.

az vm extension show --name
--resource-group
--vm-name
[--expand]

Examples

Use VM name and extension name to show the extensions attached to a VM.

az vm extension show -g MyResourceGroup --vm-name MyVm -n extension_name

Required Parameters

--name -n

The name of the virtual machine extension.

--resource-group -g

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

--vm-name

The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.

Optional Parameters

--expand

The expand expression to apply on the operation.