Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Microsoft.Compute virtualMachineScaleSets/extensions

Bicep resource definition

The virtualMachineScaleSets/extensions resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Compute/virtualMachineScaleSets/extensions resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.Compute/virtualMachineScaleSets/extensions@2025-11-01' = {
 parent: resourceSymbolicName
 name: 'string'
 properties: {
 autoUpgradeMinorVersion: bool
 enableAutomaticUpgrade: bool
 forceUpdateTag: 'string'
 protectedSettings: any(...)
 protectedSettingsFromKeyVault: {
 secretUrl: 'string'
 sourceVault: {
 id: 'string'
 }
 }
 provisionAfterExtensions: [
 'string'
 ]
 publisher: 'string'
 settings: any(...)
 suppressFailures: bool
 type: 'string'
 typeHandlerVersion: 'string'
 }
}

Property Values

Microsoft.Compute/virtualMachineScaleSets/extensions

Name Description Value
name The resource name string (required)
parent In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.

For more information, see Child resource outside parent resource.
Symbolic name for resource of type: virtualMachineScaleSets
properties Describes the properties of a Virtual Machine Scale Set Extension. VirtualMachineScaleSetExtensionProperties

KeyVaultSecretReference

Name Description Value
secretUrl The URL referencing a secret in a Key Vault. string (required)
sourceVault The relative URL of the Key Vault containing the secret. SubResource (required)

SubResource

Name Description Value
id Resource Id string

VirtualMachineScaleSetExtensionProperties

Name Description Value
autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. bool
enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. bool
forceUpdateTag If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. string
protectedSettings The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. any
protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and consumed from key vault KeyVaultSecretReference
provisionAfterExtensions Collection of extension names after which this extension needs to be provisioned. string[]
publisher The name of the extension handler publisher. string
settings Json formatted public settings for the extension. any
suppressFailures Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. bool
type Specifies the type of the extension; an example is "CustomScriptExtension". string
typeHandlerVersion Specifies the version of the script handler. string

Usage Examples

Bicep Samples

A basic example of deploying Extension for a Virtual Machine Scale Set.

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-07-01' = {
 name: resourceName
 location: location
 properties: {
 addressSpace: {
 addressPrefixes: [
 '10.0.0.0/16'
 ]
 }
 dhcpOptions: {
 dnsServers: []
 }
 subnets: []
 }
}

resource virtualMachineScaleSet 'Microsoft.Compute/virtualMachineScaleSets@2023-03-01' = {
 name: resourceName
 location: location
 sku: {
 capacity: 1
 name: 'Standard_F2'
 tier: 'Standard'
 }
 properties: {
 additionalCapabilities: {}
 doNotRunExtensionsOnOverprovisionedVMs: false
 orchestrationMode: 'Uniform'
 overprovision: true
 scaleInPolicy: {
 forceDeletion: false
 rules: [
 'Default'
 ]
 }
 singlePlacementGroup: true
 upgradePolicy: {
 mode: 'Manual'
 }
 virtualMachineProfile: {
 diagnosticsProfile: {
 bootDiagnostics: {
 enabled: false
 storageUri: ''
 }
 }
 extensionProfile: {
 extensionsTimeBudget: 'PT1H30M'
 }
 networkProfile: {
 networkInterfaceConfigurations: [
 {
 name: 'example'
 properties: {
 dnsSettings: {
 dnsServers: []
 }
 enableAcceleratedNetworking: false
 enableIPForwarding: false
 ipConfigurations: [
 {
 name: 'internal'
 properties: {
 applicationGatewayBackendAddressPools: []
 applicationSecurityGroups: []
 loadBalancerBackendAddressPools: []
 loadBalancerInboundNatPools: []
 primary: true
 privateIPAddressVersion: 'IPv4'
 subnet: {
 id: subnet.id
 }
 }
 }
 ]
 primary: true
 }
 }
 ]
 }
 osProfile: {
 adminUsername: 'adminuser'
 computerNamePrefix: resourceName
 linuxConfiguration: {
 disablePasswordAuthentication: true
 provisionVMAgent: true
 ssh: {
 publicKeys: [
 {
 keyData: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com'
 path: '/home/adminuser/.ssh/authorized_keys'
 }
 ]
 }
 }
 secrets: []
 }
 priority: 'Regular'
 storageProfile: {
 dataDisks: []
 imageReference: {
 offer: 'UbuntuServer'
 publisher: 'Canonical'
 sku: '16.04-LTS'
 version: 'latest'
 }
 osDisk: {
 caching: 'ReadWrite'
 createOption: 'FromImage'
 managedDisk: {
 storageAccountType: 'Standard_LRS'
 }
 osType: 'Linux'
 writeAcceleratorEnabled: false
 }
 }
 }
 }
}

