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

- **ID:** `policy/azure-policy-resource-location-not-allowed`
- **Domain:** policy
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Azure Policy 'Allowed locations' restricts resource creation to specific regions; the requested location is not in the allowlist.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Azure CLI 2.57.0 | active | — | — |
| Azure PowerShell 11.0.0 | active | — | — |
| Terraform azurerm 3.100.0 | active | — | — |

## Workarounds

1. **Deploy the resource in an allowed location, e.g., change location from 'eastus2' to 'westus' in ARM template: `"location": "westus"`** (95% success)
   ```
   Deploy the resource in an allowed location, e.g., change location from 'eastus2' to 'westus' in ARM template: `"location": "westus"`
   ```
2. **Request an exemption for the resource from the policy administrator via Azure Policy Portal.** (50% success)
   ```
   Request an exemption for the resource from the policy administrator via Azure Policy Portal.
   ```
3. **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"]}}'`** (85% success)
   ```
   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"]}}'`
   ```

## Dead Ends

- **Retrying the deployment in the same disallowed region with different resource names** — The policy is location-based, not name-based; the region itself is blocked regardless of resource name. (100% fail)
- **Adding the resource to an existing resource group in the allowed region but specifying the disallowed location in the template** — The location is evaluated per resource, not per resource group; the template location must match the allowed list. (80% fail)
- **Creating a new subscription to bypass the policy** — Azure Policies can be assigned at management group level, affecting all subscriptions under it; a new subscription may still inherit the policy. (60% fail)
