Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Run pre-deployment validation checks on Azure configuration, Bicep/Terraform, and permissions
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/recipes/azd/aspire.md
1# Aspire Validation23> ⚠️ **Only load this file when the project is a .NET Aspire application.**45Validation steps specific to .NET Aspire projects deployed via AZD.67## Detection89A project is Aspire-based if any of these are true:1011| Indicator | Check |12|-----------|-------|13| AppHost project | `find . -name "*.AppHost.csproj"` |14| Aspire.Hosting package | `grep -r "Aspire.Hosting" . --include="*.csproj"` |1516**If none found → skip this file entirely.**1718---1920## Pre-Provisioning: Functions Secret Storage2122> ⚠️ **CRITICAL — Must run BEFORE `azd provision`.**2324Check if the project uses Azure Functions within Aspire and ensure `AzureWebJobsSecretStorageType` is configured.25See [Aspire Functions Secrets Reference](../../aspire-functions-secrets.md) for detection commands, fix examples, and full details.2627**If `AddAzureFunctionsProject` is NOT found**, skip this section.2829---3031## Post-Provisioning: Container Apps Environment Variables3233> ⚠️ **CRITICAL — Run AFTER `azd provision` but BEFORE `azd deploy`.**3435When using Aspire with Container Apps in "limited mode" (in-memory infrastructure generation), `azd provision` creates Azure resources but doesn't automatically populate environment variables that `azd deploy` needs.3637**Check if environment variables are set:**3839```bash40azd env get-values | grep -E "AZURE_CONTAINER_REGISTRY_ENDPOINT|AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID|MANAGED_IDENTITY_CLIENT_ID"41```4243**If any are missing, set them now BEFORE running `azd deploy`:**4445```bash46# Get resource group name47RG_NAME=$(azd env get-values | grep AZURE_RESOURCE_GROUP | cut -d'=' -f2 | tr -d '"')4849# Set required variables50azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT $(az acr list --resource-group "$RG_NAME" --query "[0].loginServer" -o tsv)51azd env set AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID $(az identity list --resource-group "$RG_NAME" --query "[0].id" -o tsv)52azd env set MANAGED_IDENTITY_CLIENT_ID $(az identity list --resource-group "$RG_NAME" --query "[0].clientId" -o tsv)53```5455**PowerShell:**56```powershell57# Get resource group name58$rgName = (azd env get-values | Select-String 'AZURE_RESOURCE_GROUP').Line.Split('=')[1].Trim('"')5960# Set required variables61azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT (az acr list --resource-group $rgName --query "[0].loginServer" -o tsv)62azd env set AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID (az identity list --resource-group $rgName --query "[0].id" -o tsv)63azd env set MANAGED_IDENTITY_CLIENT_ID (az identity list --resource-group $rgName --query "[0].clientId" -o tsv)64```6566**Why this is needed:** Aspire's "limited mode" generates infrastructure in-memory. While `azd provision` creates all necessary Azure resources (Container Registry, Managed Identity, Container Apps Environment), it doesn't populate the environment variables that reference those resources. The `azd deploy` phase requires these variables to authenticate with the container registry and configure managed identity bindings.67