簡體   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