你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Virtual Machine Scale Set Extensions - Create Or Update

The operation to create or update an extension.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}?api-version=2024-07-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.

vmScaleSetName
path True

string

The name of the VM scale set where the extension should be create or updated.

vmssExtensionName
path True

string

The name of the VM scale set extension.

api-version
query True

string

Client Api Version.

Request Body

Name Type Description
name

string

The name of the extension.

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

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.

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

Responses

Name Type Description
200 OK

VirtualMachineScaleSetExtension

OK

201 Created

VirtualMachineScaleSetExtension

Created

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

VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen
VirtualMachineScaleSetExtension_CreateOrUpdate_MinimumSet_Gen

VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/aaaaaaa/extensions/aaaaaaaaaaaaaaaaaaaaa?api-version=2024-07-01

{
  "name": "{extension-name}",
  "properties": {
    "autoUpgradeMinorVersion": true,
    "publisher": "{extension-Publisher}",
    "type": "{extension-Type}",
    "typeHandlerVersion": "{handler-version}",
    "settings": {},
    "forceUpdateTag": "aaaaaaaaa",
    "enableAutomaticUpgrade": true,
    "protectedSettings": {},
    "provisionAfterExtensions": [
      "aa"
    ],
    "suppressFailures": true
  }
}

Sample response

{
  "name": "{extension-name}",
  "properties": {
    "autoUpgradeMinorVersion": true,
    "publisher": "{extension-Publisher}",
    "type": "{extension-Type}",
    "typeHandlerVersion": "{handler-version}",
    "settings": {},
    "forceUpdateTag": "aaaaaaaaa",
    "enableAutomaticUpgrade": true,
    "protectedSettings": {},
    "provisioningState": "aaa",
    "provisionAfterExtensions": [
      "aa"
    ],
    "suppressFailures": true
  },
  "type": "aaaaaaaaaaaaaaaaaaaaaaaa",
  "id": "aaaaaaaa"
}
location: https://foo.com/operationstatus
{
  "name": "{extension-name}",
  "properties": {
    "autoUpgradeMinorVersion": true,
    "publisher": "{extension-Publisher}",
    "type": "{extension-Type}",
    "typeHandlerVersion": "{handler-version}",
    "settings": {},
    "forceUpdateTag": "aaaaaaaaa",
    "enableAutomaticUpgrade": true,
    "protectedSettings": {},
    "provisioningState": "aaa",
    "provisionAfterExtensions": [
      "aa"
    ],
    "suppressFailures": true
  },
  "type": "aaaaaaaaaaaaaaaaaaaaaaaa",
  "id": "aaaaaaaa"
}

VirtualMachineScaleSetExtension_CreateOrUpdate_MinimumSet_Gen

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/aaaaaaaaaaa/extensions/aaaaaaaaaaa?api-version=2024-07-01

{}

Sample response

{}
location: https://foo.com/operationstatus
{}

Definitions

Name Description
ApiError

Api error.

ApiErrorBase

Api error base.

CloudError

An error response from the Compute service.

InnerError

Inner error details.

KeyVaultSecretReference

Describes a reference to Key Vault Secret

SubResource
VirtualMachineScaleSetExtension

Describes a Virtual Machine Scale Set 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.

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.

SubResource

Name Type Description
id

string

Resource Id

VirtualMachineScaleSetExtension

Describes a Virtual Machine Scale Set Extension.

Name Type Description
id

string

Resource Id

name

string

The name of the extension.

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

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.

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.

type

string

Resource type