policy config_error ai_generated true

Resource 'myresource' was disallowed by policy. Policy: 'Allowed locations'. Reason: 'The resource location 'eastus2' is not allowed. Allowed locations: 'westus', 'westus2'.

ID: policy/azure-resource-location-restriction

Also available as: JSON · Markdown · 中文
95%Fix Rate
90%Confidence
1Evidence
2024-02-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Azure Policy 2024-01-01 active
ARM API 2023-09-01 active

Root Cause

An Azure policy restricts resource deployment to specific regions, but the deployment template specifies a location outside the allowed list.

generic

中文

Azure 策略将资源部署限制在特定区域,但部署模板指定的位置不在允许列表中。

Official Documentation

https://learn.microsoft.com/en-us/azure/governance/policy/concepts/effects

Workarounds

  1. 95% success Update the ARM template or Bicep file to use an allowed location. Example: location: 'westus' instead of 'eastus2'. Then redeploy.
    Update the ARM template or Bicep file to use an allowed location. Example: location: 'westus' instead of 'eastus2'. Then redeploy.
  2. 60% success Request an exception from the Azure policy administrator by opening a support ticket or using Azure Policy's exemption feature.
    Request an exception from the Azure policy administrator by opening a support ticket or using Azure Policy's exemption feature.

中文步骤

  1. 更新 ARM 模板或 Bicep 文件以使用允许的位置。示例:location: 'westus' 而不是 'eastus2'。然后重新部署。
  2. 通过提交支持工单或使用 Azure Policy 的豁免功能,向 Azure 策略管理员请求例外。

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Dependent resources might be in a different region, leading to latency or cross-region charges.

  2. 90% fail

    Policy is enforced by Azure administrators; disabling it requires elevated permissions and may be audited.

  3. 95% fail

    Azure policies are scoped to resource types and locations; changing the name does not affect the policy evaluation.