简体   繁体   English

使用ARM模板的资源组锁定

[英]Resource Group Lock using ARM Template

您好,我尝试使用ARM模板将资源组锁定为天蓝色,但如果有人已经熟悉,请帮忙。

We can use template to lock resource group directly without creating storage account. 我们可以使用模板直接锁定资源组 ,而无需创建存储帐户。

The next example applies a read-only lock to the resource group : 下一个示例将只读锁应用于资源组

{
    "$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": {}
}

See more details about how to lock resource and resource group with template in this article . 请参阅有关如何锁定资源和资源组与模板的详细信息这篇文章

{
  "$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 https://docs.microsoft.com/zh-cn/azure/azure-resource-manager/resource-group-lock-resources#template

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure 使用 ARM 模板标记资源组 - Azure tagging a resource group using an ARM template ARM模板中的预定义资源组 - Predefined Resource Group in ARM Template 在同一资源组中使用 ARM 模板创建两个不同的 VM - Create two different VMs using an ARM template in the same resource group Azure ARM 模板:创建资源组 - Azure ARM Template : Create Resource Group 嵌套 ARM 模板并依赖于另一个资源组 - Nested ARM template and dependsOn in another Resource Group 使用New-AzureRmDeployment和链接的ARM模板创建资源组和资源时如何获取资源组名称? - How to obtain resource group name when using New-AzureRmDeployment and linked ARM template to create a resource group and resource? 如何使用包含资源组和资源的链接模板部署 Arm 模板 - How to deploy a Arm template with Linked template that contains a resource group and resources 我们是否可以使用 ARM 模板单独部署存在于同一资源组中的逻辑应用程序? - Can we deploy logic app individually present in the same resource group using ARM template? 使用Arm模板创建资源组并部署资源,然后从Visual Studio进行部署 - Create resource group and deploy resources using Arm template and deploy from Visual Studio 使用 ARM 模板删除现有资源 - Deletion of existing resource using ARM template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM