注释
Azure 门户中尚未提供将备用池 VM 状态设置为休眠状态。 若要使用休眠的 VM 状态配置备用池,请使用备用 SDK,例如 CLI 或 PowerShell。
- 导航到你的虚拟机规模集。
- 在“可用性 + 缩放”下,选择“备用池”。
- 选择“管理池”。
- 为池提供名称,选择预配状态并设置最大和最小就绪容量。
- 选择“保存”。
还可以在虚拟机规模集创建期间配置备用池,方法是导航到“管理”选项卡并选中启用备用池的框。
使用 az standby-vm-pool create 创建备用池并将其与现有规模集相关联。
az standby-vm-pool create \
--resource-group myResourceGroup \
--___location eastus --name myStandbyPool \
--max-ready-capacity 20 \
--min-ready-capacity 5 \
--vm-state "Deallocated" \
--vmss-id "/subscriptions/{subscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myScaleSet"
使用 New-AzStandbyVMPool 创建备用池并将其与现有规模集相关联。
New-AzStandbyVMPool `
-ResourceGroup myResourceGroup `
-Location eastus `
-Name myStandbyPool `
-MaxReadyCapacity 20 `
-MinReadyCapacity 5 `
-VMState "Deallocated" `
-VMSSId "/subscriptions/{subscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myScaleSet"
创建备用池并将其与现有规模集相关联。 使用 az deployment group create 或 New-AzResourceGroupDeployment 创建和部署模板。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"___location": {
"type": "string",
"defaultValue": "east us"
},
"name": {
"type": "string",
"defaultValue": "myStandbyPool"
},
"maxReadyCapacity" : {
"type": "int",
"defaultValue": 20
},
"minReadyCapacity" : {
"type": "int",
"defaultValue": 5
},
"virtualMachineState" : {
"type": "string",
"defaultValue": "Deallocated"
},
"attachedVirtualMachineScaleSetId" : {
"type": "string",
"defaultValue": "/subscriptions/{subscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myScaleSet"
}
},
"resources": [
{
"type": "Microsoft.StandbyPool/standbyVirtualMachinePools",
"apiVersion": "2025-03-01",
"name": "[parameters('name')]",
"___location": "[parameters('___location')]",
"properties": {
"elasticityProfile": {
"maxReadyCapacity": "[parameters('maxReadyCapacity')]",
"minReadyCapacity": "[parameters('minReadyCapacity')]"
},
"virtualMachineState": "[parameters('virtualMachineState')]",
"attachedVirtualMachineScaleSetId": "[parameters('attachedVirtualMachineScaleSetId')]"
}
}
]
}
创建备用池并将其与现有规模集相关联。 使用 az deployment group create 或 New-AzResourceGroupDeployment 部署模板。
param ___location string = resourceGroup().___location
param standbyPoolName string = 'myStandbyPool'
param maxReadyCapacity int = 20
param minReadyCapacity int = 5
@allowed([
'Running'
'Deallocated'
])
param vmState string = 'Deallocated'
param virtualMachineScaleSetId string = '/subscriptions/{subscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myScaleSet'
resource standbyPool 'Microsoft.standbypool/standbyvirtualmachinepools@2025-03-01' = {
name: standbyPoolName
___location: ___location
properties: {
elasticityProfile: {
maxReadyCapacity: maxReadyCapacity
minReadyCapacity: minReadyCapacity
}
virtualMachineState: vmState
attachedVirtualMachineScaleSetId: virtualMachineScaleSetId
}
}
使用创建或更新来创建备用池并将其与现有规模集关联。
PUT https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/myStandbyPool?api-version=2025-03-01
{
"type": "Microsoft.StandbyPool/standbyVirtualMachinePools",
"name": "myStandbyPool",
"___location": "east us",
"properties": {
"elasticityProfile": {
"maxReadyCapacity": 20
"minReadyCapacity": 5
},
"virtualMachineState":"Deallocated",
"attachedVirtualMachineScaleSetId": "/subscriptions/{subscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myScaleSet"
}
}