{
  "id": "policy/azure-policy-resource-location-not-allowed",
  "signature": "Resource 'myresource' was disallowed by policy. Policy: 'Allowed locations'. Reason: 'The resource location 'eastus2' is not allowed. Allowed locations: ['westus', 'westeurope']",
  "signature_zh": "资源'myresource'被策略禁止。策略：'允许的位置'。原因：资源位置'eastus2'不被允许。允许的位置：['westus', 'westeurope']",
  "regex": "Resource '.*' was disallowed by policy.*Allowed locations.*",
  "domain": "policy",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Azure Policy 'Allowed locations' restricts resource creation to specific regions; the requested location is not in the allowlist.",
  "root_cause_type": "generic",
  "root_cause_zh": "Azure策略'允许的位置'将资源创建限制在特定区域；请求的位置不在允许列表中。",
  "versions": [
    {
      "version": "Azure CLI 2.57.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Azure PowerShell 11.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Terraform azurerm 3.100.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Retrying the deployment in the same disallowed region with different resource names",
      "why_fails": "The policy is location-based, not name-based; the region itself is blocked regardless of resource name.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "Adding the resource to an existing resource group in the allowed region but specifying the disallowed location in the template",
      "why_fails": "The location is evaluated per resource, not per resource group; the template location must match the allowed list.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Creating a new subscription to bypass the policy",
      "why_fails": "Azure Policies can be assigned at management group level, affecting all subscriptions under it; a new subscription may still inherit the policy.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Deploy the resource in an allowed location, e.g., change location from 'eastus2' to 'westus' in ARM template: `\"location\": \"westus\"`",
      "success_rate": 0.95,
      "how": "Deploy the resource in an allowed location, e.g., change location from 'eastus2' to 'westus' in ARM template: `\"location\": \"westus\"`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Request an exemption for the resource from the policy administrator via Azure Policy Portal.",
      "success_rate": 0.5,
      "how": "Request an exemption for the resource from the policy administrator via Azure Policy Portal.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Update the policy assignment to include the desired location using Azure CLI: `az policy assignment update --name 'allowed-locations' --scope '/subscriptions/...' --params '{\"listOfAllowedLocations\": {\"value\": [\"westus\", \"westeurope\", \"eastus2\"]}}'`",
      "success_rate": 0.85,
      "how": "Update the policy assignment to include the desired location using Azure CLI: `az policy assignment update --name 'allowed-locations' --scope '/subscriptions/...' --params '{\"listOfAllowedLocations\": {\"value\": [\"westus\", \"westeurope\", \"eastus2\"]}}'`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在允许的位置部署资源，例如在ARM模板中将位置从'eastus2'改为'westus'：`\"location\": \"westus\"`",
    "通过Azure策略门户向策略管理员请求资源豁免。",
    "使用Azure CLI更新策略分配以包含所需位置：`az policy assignment update --name 'allowed-locations' --scope '/subscriptions/...' --params '{\"listOfAllowedLocations\": {\"value\": [\"westus\", \"westeurope\", \"eastus2\"]}}'`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/azure/governance/policy/samples/allowed-locations",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}