resource extension 'Microsoft.Compute/virtualMachineScaleSets/extensions@2023-03-01' = {
 name: resourceName
 parent: virtualMachineScaleSet
 properties: {
 autoUpgradeMinorVersion: true
 enableAutomaticUpgrade: false
 provisionAfterExtensions: []
 publisher: 'Microsoft.Azure.Extensions'
 settings: {
 commandToExecute: 'echo $HOSTNAME'
 }
 suppressFailures: false
 type: 'CustomScript'
 typeHandlerVersion: '2.0'
 }
}

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2022-07-01' = {
 name: 'internal'
 parent: virtualNetwork
 properties: {
 addressPrefix: '10.0.2.0/24'
 delegations: []
 privateEndpointNetworkPolicies: 'Enabled'
 privateLinkServiceNetworkPolicies: 'Enabled'
 serviceEndpointPolicies: []
 serviceEndpoints: []
 }
}

Azure Quickstart Samples

The following Azure Quickstart templates contain Bicep samples for deploying this resource type.

Bicep File Description
Deploy a trusted launch capable Windows VM Scale Set This template allows you to deploy a trusted launch capable VM Scale Set of Windows VMs using the latest patched version of Windows Server 2016, Windows Server 2019 or Windows Server 2022 Azure Edition. These VMs are behind a load balancer with NAT rules for RDP connections. If you enable Secureboot and vTPM, the Guest Attestation extension will be installed on your VMSS. This extension will perform remote attestation by the cloud.

ARM template resource definition

The virtualMachineScaleSets/extensions resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Compute/virtualMachineScaleSets/extensions resource, add the following JSON to your template.

{
 "type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
 "apiVersion": "2025-11-01",
 "name": "string",
 "properties": {
 "autoUpgradeMinorVersion": "bool",
 "enableAutomaticUpgrade": "bool",
 "forceUpdateTag": "string",
 "protectedSettings": {},
 "protectedSettingsFromKeyVault": {
 "secretUrl": "string",
 "sourceVault": {
 "id": "string"
 }
 },
 "provisionAfterExtensions": [ "string" ],
 "publisher": "string",
 "settings": {},
 "suppressFailures": "bool",
 "type": "string",
 "typeHandlerVersion": "string"
 }
}

Property Values

Microsoft.Compute/virtualMachineScaleSets/extensions

Name Description Value
apiVersion The api version '2025-11-01'
name The resource name string (required)
properties Describes the properties of a Virtual Machine Scale Set Extension. VirtualMachineScaleSetExtensionProperties
type The resource type 'Microsoft.Compute/virtualMachineScaleSets/extensions'

KeyVaultSecretReference

Name Description Value
secretUrl The URL referencing a secret in a Key Vault. string (required)
sourceVault The relative URL of the Key Vault containing the secret. SubResource (required)

SubResource

Name Description Value
id Resource Id string

VirtualMachineScaleSetExtensionProperties

Name Description Value
autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. bool
enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. bool
forceUpdateTag If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. string
protectedSettings The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. any
protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and consumed from key vault KeyVaultSecretReference
provisionAfterExtensions Collection of extension names after which this extension needs to be provisioned. string[]
publisher The name of the extension handler publisher. string
settings Json formatted public settings for the extension. any
suppressFailures Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. bool
type Specifies the type of the extension; an example is "CustomScriptExtension". string
typeHandlerVersion Specifies the version of the script handler. string

Usage Examples

Azure Quickstart Templates

The following Azure Quickstart templates deploy this resource type.

Template Description
Create and encrypt a new Windows VMSS with jumpbox

