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/README.md
1# AZD Validation23Validation steps for Azure Developer CLI projects.45## Prerequisites67- `azure.yaml` exists in project root8- Infrastructure files exist:9- For Bicep: `./infra/` contains Bicep files10- For Terraform: `./infra/` contains `.tf` files and `azure.yaml` has `infra.provider: terraform`1112## Validation Steps1314- [ ] 1. AZD Installation15- [ ] 2. Schema Validation16- [ ] 3. Environment Setup17- [ ] 4. Authentication Check18- [ ] 5. Subscription/Location Check19- [ ] 6. Aspire Pre-Provisioning Checks20- [ ] 7. Provision Preview21- [ ] 8. Build Verification22- [ ] 9. Docker Build Context Validation23- [ ] 10. Package Validation24- [ ] 11. Azure Policy Validation25- [ ] 12. Aspire Post-Provisioning Checks2627## Validation Details2829### 1. AZD Installation3031Verify AZD is installed:3233```bash34azd version35```3637**If not installed:**38```39mcp_azure_mcp_extension_cli_install(cli-type: "azd")40```4142### 2. Schema Validation4344Validate azure.yaml against official schema:4546```47mcp_azure_mcp_azd(command: "validate_azure_yaml", parameters: { path: "./azure.yaml" })48```4950### 3. Environment Setup5152Verify AZD environment exists and is configured. See [Environment Setup](environment.md) for detailed steps.5354### 4. Authentication Check5556```bash57azd auth login --check-status58```5960**If not logged in:**61```bash62azd auth login63```6465### 5. Subscription/Location Check6667Check environment values:68```bash69azd env get-values70```7172**If AZURE_SUBSCRIPTION_ID or AZURE_LOCATION not set:**7374Use Azure MCP tools to list subscriptions:75```76mcp_azure_mcp_subscription_list77```7879Use Azure MCP tools to list resource groups (check for conflicts):80```81mcp_azure_mcp_group_list82subscription: <subscription-id>83```8485Prompt user to confirm subscription and location before continuing.8687Refer to the region availability reference to select a region supported by all services in this template:88- [Region availability](../../region-availability.md)8990```bash91azd env set AZURE_SUBSCRIPTION_ID <subscription-id>92azd env set AZURE_LOCATION <location>93```9495### 6. Aspire Pre-Provisioning Checks9697**If this is a .NET Aspire project** (detected by `*.AppHost.csproj` or `Aspire.Hosting` package reference), run the **Pre-Provisioning** checks in [Aspire Validation](aspire.md) before continuing. **If not Aspire, skip this step.**9899### 7. Provision Preview100101Validate IaC is ready (must complete without error):102103```bash104azd provision --preview --no-prompt105```106107> ๐ก **Note:** This works for both Bicep and Terraform. azd will automatically detect the provider from `azure.yaml` and run the appropriate validation (`bicep build` or `terraform plan`).108109**If `azd provision --preview` fails with `unsupported resource type`:**110111โ **Stop deployment immediately.** Do NOT attempt to fix or work around the error.112113This error means the Aspire AppHost contains custom resource types that have no Azure deployment target (e.g., `HealthChecksUI`, custom child resources, or local-only integrations). These resources are intentionally designed for local development tooling and cannot be meaningfully deployed to Azure.114115**Required actions:**1161. โ **Do NOT modify source code** to suppress the error (e.g., do not add `.ExcludeFromManifest()`).1172. โ **Do NOT proceed with `azd provision` or `azd deploy`.**1183. โ Inform the user: "This application contains custom Aspire resource types (`unsupported resource type: <type-name>`) that cannot be deployed to Azure. The application is designed for local development only."1194. โ Record a blocker: "Deployment blocked โ AppHost contains unsupported resource types with no Azure deployment target."120121> โ ๏ธ Adding `.ExcludeFromManifest()` to suppress the error may allow provisioning to proceed, but the resulting deployment will not represent the application's actual functionality and is not a valid deployment.122123### 8. Build Verification124125Build the project and verify there are no errors. If the build fails, fix the issues and re-build until it succeeds. Do NOT proceed to packaging or deployment with build errors.126127### 9. Docker Build Context Validation128129**If any service in `azure.yaml` uses a Dockerfile** (check the service's `project` path from `azure.yaml` for a `Dockerfile`), validate the build context before packaging:1301311. Read each service's `Dockerfile`1322. If the Dockerfile contains `npm ci`, verify `package-lock.json` exists in the same directory1333. If `package-lock.json` is missing, generate it in the service's `project` path directory before proceeding:134135```bash136cd <service-project-path>137npm install --package-lock-only138```139140> โ ๏ธ **Warning:** `npm ci` will fail during Docker build if `package-lock.json` is missing. This check prevents Docker build failures during `azd package` and `azd up`.141142### 10. Package Validation143144Confirm all services package successfully:145146```bash147azd package --no-prompt148```149150### 11. Azure Policy Validation151152See [Policy Validation Guide](../../policy-validation.md) for instructions on retrieving and validating Azure policies for your subscription.153154### 12. Aspire Post-Provisioning Checks155156**If this is a .NET Aspire project**, run the **Post-Provisioning** checks in [Aspire Validation](aspire.md) before proceeding to deployment. **If not Aspire, skip this step.**157158## References159160- [Environment Setup](environment.md)161- [Aspire Validation](aspire.md)162- [Error Handling](./errors.md)163164## Next165166All checks pass โ **azure-deploy**167