VM extensions - az vm extension

Extend the functionality of your VMs with extensions.

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 The operation to delete the extension.
az vm extension image Find the available VM extensions for your subscription and region.
az vm extension image list Vm extension image list.
az vm extension image list-names Gets a list of virtual machine extension image types.
az vm extension image list-versions Gets a list of virtual machine extension image versions.
az vm extension image show Gets a virtual machine extension image.
az vm extension list List the extensions attached to a VM in a resource group.
az vm extension set Create/update extensions for a VM in a resource group.
az vm extension show The operation to get the extension.

az vm extension delete

The operation to delete the extension.

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

Examples

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

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

Use IDs to delete extensions that contain "MyExtension" in the name.

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

--vm-name

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

az vm extension list

List the extensions attached to a VM in a resource group.

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

Examples

Use the VM name to list the extensions attached to it.

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

Use IDs to list the extensions with "MyExtension" in the name.

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

--vm-name

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

az vm extension set

Create/update extensions for a VM in a resource group.

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

The name of the extension.

--publisher

The name of extension publisher.

--resource-group -g

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

--vm-name

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

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

az vm extension show

The operation to get the extension.

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

--vm-name

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

Optional Parameters

--expand

The expand expression to apply on the operation.