使用 az deployment group create 或 New-AzResourceGroupDeployment 從待命集區要求容器群組, 並指定待命集區和容器群組配置檔。 如需在容器要求期間使用組態對應的詳細資訊,請參閱 使用設定對應。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subscriptionId": {
"type": "string",
"metadata": {
"description": "The subscription ID."
}
},
"resourceGroup": {
"type": "string",
"metadata": {
"description": "The name of the resource group."
}
},
"location": {
"type": "string",
"metadata": {
"description": "Location for the resource."
},
"defaultValue": "West Central US"
},
"containerGroupName": {
"type": "string",
"metadata": {
"description": "The name of the container group."
}
},
"standbyPoolName": {
"type": "string",
"metadata": {
"description": "The name of the standby pool."
}
},
"containerGroupProfileName": {
"type": "string",
"metadata": {
"description": "The name of the container group profile."
}
},
"myContainerProfile": {
"type": "string",
"metadata": {
"description": "The name of the container profile."
}
},
"newKey": {
"type": "string",
"metadata": {
"description": "The new key for the config map."
}
},
"newValue": {
"type": "string",
"metadata": {
"description": "The new value for the config map."
}
},
"revisionNumber": {
"type": "int",
"metadata": {
"description": "The revision number for the container group profile."
}
}
},
"resources": [
{
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2024-05-01-preview",
"name": "[parameters('containerGroupName')]",
"location": "[parameters('location')]",
"properties": {
"standByPoolProfile": {
"id": "[concat('/subscriptions/', parameters('subscriptionId'), '/resourceGroups/', parameters('resourceGroup'), '/providers/Microsoft.StandbyPool/standbyContainerGroupPools/', parameters('standbyPoolName'))]"
},
"containerGroupProfile": {
"id": "[concat('/subscriptions/', parameters('subscriptionId'), '/resourceGroups/', parameters('resourceGroup'), '/providers/Microsoft.ContainerInstance/mycontainergroupprofile/', parameters('containerGroupProfileName'))]",
"revision": "[parameters('revisionNumber')]"
},
"containers": [
{
"name": "[parameters('mycontainergroupprofile')]",
"properties": {
"configMap": {
"keyValuePairs": {
"[parameters('newKey')]": "[parameters('newValue')]"
}
}
}
}
]
}
}
],
"outputs": {
"containerGroupId": {
"type": "string",
"value": "[resourceId('Microsoft.ContainerInstance/containerGroups', parameters('containerGroupName'))]"
}
}
}
使用 建立或更新 ,並指定待命集區和容器群組配置檔,向待命集區要求容器群組。 如需在容器要求期間使用組態對應的詳細資訊,請參閱 使用設定對應。
PUT
https://management.azure.com/subscriptions/{SubscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/myContainerGroup?api-version=2024-05-01-preview
Request Body
{
"location": "{location}",
"properties": {
"standByPoolProfile":{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.StandbyPool/standbyContainerGroupPools/myStandbyPool"
},
"containerGroupProfile": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroupProfiles/mycontainergroupprofile",
"revision": {revisionNumber}
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identity}": {}
},
"containers": [
{
"name": "{mycontainergroupprofile}",
"properties": {
"configMap": {
"keyValuePairs": {
"{newKey}": "{newValue}"
}
}
}
}
]
}
}
}