If you are unable to select the allowed regions in the Azure portal dropdown for deploying your Static Web App due to a policy assignment, you can try the following workaround using the Azure CLI:
- Use Azure CLI to Create the Static Web App: You can deploy your Static Web App in one of the allowed regions by using the Azure CLI. Here’s a command structure you can follow:
Replaceaz staticwebapp create \ --name frontend \ --resource-group <YourResourceGroup> \ --location <AllowedRegion> \ --source <YourRepoUrl> \ --branch deploy \ --app-location / \ --output-location build \ --sku Free<YourResourceGroup>with your resource group name and<AllowedRegion>with one of the permitted regions (e.g.,centralindia,malaysiawest, etc.). - ARM Templates: If you prefer using ARM templates, you can define your Static Web App in an ARM template and specify the allowed region in the template. Here’s a basic structure:
Make sure to replace{ "type": "Microsoft.StaticWebApps", "apiVersion": "2020-12-01", "name": "frontend", "location": "<AllowedRegion>", "properties": { "sourceControl": { "repoUrl": "<YourRepoUrl>", "branch": "deploy" }, "appLocation": "/", "outputLocation": "build" } }<AllowedRegion>and<YourRepoUrl>with the appropriate values. - Check Policy Assignment: Ensure that the policy assignment is correctly set up to allow deployments in the specified regions. If the policy is overly restrictive, you may need to adjust it or work with your Azure administrator to modify the policy settings.
By using the Azure CLI or ARM templates, you should be able to specify a permitted region for your Static Web App deployment even if it does not appear in the portal dropdown.
References: