# 资源 'myresource' 被策略禁止。策略：'允许的位置'。原因：'资源位置 'eastus2' 不被允许。'

- **ID:** `policy/azure-resource-location-not-allowed`
- **领域:** policy
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

Azure 策略“允许的位置”将资源部署限制在特定区域，而请求的位置不在允许列表中。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Azure Policy | active | — | — |
| Azure Resource Manager | active | — | — |
| Azure CLI 2.50+ | active | — | — |
| Terraform azurerm 3.0+ | active | — | — |

## 解决方案

1. ```
   Deploy the resource to an allowed location. Use Azure CLI to list allowed locations: az policy assignment list --query "[?displayName=='Allowed locations'].properties.parameters.listOfAllowedLocations.value" -o tsv. Then redeploy to one of those regions.
   ```
2. ```
   Request an exception to the policy from the Azure Policy administrator via a change request or by updating the policy assignment to include the desired location.
   ```

## 无效尝试

- **** — Azure Policy evaluates at deployment time; any location not in the allowed list will be rejected. The policy is enforced at the subscription or management group level. (95% 失败率)
- **** — This requires high-level permissions (Owner or Policy Contributor) and may violate organizational compliance. It's not a viable workaround for most developers. (60% 失败率)
