【问题标题】:Azure policy to restrict VM series allowed in each regionAzure 策略限制每个区域允许的 VM 系列
【发布时间】:2020-07-19 23:41:57
【问题描述】:

我需要一个政策来限制某些地区的某些系列。因此,就像美国东部允许 A 和 F 系列一样,AU East 只允许 F 和 H 系列 VM。这如何在 JSON 中完成?

【问题讨论】:

    标签: azure-policy


    【解决方案1】:

    可以这样做:

    {
        "mode": "Indexed",
        "policyRule": {
          "if": {
            "allOf": [
              {
                "field": "type",
                "equals": "Microsoft.Compute/virtualMachines"
              },
              {
                "not": {
                  "field": "Microsoft.Compute/virtualMachines/sku.name",
                  "in": "[parameters('listOfAllowedSKUs')]"
                }
              },
              {
              "field": "location",
              "equals": "[parameters('listOfAllowedLocations')]"
              }
            ]
          },
          "then": {
            "effect": "deny"
          }
        },
        "parameters": {
          "listOfAllowedSKUs": {
            "type": "Array",
            "metadata": {
              "displayName": "Allowed Size SKUs",
              "description": "The list of VM series that can be specified for virtual machines.",
              "strongType": "vmSKUs"
            }
          },
          "listOfAllowedLocations": {
            "type": "Array",
            "metadata": {
              "displayName": "Allowed locations",
              "description": "The list of locations where the selected VM's are allowed.",
              "strongType": "location"
            },
              "allowedValues": [
                  "australiaeast",
                  "eastus",
                  "uksouth",
                  "westus2",
                  "southeastasia"
              ]
            }
          }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-12-18
      • 1970-01-01
      • 2014-03-05
      • 2017-12-30
      • 2012-06-28
      • 1970-01-01
      • 2015-10-19
      • 2021-12-28
      • 1970-01-01
      相关资源
      最近更新 更多