Error in creating Static Web App with location restriction policy

Sivaprasad Chidambaram 20 Reputation points
2025-05-13T08:21:52.67+00:00

I am getting the below error while creating Static Web App with the location restriction policy. There was no api location provided. How to overcome this?

{"code":"RequestDisallowedByPolicy","target":"StaticWebApp","message":"Resource 'StaticWebApp' was disallowed by policy. Policy identifiers: '[{\"policyAssignment\":{\"name\":\"Allowed locations for resource groups\",\"id\":\"/subscriptions/b7ceb4b5-7aa6-4b70-a468-16c31d16e5fb/providers/Microsoft.Authorization/policyAssignments/2360596671a4403baa122ed4\"},\"policyDefinition\":{\"name\":\"Allowed locations for resource groups\",\"id\":\"/providers/Microsoft.Authorization/policyDefinitions/e765b5de-1225-4ba3-bd56-1ac6695af988\",\"version\":\"1.0.0\"}}]'.","additionalInfo":[{"type":"PolicyViolation","info":{"evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Resources/subscriptions/resourceGroups","targetValue":"Microsoft.Resources/subscriptions/resourceGroups","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"location","path":"location","expressionValue":"centralus","targetValue":["centralindia","southindia","westindia","eastus","global"],"operator":"NotIn"}]},"policyDefinitionId":"/providers/Microsoft.Authorization/policyDefinitions/e765b5de-1225-4ba3-bd56-1ac6695af988","policyDefinitionName":"e765b5de-1225-4ba3-bd56-1ac6695af988","policyDefinitionDisplayName":"Allowed locations for resource groups","policyDefinitionVersion":"1.0.0","policyDefinitionEffect":"deny","policyAssignmentId":"/subscriptions/b7ceb4b5-7aa6-4b70-a468-16c31d16e5fb/providers/Microsoft.Authorization/policyAssignments/2360596671a4403baa122ed4","policyAssignmentName":"2360596671a4403baa122ed4","policyAssignmentDisplayName":"Allowed locations for resource groups","policyAssignmentScope":"/subscriptions/b7ceb4b5-7aa6-4b70-a468-16c31d16e5fb","policyAssignmentParameters":{"listOfAllowedLocations":["centralindia","southindia","westindia","eastus","global"]},"policyExemptionIds":[],"policyEnrollmentIds":[]}}]}

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Bhargavi Naragani 7,935 Reputation points Microsoft External Staff Moderator
    2025-05-13T08:36:15.0333333+00:00

    Hi @Sivaprasad Chidambaram,

    From the error message you've encountered while trying to create an Azure Static Web App, it appears that the deployment is being blocked by an Azure Policy that restricts where resources can be created. Specifically, the policy named "Allowed locations for resource groups" is denying the request because the region you’re trying to use (centralus) is not on the allowed list for your subscription. Your organization has defined a policy to enforce resource creation only in certain regions, likely for compliance, data residency, or governance reasons.

    According to the error allowed regions are: centralindia, southindia, westindia, eastus, and global and your attempted region: centralus – which is not allowed. As a result, Azure is blocking the creation of the resource, in this case, the Static Web App.

    To resolve the issue:

    Update your deployment to use one of the allowed locations mentioned in the policy:

    • centralindia
    • southindia
    • westindia
    • eastus
    • global (for globally distributed services like Azure CDN or DNS)

    When creating the Static Web App, make sure you specify the location as one of the above in your deployment template or CLI command.

    If you have a valid reason to deploy the resource in a different location (e.g., centralus), you can reach out to your Azure subscription or policy administrator. Request a policy exemption or an update to the policy to include centralus as an allowed region. This is typically done by someone with Owner or Policy Contributor permissions at the subscription level.

    Kindly refer to the below documentation for better understanding:
    Azure Policy: Deny resource creation based on location
    Azure Static Web Apps – Overview and region availability
    Manage policy assignments in Azure

    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.

    Let me know if you have any further Queries.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.