使用 ARM 模板的资源组锁定
Resource Group Lock using ARM Template
您好,我尝试使用 ARM 模板将资源组锁定在 azure 中,但我做不到,如果有人已经熟悉,请帮助我。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"lockedResource": {
"type": "string"
}
},
"resources": [
{
"name": "[concat(parameters('lockedResource'), '/Microsoft.Authorization/myLock')]",
"type": "Microsoft.Storage/storageAccounts/providers/locks",
"apiVersion": "2015-01-01",
"properties": {
"level": "CannotDelete"
}
}
]
}
https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-lock-resources#template
我们可以使用模板直接锁定资源组,无需创建存储帐户。
下一个示例将只读 锁应用于资源组:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Authorization/locks",
"apiVersion": "2015-01-01",
"name": "MyGroupLock",
"properties":
{
"level": "ReadOnly",
"notes": "my notes"
}
}
],
"outputs": {}
}
在 this article 中查看有关如何使用模板锁定资源和资源组的更多详细信息。
您好,我尝试使用 ARM 模板将资源组锁定在 azure 中,但我做不到,如果有人已经熟悉,请帮助我。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"lockedResource": {
"type": "string"
}
},
"resources": [
{
"name": "[concat(parameters('lockedResource'), '/Microsoft.Authorization/myLock')]",
"type": "Microsoft.Storage/storageAccounts/providers/locks",
"apiVersion": "2015-01-01",
"properties": {
"level": "CannotDelete"
}
}
]
}
https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-lock-resources#template
我们可以使用模板直接锁定资源组,无需创建存储帐户。
下一个示例将只读 锁应用于资源组:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Authorization/locks",
"apiVersion": "2015-01-01",
"name": "MyGroupLock",
"properties":
{
"level": "ReadOnly",
"notes": "my notes"
}
}
],
"outputs": {}
}
在 this article 中查看有关如何使用模板锁定资源和资源组的更多详细信息。