Virtual Machine Extensions - Create Or Update
The operation to create or update the extension.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}?api-version=2025-04-01URI Parameters
| Name | In | Required | Type | Description | 
|---|---|---|---|---|
| resource | path | True | stringminLength: 1 maxLength: 90 | The name of the resource group. The name is case insensitive. | 
| subscription | path | True | stringminLength: 1 | The ID of the target subscription. | 
| vm | path | True | string | The name of the virtual machine extension. | 
| vm | path | True | string | The name of the virtual machine. | 
| api-version | query | True | stringminLength: 1 | The API version to use for this operation. | 
Request Body
| Name | Required | Type | Description | 
|---|---|---|---|
| location | True | string | The geo-location where the resource lives | 
| properties.autoUpgradeMinorVersion | boolean | 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. | |
| properties.enableAutomaticUpgrade | boolean | Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. | |
| properties.forceUpdateTag | string | How the extension handler should be forced to update even if the extension configuration has not changed. | |
| properties.instanceView | The virtual machine extension instance view. | ||
| properties.protectedSettings | 
 | The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. | |
| properties.protectedSettingsFromKeyVault | The extensions protected settings that are passed by reference, and consumed from key vault | ||
| properties.provisionAfterExtensions | string[] | Collection of extension names after which this extension needs to be provisioned. | |
| properties.publisher | string | The name of the extension handler publisher. | |
| properties.settings | 
 | Json formatted public settings for the extension. | |
| properties.suppressFailures | boolean | 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. | |
| properties.type | string | Specifies the type of the extension; an example is "CustomScriptExtension". | |
| properties.typeHandlerVersion | string | Specifies the version of the script handler. | |
| tags | object | Resource tags. | 
Responses
| Name | Type | Description | 
|---|---|---|
| 200 OK | Resource 'VirtualMachineExtension' update operation succeeded | |
| 201 Created | Resource 'VirtualMachineExtension' create operation succeeded Headers 
 | |
| Other Status Codes | An unexpected error response. | 
Security
azure_auth
Azure Active Directory OAuth2 Flow.
					Type: 
					oauth2
					Flow: 
					implicit
					Authorization URL: 
					https://login.microsoftonline.com/common/oauth2/authorize
			
Scopes
| Name | Description | 
|---|---|
| user_impersonation | impersonate your user account | 
Examples
| Virtual | 
| Virtual | 
VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen    
			Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/aaaaaaaaaaaaaaaaaaaaaaaa/extensions/aaaaaaaaaaaaa?api-version=2025-04-01
{
  "location": "westus",
  "properties": {
    "autoUpgradeMinorVersion": true,
    "publisher": "extPublisher",
    "type": "extType",
    "typeHandlerVersion": "1.2",
    "suppressFailures": true,
    "settings": {},
    "forceUpdateTag": "a",
    "enableAutomaticUpgrade": true,
    "protectedSettings": {},
    "instanceView": {
      "name": "aaaaaaaaaaaaaaaaa",
      "type": "aaaaaaaaa",
      "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa",
      "substatuses": [
        {
          "code": "aaaaaaaaaaaaaaaaaaaaaaa",
          "level": "Info",
          "displayStatus": "aaaaaa",
          "message": "a",
          "time": "2021-11-30T12:58:26.522Z"
        }
      ],
      "statuses": [
        {
          "code": "aaaaaaaaaaaaaaaaaaaaaaa",
          "level": "Info",
          "displayStatus": "aaaaaa",
          "message": "a",
          "time": "2021-11-30T12:58:26.522Z"
        }
      ]
    }
  },
  "tags": {
    "key9183": "aa"
  }
}
Sample response
{
  "name": "myVMExtension",
  "type": "Microsoft.Compute/virtualMachines/extensions",
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension",
  "location": "westus",
  "properties": {
    "autoUpgradeMinorVersion": true,
    "provisioningState": "Creating",
    "publisher": "extPublisher",
    "type": "extType",
    "typeHandlerVersion": "1.2",
    "suppressFailures": true,
    "settings": {},
    "forceUpdateTag": "a",
    "enableAutomaticUpgrade": true,
    "protectedSettings": {},
    "instanceView": {
      "name": "aaaaaaaaaaaaaaaaa",
      "type": "aaaaaaaaa",
      "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa",
      "substatuses": [
        {
          "code": "aaaaaaaaaaaaaaaaaaaaaaa",
          "level": "Info",
          "displayStatus": "aaaaaa",
          "message": "a",
          "time": "2021-11-30T12:58:26.522Z"
        }
      ],
      "statuses": [
        {
          "code": "aaaaaaaaaaaaaaaaaaaaaaa",
          "level": "Info",
          "displayStatus": "aaaaaa",
          "message": "a",
          "time": "2021-11-30T12:58:26.522Z"
        }
      ]
    }
  },
  "tags": {
    "key9183": "aa"
  }
}location: https://foo.com/operationstatus{
  "name": "myVMExtension",
  "type": "Microsoft.Compute/virtualMachines/extensions",
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension",
  "location": "westus",
  "properties": {
    "autoUpgradeMinorVersion": true,
    "provisioningState": "Creating",
    "publisher": "extPublisher",
    "type": "extType",
    "typeHandlerVersion": "1.2",
    "suppressFailures": true,
    "settings": {},
    "forceUpdateTag": "a",
    "enableAutomaticUpgrade": true,
    "protectedSettings": {},
    "instanceView": {
      "name": "aaaaaaaaaaaaaaaaa",
      "type": "aaaaaaaaa",
      "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa",
      "substatuses": [
        {
          "code": "aaaaaaaaaaaaaaaaaaaaaaa",
          "level": "Info",
          "displayStatus": "aaaaaa",
          "message": "a",
          "time": "2021-11-30T12:58:26.522Z"
        }
      ],
      "statuses": [
        {
          "code": "aaaaaaaaaaaaaaaaaaaaaaa",
          "level": "Info",
          "displayStatus": "aaaaaa",
          "message": "a",
          "time": "2021-11-30T12:58:26.522Z"
        }
      ]
    }
  },
  "tags": {
    "key9183": "aa"
  }
}VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen    
			Sample request
Sample response
{
  "location": "westus",
  "id": "/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"
}location: https://foo.com/operationstatus{
  "location": "westus",
  "id": "/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"
}Definitions
| Name | Description | 
|---|---|
| Api | Api error. | 
| Api | Api error base. | 
| Cloud | An error response from the Compute service. | 
| created | The type of identity that created the resource. | 
| Inner | Inner error details. | 
| Instance | Instance view status. | 
| Key | Describes a reference to Key Vault Secret | 
| Status | The level code. | 
| Sub | |
| system | Metadata pertaining to creation and last modification of the resource. | 
| Virtual | Describes a Virtual Machine Extension. | 
| Virtual | The instance view of a virtual machine extension. | 
ApiError 
			
			Api error.
| Name | Type | Description | 
|---|---|---|
| code | string | The error code. | 
| details | The Api error details | |
| innererror | The Api inner error | |
| message | string | The error message. | 
| target | string | The target of the particular error. | 
ApiErrorBase  
			
			Api error base.
| Name | Type | Description | 
|---|---|---|
| code | string | The error code. | 
| message | string | The error message. | 
| target | string | The target of the particular error. | 
CloudError 
			
			An error response from the Compute service.
| Name | Type | Description | 
|---|---|---|
| error | Api error. | 
createdByType 
			
			The type of identity that created the resource.
| Value | Description | 
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key | 
InnerError 
			
			Inner error details.
| Name | Type | Description | 
|---|---|---|
| errordetail | string | The internal error message or exception dump. | 
| exceptiontype | string | The exception type. | 
InstanceViewStatus  
			
			Instance view status.
| Name | Type | Description | 
|---|---|---|
| code | string | The status code. | 
| displayStatus | string | The short localizable label for the status. | 
| level | The level code. | |
| message | string | The detailed status message, including for alerts and error messages. | 
| time | string (date-time) | The time of the status. | 
KeyVaultSecretReference   
			
			Describes a reference to Key Vault Secret
| Name | Type | Description | 
|---|---|---|
| secretUrl | string | The URL referencing a secret in a Key Vault. | 
| sourceVault | The relative URL of the Key Vault containing the secret. | 
StatusLevelTypes  
			
			The level code.
| Value | Description | 
|---|---|
| Info | |
| Warning | |
| Error | 
SubResource 
			
			
				| Name | Type | Description | 
|---|---|---|
| id | string | Resource Id | 
systemData 
			
			Metadata pertaining to creation and last modification of the resource.
| Name | Type | Description | 
|---|---|---|
| createdAt | string (date-time) | The timestamp of resource creation (UTC). | 
| createdBy | string | The identity that created the resource. | 
| createdByType | The type of identity that created the resource. | |
| lastModifiedAt | string (date-time) | The timestamp of resource last modification (UTC) | 
| lastModifiedBy | string | The identity that last modified the resource. | 
| lastModifiedByType | The type of identity that last modified the resource. | 
VirtualMachineExtension  
			
			Describes a Virtual Machine Extension.
| Name | Type | Description | 
|---|---|---|
| id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} | 
| location | string | The geo-location where the resource lives | 
| name | string | The name of the resource | 
| properties.autoUpgradeMinorVersion | boolean | 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. | 
| properties.enableAutomaticUpgrade | boolean | Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. | 
| properties.forceUpdateTag | string | How the extension handler should be forced to update even if the extension configuration has not changed. | 
| properties.instanceView | The virtual machine extension instance view. | |
| properties.protectedSettings | 
 | The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. | 
| properties.protectedSettingsFromKeyVault | The extensions protected settings that are passed by reference, and consumed from key vault | |
| properties.provisionAfterExtensions | string[] | Collection of extension names after which this extension needs to be provisioned. | 
| properties.provisioningState | string | The provisioning state, which only appears in the response. | 
| properties.publisher | string | The name of the extension handler publisher. | 
| properties.settings | 
 | Json formatted public settings for the extension. | 
| properties.suppressFailures | boolean | 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. | 
| properties.type | string | Specifies the type of the extension; an example is "CustomScriptExtension". | 
| properties.typeHandlerVersion | string | Specifies the version of the script handler. | 
| systemData | Azure Resource Manager metadata containing createdBy and modifiedBy information. | |
| tags | object | Resource tags. | 
| type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | 
VirtualMachineExtensionInstanceView    
			
			The instance view of a virtual machine extension.
| Name | Type | Description | 
|---|---|---|
| name | string | The virtual machine extension name. | 
| statuses | The resource status information. | |
| substatuses | The resource status information. | |
| type | string | Specifies the type of the extension; an example is "CustomScriptExtension". | 
| typeHandlerVersion | string | Specifies the version of the script handler. |