👁 Deploy to Azure
This template allows you to deploy a simple VM Scale Set of Windows VMs using the lastest patched version of serveral Windows versions. This template also deploys a jumpbox with a public IP address in the same virtual network. You can connect to the jumpbox via this public IP address, then connect from there to VMs in the scale set via private IP addresses.This template enables encryption on the VM Scale Set of Windows VMs.
Deploy a trusted launch capable Windows VM Scale Set

👁 Deploy to Azure
This template allows you to deploy a trusted launch capable VM Scale Set of Windows VMs using the latest patched version of Windows Server 2016, Windows Server 2019 or Windows Server 2022 Azure Edition. These VMs are behind a load balancer with NAT rules for RDP connections. If you enable Secureboot and vTPM, the Guest Attestation extension will be installed on your VMSS. This extension will perform remote attestation by the cloud.
Deploy Darktrace Autoscaling vSensors

👁 Deploy to Azure
This template allows you to deploy an automatically autoscaling deployment of Darktrace vSensors
This template decrypts previously encrypted Windows VMSS

👁 Deploy to Azure
This template disables encryption on a running Windows VM Scale Set
This template encrypts a running Windows VMSS

👁 Deploy to Azure
This template enables encryption on a running Windows VM Scale Set

Terraform (AzAPI provider) resource definition

The virtualMachineScaleSets/extensions resource type can be deployed with operations that target:

  • Resource groups

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Compute/virtualMachineScaleSets/extensions resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
 type = "Microsoft.Compute/virtualMachineScaleSets/extensions@2025-11-01"
 name = "string"
 parent_id = "string"
 body = {
 properties = {
 autoUpgradeMinorVersion = bool
 enableAutomaticUpgrade = bool
 forceUpdateTag = "string"
 protectedSettings = ?
 protectedSettingsFromKeyVault = {
 secretUrl = "string"
 sourceVault = {
 id = "string"
 }
 }
 provisionAfterExtensions = [
 "string"
 ]
 publisher = "string"
 settings = ?
 suppressFailures = bool
 type = "string"
 typeHandlerVersion = "string"
 }
 }
}

Property Values

Microsoft.Compute/virtualMachineScaleSets/extensions

Name Description Value
name The resource name string (required)
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: virtualMachineScaleSets
properties Describes the properties of a Virtual Machine Scale Set Extension. VirtualMachineScaleSetExtensionProperties
type The resource type "Microsoft.Compute/virtualMachineScaleSets/extensions@2025-11-01"

KeyVaultSecretReference

Name Description Value
secretUrl The URL referencing a secret in a Key Vault. string (required)
sourceVault The relative URL of the Key Vault containing the secret. SubResource (required)

SubResource

Name Description Value
id Resource Id string

VirtualMachineScaleSetExtensionProperties

Name Description Value
autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. bool
enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. bool
forceUpdateTag If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. string
protectedSettings The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. any
protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and consumed from key vault KeyVaultSecretReference
provisionAfterExtensions Collection of extension names after which this extension needs to be provisioned. string[]
publisher The name of the extension handler publisher. string
settings Json formatted public settings for the extension. any
suppressFailures Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. bool
type Specifies the type of the extension; an example is "CustomScriptExtension". string
typeHandlerVersion Specifies the version of the script handler. string

Usage Examples

Terraform Samples

A basic example of deploying Extension for a Virtual Machine Scale Set.

terraform {
 required_providers {
 azapi = {
 source = "Azure/azapi"
 }
 }
}

provider "azapi" {
 skip_provider_registration = false
}

variable "resource_name" {
 type = string
 default = "acctest0001"
}

variable "location" {
 type = string
 default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
 type = "Microsoft.Resources/resourceGroups@2020-06-01"
 name = var.resource_name
 location = var.location
}

resource "azapi_resource" "virtualNetwork" {
 type = "Microsoft.Network/virtualNetworks@2022-07-01"
 parent_id = azapi_resource.resourceGroup.id
 name = var.resource_name
 location = var.location
 body = {
 properties = {
 addressSpace = {
 addressPrefixes = [
 "10.0.0.0/16",
 ]
 }
 dhcpOptions = {
 dnsServers = [
 ]
 }
 subnets = [
 ]
 }
 }
 schema_validation_enabled = false
 response_export_values = ["*"]
 lifecycle {
 ignore_changes = [body.properties.subnets]
 }
}

