Virtual Machine Scale Set VM Extensions - Create Or Update
建立或更新 VMSS VM 延伸模組的作業。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}?api-version=2025-04-01
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
instance
|
path | True |
string |
虛擬機的實例標識碼。 |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
資源群組的名稱。 名稱不區分大小寫。 |
|
subscription
|
path | True |
string minLength: 1 |
目標訂用帳戶的標識碼。 |
|
vm
|
path | True |
string |
虛擬機擴充功能的名稱。 |
|
vm
|
path | True |
string |
VM 擴展集的名稱。 |
|
api-version
|
query | True |
string minLength: 1 |
用於此作業的 API 版本。 |
要求本文
| 名稱 | 類型 | Description |
|---|---|---|
| location |
string |
延伸模組的位置。 |
| properties.autoUpgradeMinorVersion |
boolean |
指出如果部署期間有新的次要版本,擴充功能是否應該使用較新的次要版本。 不過,部署之後,除非重新部署,否則擴充功能不會升級次要版本,即使此屬性設定為 true 也一定會升級。 |
| properties.enableAutomaticUpgrade |
boolean |
指出如果有較新版本的延伸模組可用,平臺是否應該自動升級延伸模組。 |
| properties.forceUpdateTag |
string |
即使延伸模組組態尚未變更,延伸模組處理程式也應該強制更新。 |
| properties.instanceView |
虛擬機擴充實例檢視。 |
|
| properties.protectedSettings |
延伸模組可以包含 protectedSettings 或 protectedSettingsFromKeyVault 或完全沒有受保護的設定。 |
|
| properties.protectedSettingsFromKeyVault |
以傳址方式傳遞的延伸模組受保護設定,並從金鑰保存庫取用 |
|
| properties.provisionAfterExtensions |
string[] |
必須布建此延伸模組之後的延伸模組名稱集合。 |
| properties.publisher |
string |
擴充處理程序發行者的名稱。 |
| properties.settings |
擴充功能的 Json 格式化公用設定。 |
|
| properties.suppressFailures |
boolean |
指出延伸模組產生的失敗是否會隱藏(不論此值為何,無法連線到 VM 等作業失敗)。 默認值為 false。 |
| properties.type |
string |
指定延伸模組的類型;例如“CustomScriptExtension”。 |
| properties.typeHandlerVersion |
string |
指定文稿處理程式的版本。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
資源 'VirtualMachineScaleSetVMExtension' 更新作業成功 |
|
| 201 Created |
資源 'VirtualMachineScaleSetVMExtension' 建立作業成功 標題
|
|
| Other Status Codes |
未預期的錯誤回應。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
| 名稱 | Description |
|---|---|
| user_impersonation | 模擬您的用戶帳戶 |
範例
Create VirtualMachineScaleSet VM extension.
範例要求
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension?api-version=2025-04-01
{
"properties": {
"autoUpgradeMinorVersion": true,
"publisher": "extPublisher",
"type": "extType",
"typeHandlerVersion": "1.2",
"settings": {
"UserName": "xyz@microsoft.com"
}
}
}
範例回覆
{
"name": "myVMExtension",
"type": "Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions",
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension",
"properties": {
"autoUpgradeMinorVersion": true,
"provisioningState": "Creating",
"publisher": "extPublisher",
"type": "extType",
"typeHandlerVersion": "1.2",
"settings": {
"UserName": "xyz@microsoft.com"
}
}
}
{
"name": "myVMExtension",
"type": "Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions",
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension",
"properties": {
"autoUpgradeMinorVersion": true,
"provisioningState": "Creating",
"publisher": "extPublisher",
"type": "extType",
"typeHandlerVersion": "1.2",
"settings": {
"UserName": "xyz@microsoft.com"
}
}
}
定義
| 名稱 | Description |
|---|---|
|
Api |
Api 錯誤。 |
|
Api |
Api 錯誤基底。 |
|
Cloud |
來自計算服務的錯誤回應。 |
|
Inner |
內部錯誤詳細數據。 |
|
Instance |
實例檢視狀態。 |
|
Key |
描述 Key Vault 秘密的參考 |
|
Status |
層級程序代碼。 |
|
Sub |
|
|
Virtual |
虛擬機器延伸模組的執行個體檢視。 |
|
Virtual |
說明 VMSS VM 延伸模組。 |
ApiError
Api 錯誤。
| 名稱 | 類型 | Description |
|---|---|---|
| code |
string |
錯誤碼。 |
| details |
Api 錯誤詳細資料 |
|
| innererror |
Api 內部錯誤 |
|
| message |
string |
錯誤訊息。 |
| target |
string |
特定錯誤的目標。 |
ApiErrorBase
Api 錯誤基底。
| 名稱 | 類型 | Description |
|---|---|---|
| code |
string |
錯誤碼。 |
| message |
string |
錯誤訊息。 |
| target |
string |
特定錯誤的目標。 |
CloudError
來自計算服務的錯誤回應。
| 名稱 | 類型 | Description |
|---|---|---|
| error |
Api 錯誤。 |
InnerError
內部錯誤詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| errordetail |
string |
內部錯誤訊息或異常狀況傾出。 |
| exceptiontype |
string |
例外狀況類型。 |
InstanceViewStatus
實例檢視狀態。
| 名稱 | 類型 | Description |
|---|---|---|
| code |
string |
狀態代碼。 |
| displayStatus |
string |
狀態的簡短可當地語系化標籤。 |
| level |
層級程序代碼。 |
|
| message |
string |
詳細的狀態消息,包括警示和錯誤訊息。 |
| time |
string (date-time) |
狀態的時間。 |
KeyVaultSecretReference
描述 Key Vault 秘密的參考
| 名稱 | 類型 | Description |
|---|---|---|
| secretUrl |
string |
參考 Key Vault 中秘密的 URL。 |
| sourceVault |
包含秘密之 Key Vault 的相對 URL。 |
StatusLevelTypes
層級程序代碼。
| 值 | Description |
|---|---|
| Info | |
| Warning | |
| Error |
SubResource
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string |
資源標識碼 |
VirtualMachineExtensionInstanceView
虛擬機器延伸模組的執行個體檢視。
| 名稱 | 類型 | Description |
|---|---|---|
| name |
string |
虛擬機擴充功能名稱。 |
| statuses |
資源狀態資訊。 |
|
| substatuses |
資源狀態資訊。 |
|
| type |
string |
指定延伸模組的類型;例如“CustomScriptExtension”。 |
| typeHandlerVersion |
string |
指定文稿處理程式的版本。 |
VirtualMachineScaleSetVMExtension
說明 VMSS VM 延伸模組。
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string |
資源標識碼 |
| location |
string |
延伸模組的位置。 |
| name |
string |
資源名稱 |
| properties.autoUpgradeMinorVersion |
boolean |
指出如果部署期間有新的次要版本,擴充功能是否應該使用較新的次要版本。 不過,部署之後,除非重新部署,否則擴充功能不會升級次要版本,即使此屬性設定為 true 也一定會升級。 |
| properties.enableAutomaticUpgrade |
boolean |
指出如果有較新版本的延伸模組可用,平臺是否應該自動升級延伸模組。 |
| properties.forceUpdateTag |
string |
即使延伸模組組態尚未變更,延伸模組處理程式也應該強制更新。 |
| properties.instanceView |
虛擬機擴充實例檢視。 |
|
| properties.protectedSettings |
延伸模組可以包含 protectedSettings 或 protectedSettingsFromKeyVault 或完全沒有受保護的設定。 |
|
| properties.protectedSettingsFromKeyVault |
以傳址方式傳遞的延伸模組受保護設定,並從金鑰保存庫取用 |
|
| properties.provisionAfterExtensions |
string[] |
必須布建此延伸模組之後的延伸模組名稱集合。 |
| properties.provisioningState |
string |
只出現在回應中的布建狀態。 |
| properties.publisher |
string |
擴充處理程序發行者的名稱。 |
| properties.settings |
擴充功能的 Json 格式化公用設定。 |
|
| properties.suppressFailures |
boolean |
指出延伸模組產生的失敗是否會隱藏(不論此值為何,無法連線到 VM 等作業失敗)。 默認值為 false。 |
| properties.type |
string |
指定延伸模組的類型;例如“CustomScriptExtension”。 |
| properties.typeHandlerVersion |
string |
指定文稿處理程式的版本。 |
| type |
string |
資源類型 |