Azure Developer CLI (azd)
Azure Developer CLI manages project environments and provisioning. In APEX, the
matching Deploy agent uses the method selected by the approved plan and handoff.
azd does not replace the workflow’s policy, preview, or approval gates.
Quick decision
Section titled “Quick decision”| Situation | Action |
|---|---|
Approved project includes azure.yaml | Use its azd path through the matching Deploy agent. |
| Expected manifest, code, or handoff is missing | Return to CodeGen. Do not generate a generic preparation plan. |
| Existing project uses standalone Bicep or Terraform | Follow its verified handoff and the applicable legacy procedure. |
| Request is validation-only or preview-only | Report results and blockers within that scope, then stop. |
Comparison
Section titled “Comparison”azd provision manages infrastructure through the configured provider.
azd deploy deploys application code for configured services. azd up combines
lifecycle work and must not be used as a shortcut for an infrastructure-only
authorization.
Legacy deploy.ps1 procedures remain relevant only to existing projects that
use them. Do not create a new legacy script to work around a missing manifest.
Manifest migration belongs to CodeGen.
Per-project convention
Section titled “Per-project convention”Run commands in the relevant generated project directory:
infra/bicep/{project}/infra/terraform/{project}/When the project uses azd, azure.yaml and environment state under .azure/
belong there, not at the multi-project repository root. Review environment files
before sharing them; they can contain sensitive configuration.
APEX uses the contracts in agent-output/{project}/. It does not require a generic
.azure/plan.md. The generic preparation flow in apex-azure-prepare explicitly
returns APEX requests to their step owner.
azd workflow
Section titled “azd workflow”1. Prepare
Section titled “1. Prepare”Requirements, Architecture, Governance, and 05-IaC Planner establish the approved inputs. 06b-Bicep CodeGen or 06t-Terraform CodeGen generates the IaC modules, infra/{bicep|terraform}/{project}/azure.yaml, and 05-iac-handoff.json. Never place azure.yaml at the multi-project repository root, and do not ask Deploy to regenerate missing CodeGen artifacts.
2. Validate
Section titled “2. Validate”Select 07b-Bicep Deploy or 07t-Terraform Deploy and state a validation-only scope:
Validate the APEX project payment-gateway without preview or deployment.Check the current 05-iac-handoff.json and 04-environment-manifest.json.Report any missing prerequisites and do not create Azure resources.Validation reuse requires matching current file hashes, recorded Step 6 phase scope (policy_source current), and tool output.
3. Deploy
Section titled “3. Deploy”For an explicitly requested deployment, the deploy agent verifies Step 6 phase scope, runs policy-precheck-subagent and bicep-whatif-subagent or terraform-plan-subagent, presents the previewed changes, and waits for explicit human apply approval:
Prepare to deploy the approved payment-gateway project to its recorded dev target.Show the current preview and policy precheck results, then wait for my apply approval.Resource provisioning and application health are verified separately after deployment completes.
Environment preflight
Section titled “Environment preflight”Verify the intended subscription, location, environment, resource scope, and authentication before provisioning. Azure CLI and azd have separate authentication contexts.
az account show --output tableaz account get-access-token --resource https://management.azure.com/ --output noneazd auth login --check-statusDo not print tokens. Inspect environment values locally, and redact them before including logs in an issue. A missing Terraform backend is a blocker in validation-only or preview-only scope. Bootstrap needs a separate explicit setup/deployment request and authorization.
Legacy deploy.ps1 workflow
Section titled “Legacy deploy.ps1 workflow”Use an existing legacy procedure only when the project and its approved deployment method require it. Do not assume generic flags exist in every generated script. Read the script and plan before running it.
Single deployment
Section titled “Single deployment”The selected agent must preview the same inputs and scope that it will apply. Do not copy an apply command from a historical case study.
Phased deployment
Section titled “Phased deployment”Follow the phases in the approved implementation plan. Preview, obtain approval, apply, and verify one phase at a time. A phase name or a previous phase’s success does not authorize the next phase.
azd hooks
Section titled “azd hooks”Review lifecycle hooks in azure.yaml before running azd. A hook can create resources, modify RBAC, or run schema migrations, so its effects belong inside the approved deployment scope.
Do not append || true to suppress role-assignment or script errors. Inspect the actual exit status, confirm existing idempotent assignments explicitly, and surface unexpected failures.
azure.yaml schema
Section titled “azure.yaml schema”The manifest declares infra.provider, infra.path, optional services, and lifecycle hooks matching the generated project directory and 05-iac-handoff.json. Consult the official azure.yaml schema reference for syntax details.
Troubleshooting
Section titled “Troubleshooting”| Failure | Next step |
|---|---|
azure.yaml not found | Check that your working directory is infra/{bicep|terraform}/{project}/, or return to CodeGen if the manifest was omitted. |
| Missing parameter or environment value | Reconcile against 04-environment-manifest.json and recorded owner decisions. |
Preview fails despite az login | Check azd auth login --check-status separately because az and azd maintain distinct token caches. |
| Terraform backend is missing | Report the blocker; never bootstrap remote state during validation-only or preview-only requests. |
| Policy or preview evidence is stale | Re-run policy-precheck-subagent and preview against the current IaC tree before requesting approval. |
| A lifecycle hook fails | Preserve the error output and fix the root cause in the owning step. |