resource "azapi_resource" "subnet" {
 type = "Microsoft.Network/virtualNetworks/subnets@2022-07-01"
 parent_id = azapi_resource.virtualNetwork.id
 name = "internal"
 body = {
 properties = {
 addressPrefix = "10.0.2.0/24"
 delegations = [
 ]
 privateEndpointNetworkPolicies = "Enabled"
 privateLinkServiceNetworkPolicies = "Enabled"
 serviceEndpointPolicies = [
 ]
 serviceEndpoints = [
 ]
 }
 }
 schema_validation_enabled = false
 response_export_values = ["*"]
}

resource "azapi_resource" "virtualMachineScaleSet" {
 type = "Microsoft.Compute/virtualMachineScaleSets@2023-03-01"
 parent_id = azapi_resource.resourceGroup.id
 name = var.resource_name
 location = var.location
 body = {
 properties = {
 additionalCapabilities = {
 }
 doNotRunExtensionsOnOverprovisionedVMs = false
 orchestrationMode = "Uniform"
 overprovision = true
 scaleInPolicy = {
 forceDeletion = false
 rules = [
 "Default",
 ]
 }
 singlePlacementGroup = true
 upgradePolicy = {
 mode = "Manual"
 }
 virtualMachineProfile = {
 diagnosticsProfile = {
 bootDiagnostics = {
 enabled = false
 storageUri = ""
 }
 }
 extensionProfile = {
 extensionsTimeBudget = "PT1H30M"
 }
 networkProfile = {
 networkInterfaceConfigurations = [
 {
 name = "example"
 properties = {
 dnsSettings = {
 dnsServers = [
 ]
 }
 enableAcceleratedNetworking = false
 enableIPForwarding = false
 ipConfigurations = [
 {
 name = "internal"
 properties = {
 applicationGatewayBackendAddressPools = [
 ]
 applicationSecurityGroups = [
 ]
 loadBalancerBackendAddressPools = [
 ]
 loadBalancerInboundNatPools = [
 ]
 primary = true
 privateIPAddressVersion = "IPv4"
 subnet = {
 id = azapi_resource.subnet.id
 }
 }
 },
 ]
 primary = true
 }
 },
 ]
 }
 osProfile = {
 adminUsername = "adminuser"
 computerNamePrefix = var.resource_name
 linuxConfiguration = {
 disablePasswordAuthentication = true
 provisionVMAgent = true
 ssh = {
 publicKeys = [
 {
 keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"
 path = "/home/adminuser/.ssh/authorized_keys"
 },
 ]
 }
 }
 secrets = [
 ]
 }
 priority = "Regular"
 storageProfile = {
 dataDisks = [
 ]
 imageReference = {
 offer = "UbuntuServer"
 publisher = "Canonical"
 sku = "16.04-LTS"
 version = "latest"
 }
 osDisk = {
 caching = "ReadWrite"
 createOption = "FromImage"
 managedDisk = {
 storageAccountType = "Standard_LRS"
 }
 osType = "Linux"
 writeAcceleratorEnabled = false
 }
 }
 }
 }
 sku = {
 capacity = 1
 name = "Standard_F2"
 tier = "Standard"
 }
 }
 schema_validation_enabled = false
 response_export_values = ["*"]
}

resource "azapi_resource" "extension" {
 type = "Microsoft.Compute/virtualMachineScaleSets/extensions@2023-03-01"
 parent_id = azapi_resource.virtualMachineScaleSet.id
 name = var.resource_name
 body = {
 properties = {
 autoUpgradeMinorVersion = true
 enableAutomaticUpgrade = false
 provisionAfterExtensions = [
 ]
 publisher = "Microsoft.Azure.Extensions"
 settings = {
 commandToExecute = "echo $HOSTNAME"
 }
 suppressFailures = false
 type = "CustomScript"
 typeHandlerVersion = "2.0"
 }
 }
 schema_validation_enabled = false
 response_export_values = ["*"]
}

Feedback

Was this page helpful?

Additional resources