Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Execute Azure deployments using azd, Terraform, or Bicep with built-in error recovery.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/troubleshooting.md
1# Troubleshooting23This reference covers common errors encountered during Azure deployment with `azd` and how to resolve them.45## Language Not Supported67**Symptom:** Error message like `ERROR: error executing step command 'package --all': initializing service 'web', getting framework service: language 'html' is not supported by built-in framework services`89**Cause:** Using unsupported language value in `azure.yaml`. Neither `html` nor `static` are valid language types for azd.1011**Solution:**1213For pure HTML/CSS static sites, omit the `language` field:1415```yaml16services:17web:18project: ./src/web # or . for root19host: staticwebapp20dist: . # relative to project path (only works when project != root)21```2223Valid language values: `python`, `js`, `ts`, `java`, `dotnet`, `go` (or omit for staticwebapp without build)2425## SWA Project Path Issues2627**Symptom:** Deployment fails, gets stuck in "Uploading", or shows default Azure page2829**Cause:** Incorrect `project` or `dist` configuration.3031**Solution:** Match configuration to your project layout:3233| Layout | `project` | `dist` |34|--------|-----------|--------|35| Static files in root | `.` | `public` (put files in public/ folder) |36| Framework in root | `.` | `dist`/`build`/`out` |37| Static in subfolder | `./src/web` | `.` |38| Framework in subfolder | `./src/web` | `dist`/`build`/`out` |3940> **SWA CLI Limitation:** When `project: .`, you **cannot** use `dist: .`. Put static files in a `public/` folder instead.4142## SWA Dist Not Found4344**Symptom:** Error like `dist folder not found` or empty deployment4546**Cause:** The `dist` path doesn't exist or build didn't run.4748**Solution:**491. For framework apps: ensure `language: js` is set to trigger build502. Verify `dist` value matches your framework's output folder513. For pure static in root: put files in `public/` folder and use `dist: public`524. For pure static in subfolder: use `dist: .`5354## Service Resource Not Found5556**Symptom:** Error message like `ERROR: getting target resource: resource not found: unable to find a resource tagged with 'azd-service-name: web'`5758**Cause:** The Azure resource is missing the `azd-service-name` tag that azd uses to link services defined in `azure.yaml` to deployed infrastructure.5960**Solution:**6162Add the tag to your bicep resource definition:6364```bicep65resource staticWebApp 'Microsoft.Web/staticSites@2022-09-01' = {66name: name67location: location68tags: union(tags, { 'azd-service-name': 'web' }) // Must match service name in azure.yaml69// ... rest of config70}71```7273After updating, run `azd provision` to apply the tag, then `azd deploy`.7475## Location Not Available for Resource Type7677**Symptom:** Error message like `LocationNotAvailableForResourceType: The provided location 'westus3' is not available for resource type 'Microsoft.Web/staticSites'`7879**Cause:** Azure Static Web Apps is not available in all regions.8081**Solution:**8283Change to a supported region:8485```bash86azd env set AZURE_LOCATION westus287```8889Available regions for Static Web Apps: `westus2`, `centralus`, `eastus2`, `westeurope`, `eastasia`9091## Missing Infrastructure Parameters9293**Symptom:** Error message like `ERROR: prompting for value: no default response for prompt 'Enter a value for the '<param>' infrastructure parameter:'`9495**Cause:** A Bicep parameter exists in your template but no corresponding environment variable is set.9697**Example:** The `infra/main.bicep` has a parameter like:98```bicep99@description('SKU for the storage account.')100param storageAccountSku string101```102103**Solution:**1041051. Check `infra/main.parameters.json` for an existing mapping to this parameter.1061072. **If a mapping exists** (e.g., `"value": "${STORAGE_SKU}"`), ask the user for the desired value and set the environment variable:108```bash109azd env set STORAGE_SKU <user-provided-value>110```1111123. **If no mapping exists**, add one to `infra/main.parameters.json`:113```json114{115"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",116"contentVersion": "1.0.0.0",117"parameters": {118"storageAccountSku": {119"value": "${STORAGE_SKU}"120}121}122}123```124125> ⚠️ **Warning:** `main.parameters.json` uses ARM JSON syntax. Do **not** use `.bicepparam` syntax (`using`, `param`, `readEnvironmentVariable()`) in this file — `azd` will fail with a JSON parse error.126127Then ask the user for the desired value and set the environment variable:128```bash129azd env set STORAGE_SKU <user-provided-value>130```131132During `azd provision`, azd will substitute `${STORAGE_SKU}` with the value from the environment and will pass it to Bicep.133134**Reference:** [Use environment variables in infrastructure files](https://learn.microsoft.com/azure/developer/azure-developer-cli/manage-environment-variables?tabs=bash#use-environment-variables-in-infrastructure-files)135136## .NET Aspire Limited Mode - Missing Environment Variables137138**Symptom:** When deploying .NET Aspire projects with azd, `azd provision` succeeds but `azd deploy` fails with errors about missing container registry or managed identity environment variables.139140**Cause:** .NET Aspire projects can use azd in "limited mode" where infrastructure is generated in-memory without creating an explicit `infra/` folder on disk. In this mode, `azd provision` creates Azure resources (Container Registry, Managed Identity, Container Apps Environment, etc.) but doesn't automatically populate certain environment variables that `azd deploy` needs.141142**Common missing variables:**143- `AZURE_CONTAINER_REGISTRY_ENDPOINT` — ACR login server URL144- `AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID` — Managed identity resource ID145- `MANAGED_IDENTITY_CLIENT_ID` — Managed identity client ID146147**Solution:**148149After `azd provision` completes, manually populate the missing environment variables:150151```bash152# Get your resource group name first153azd env get-values154155# Set the container registry endpoint156azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT $(az acr list --resource-group <resource-group-name> --query "[0].loginServer" -o tsv)157158# Set the managed identity resource ID159azd env set AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID $(az identity list --resource-group <resource-group-name> --query "[0].id" -o tsv)160161# Set the managed identity client ID162azd env set MANAGED_IDENTITY_CLIENT_ID $(az identity list --resource-group <resource-group-name> --query "[0].clientId" -o tsv)163```164165**PowerShell:**166```powershell167# Set the container registry endpoint168azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT (az acr list --resource-group <resource-group-name> --query "[0].loginServer" -o tsv)169170# Set the managed identity resource ID171azd env set AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID (az identity list --resource-group <resource-group-name> --query "[0].id" -o tsv)172173# Set the managed identity client ID174azd env set MANAGED_IDENTITY_CLIENT_ID (az identity list --resource-group <resource-group-name> --query "[0].clientId" -o tsv)175```176177Then retry deployment:178```bash179azd deploy --no-prompt180```181182## Container Apps — RBAC Propagation Timeout183184**Symptom:** During `azd up`, infrastructure provisions successfully but the Container App revision creation times out (~900s). Container App shows `provisioningState: Failed` with no active revision.185186**Cause:** The managed identity's `AcrPull` role assignment hasn't propagated before the Container App attempts to pull the image from ACR. Azure RBAC propagation can take 1–5 minutes.187188**Solution:**1891901. Verify the `AcrPull` role exists on the ACR for the Container App's managed identity (see [AZD Errors — Container App Revision Timeout](recipes/azd/errors.md#container-app-revision-timeout))1912. If missing, assign it manually with `--assignee-principal-type ServicePrincipal`1923. Wait 2–5 minutes for RBAC propagation before retrying1934. Set `AZURE_CONTAINER_REGISTRY_ENDPOINT` env var1945. Run `azd deploy --no-prompt`; if it still fails, wait a little longer and retry with backoff until propagation completes195196**Prevention:**197198- Include `AcrPull` role assignment in Bicep with `principalType: 'ServicePrincipal'`199- Use `azd provision` + `azd deploy` (separate steps) instead of `azd up` to allow propagation time200