繁体   English   中英

Azure 策略 - 如果未设置某些标签,则“拒绝”创建订阅

[英]Azure policy - "deny" subscription creation if certain tags are not set

我在下面创建了 azure 政策,但我仍然能够创建新的订阅。 在 Azure BuiltIn 定义中使用相同的 if 条件,修改-添加标签到订阅。 有什么提示吗?

{
  "mode": "All",
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Resources/subscriptions"
        },
        {
          "field": "[concat('tags[', parameters('tagName'), ']')]",
          "exists": "false"
        }
      ]
    },
    "then": {
      "effect": "deny"
    }
  },
  "parameters": {
    "tagName": {
      "type": "String",
      "defaultValue": "CostCenter"
    }
  }
}

刚从 Microsoft 支持部门得到答复。 这似乎是仅适用于从门户创建的订阅的当前设计。 如果以编程方式部署订阅,则该策略会完成其工作。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM