Virtual Machine Extensions - Update

The operation to update the extension.

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}?api-version=2024-03-01

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

vmExtensionName
path True

string

The name of the virtual machine extension.

vmName
path True

string

The name of the virtual machine where the extension should be updated.

api-version
query True

string

Client Api Version.

Request Body

Name Type Description
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.protectedSettings

object

The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.

properties.protectedSettingsFromKeyVault

KeyVaultSecretReference

The extensions protected settings that are passed by reference, and consumed from key vault

properties.publisher

string

The name of the extension handler publisher.

properties.settings

object

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

VirtualMachineExtension

OK

Other Status Codes

CloudError

Error response describing why the operation failed.

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

Update VM extension.

Sample request

PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension?api-version=2024-03-01

{
  "properties": {
    "autoUpgradeMinorVersion": true,
    "publisher": "extPublisher",
    "type": "extType",
    "typeHandlerVersion": "1.2",
    "suppressFailures": true,
    "settings": {
      "UserName": "xyz@microsoft.com"
    },
    "protectedSettingsFromKeyVault": {
      "sourceVault": {
        "id": "/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"
      },
      "secretUrl": "https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"
    }
  }
}

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": {
      "UserName": "xyz@microsoft.com"
    },
    "protectedSettingsFromKeyVault": {
      "sourceVault": {
        "id": "/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"
      },
      "secretUrl": "https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"
    }
  }
}

Definitions

Name Description
ApiError

Api error.

ApiErrorBase

Api error base.

CloudError

An error response from the Compute service.

InnerError

Inner error details.

InstanceViewStatus

Instance view status.

KeyVaultSecretReference

Describes a reference to Key Vault Secret

StatusLevelTypes

The level code.

SubResource
VirtualMachineExtension

Describes a Virtual Machine Extension.

VirtualMachineExtensionInstanceView

The instance view of a virtual machine extension.

VirtualMachineExtensionUpdate

Describes a Virtual Machine Extension.

ApiError

Api error.

Name Type Description
code

string

The error code.

details

ApiErrorBase[]

The Api error details

innererror

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

ApiError

Api error.

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

StatusLevelTypes

The level code.

message

string

The detailed status message, including for alerts and error messages.

time

string

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

SubResource

The relative URL of the Key Vault containing the secret.

StatusLevelTypes

The level code.

Name Type Description
Error

string

Info

string

Warning

string

SubResource

Name Type Description
id

string

Resource Id

VirtualMachineExtension

Describes a Virtual Machine Extension.

Name Type Description
id

string

Resource Id

location

string

Resource location

name

string

Resource name

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

VirtualMachineExtensionInstanceView

The virtual machine extension instance view.

properties.protectedSettings

object

The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.

properties.protectedSettingsFromKeyVault

KeyVaultSecretReference

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

object

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

type

string

Resource type

VirtualMachineExtensionInstanceView

The instance view of a virtual machine extension.

Name Type Description
name

string

The virtual machine extension name.

statuses

InstanceViewStatus[]

The resource status information.

substatuses

InstanceViewStatus[]

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.

VirtualMachineExtensionUpdate

Describes a Virtual Machine Extension.

Name Type Description
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.protectedSettings

object

The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.

properties.protectedSettingsFromKeyVault

KeyVaultSecretReference

The extensions protected settings that are passed by reference, and consumed from key vault

properties.publisher

string

The name of the extension handler publisher.

properties.settings

object

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