仅允许在Azure中选择特定区域

时间:2018-10-16 14:44:42

标签: azure

我试图强迫在Azure中配置资源或服务的任何人只能选择特定区域。例如,当他们提供资源组时,下拉列表仅显示特定区域。我希望有一些全局设置会影响所有用户。我们还使用了Azure AD。有帮助还是重要?我尝试搜索Azure文档和PowerShell命令,但找不到任何对此设置的提及。

1 个答案:

答案 0 :(得分:0)

您可以使用Azure Policy来完成。

这里有一个示例策略,要求将所有资源都部署到批准的位置,请参考此link,您可以尝试deploy with portalwith powershell

  

此政策要求将所有资源都部署到批准的位置。您指定一组批准的位置。

示例模板:

{
  "properties": {
    "displayName": "Allowed locations",
    "policyType": "BuiltIn",
    "description": "This policy enables you to restrict the locations your organization can specify when deploying resources. Use to enforce your geo-compliance requirements.",
    "parameters": {
      "listOfAllowedLocations": {
        "type": "Array",
        "metadata": {
          "description": "The list of locations that can be specified when deploying resources.",
          "strongType": "location",
          "displayName": "Allowed locations"
        }
      }
    },
    "policyRule": {
      "if": {
        "not": {
          "field": "location",
          "in": "[parameters('listOfAllowedLocations')]"
        }
      },
      "then": {
        "effect": "Deny"
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/e56962a6-4747-49cd-b67b-bf8b01975c4c",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "e56962a6-4747-49cd-b67b-bf8b01975c4c"
}