Subchapter 28.9
references/recipes/azd/README.mdMarkdown5 KBView on GitHub
azure.yaml exists in project root./infra/ contains Bicep files./infra/ contains .tf files and azure.yaml has infra.provider: terraformVerify AZD is installed:
azd versionIf not installed:
mcp_azure_mcp_extension_cli_install(cli-type: "azd")Validate azure.yaml against official schema:
mcp_azure_mcp_azd(command: "validate_azure_yaml", parameters: { path: "./azure.yaml" })Verify AZD environment exists and is configured. See Environment Setup for detailed steps.
azd auth login --check-statusIf not logged in:
azd auth loginCheck environment values:
azd env get-valuesIf AZURE_SUBSCRIPTION_ID or AZURE_LOCATION not set:
Use Azure MCP tools to list subscriptions:
mcp_azure_mcp_subscription_listUse Azure MCP tools to list resource groups (check for conflicts):
mcp_azure_mcp_group_list
subscription: <subscription-id>Prompt user to confirm subscription and location before continuing.
Refer to the region availability reference to select a region supported by all services in this template:
azd env set AZURE_SUBSCRIPTION_ID <subscription-id>
azd env set AZURE_LOCATION <location>If this is a .NET Aspire project (detected by *.AppHost.csproj or Aspire.Hosting package reference), run the Pre-Provisioning checks in Aspire Validation before continuing. If not Aspire, skip this step.
Validate IaC is ready (must complete without error):
azd provision --preview --no-prompt💡 Note: This works for both Bicep and Terraform. azd will automatically detect the provider from
azure.yamland run the appropriate validation (bicep buildorterraform plan).
If azd provision --preview fails with unsupported resource type:
⛔ Stop deployment immediately. Do NOT attempt to fix or work around the error.
This 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.
Required actions:
.ExcludeFromManifest()).azd provision or azd deploy.unsupported resource type: <type-name>) that cannot be deployed to Azure. The application is designed for local development only.”⚠️ 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.
Build 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.
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:
Dockerfilenpm ci, verify package-lock.json exists in the same directorypackage-lock.json is missing, generate it in the service’s project path directory before proceeding:cd <service-project-path>
npm install --package-lock-only⚠️ Warning:
npm ciwill fail during Docker build ifpackage-lock.jsonis missing. This check prevents Docker build failures duringazd packageandazd up.
Confirm all services package successfully:
azd package --no-promptSee Policy Validation Guide for instructions on retrieving and validating Azure policies for your subscription.
If this is a .NET Aspire project, run the Post-Provisioning checks in Aspire Validation before proceeding to deployment. If not Aspire, skip this step.
All checks pass → azure-deploy