gpt4 book ai didi

Azure - ARM 模板,锁定一项特定资源

转载 作者:行者123 更新时间:2023-12-03 01:40:57 25 4
gpt4 key购买 nike

我想知道是否可以仅向资源组中的一个资源(例如存储帐户)添加锁定。我尝试使用 ARM 模板来完成此操作,它总是对整个资源组创建锁定。我只想锁定一项资源。这是我在模板文件中使用的代码片段:

{
"type": "Microsoft.Authorization/locks",
"apiVersion": "2016-09-01",
"name": "doNotDelete",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"level": "CanNotDelete",
"notes": "Storage account should not be deleted."
}
}

如果您对此主题有任何帮助,我将不胜感激。

最佳答案

是的,您可以做到这一点,请使用以下代码段:

{
"type": "Microsoft.Storage/storageAccounts/providers/locks",
"name": "storageaccountname/Microsoft.Authorization/lockname",
"apiVersion": "2017-04-01",
"properties": {
"level": "CannotDelete",
"notes": "This is an important resource and should never be deleted!"
}
}

关于Azure - ARM 模板,锁定一项特定资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53409999/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com