Azure Developer CLI
GitHubOfficialFirst committed by massimobonanniDistributed by GitHub
- Skill
- Tool integration
- Cloud and DevOps
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to working with the Azure Developer CLI (azd). It covers the full lifecycle of azd projects, including project structure, infrastructure as code (Bicep or Terraform), environment management, lifecycle hooks, and CI/CD pipeline configuration. It emphasizes security best practices, such as avoiding hardcoded secrets and leveraging managed identities, while ensuring projects remain maintainable and environment-aware.
What it does
- Assists in designing and structuring new azd projects.
- Provides guidance on configuring azure.yaml and infrastructure modules.
- Helps manage environment variables, secrets, and remote environment states.
- Supports the implementation of lifecycle hooks for custom automation.
- Guides the setup and configuration of azd-managed CI/CD pipelines.
- Offers troubleshooting steps for deployment and provisioning issues.
When to use it
- When initializing a new project using the Azure Developer CLI.
- When migrating existing infrastructure to an azd-compatible structure.
- When configuring infrastructure as code using Bicep or Terraform within azd.
- When setting up or debugging CI/CD pipelines for Azure deployments.
- When needing to implement environment-specific configurations or secrets.
Advantages
- Promotes consistent project structures and best practices.
- Ensures security by enforcing safe handling of secrets and credentials.
- Facilitates environment-aware deployments for dev, test, and production.
- Reduces manual effort by leveraging standardized azd workflows.
- Provides clear paths for troubleshooting and validation.
Usage examples
- “How should I structure my project to support multiple environments with azd?”
- The agent will explain the use of azure.yaml, separate environment folders, and how to parameterize Bicep or Terraform files to handle environment-specific values.
- “Help me configure a GitHub Actions pipeline for my azd project.”
- The agent will guide you through using azd pipeline config, ensuring correct authentication via OIDC and proper environment variable handling.
- “How do I safely add a secret to my azd environment?”
- The agent will instruct you to use azd env set-secret and explain why you should avoid committing secrets to source control or local .env files.
- “My azd deployment is failing; how can I troubleshoot it?”
- The agent will walk you through checking the azure.yaml configuration, validating IaC files, and using azd hooks to inspect the deployment process.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/github/azure-developer-cli/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip azure-developer-cli.zip -d .agents/skills
Documentation by massimobonanni
Azure Developer CLI best practices
Use this skill to produce maintainable, secure, environment-aware azd projects. Prefer repository conventions when they are already coherent, and make the smallest complete change that improves the project.
Start with repository discovery
Before editing:
Find
azure.yaml, the configuredinfra.path, source projects, deployment scripts,.gitignore, and pipeline definitions.Read
azure.yamlbefore inferring services or the IaC provider.Identify whether the task is to create, migrate, review, deploy, or troubleshoot.
Identify the active environment only when an environment-specific operation is required.
Read the relevant reference:
Repository layout or
azure.yaml: references/project-structure.mdBicep, Terraform, parameters, outputs, or environments: references/iac-and-environments.md
Secrets, hooks, CI/CD, deployment, or troubleshooting: references/security-cicd-operations.md
Product details that may have changed: references/official-docs.md
Do not assume the default infra path, the default Bicep provider, or a single service when azure.yaml says otherwise.
Apply safety guardrails
Never commit
.azure, environment.envfiles, credentials, deployment outputs containing secrets, local Terraform state, or generated deployment artifacts.Never put literal secrets in
azure.yaml, IaC parameter files, hooks, source control, command arguments that will be logged, or IaC outputs.Prefer managed identities and RBAC. Use Key Vault references and
azd env set-secretwhen a secret is unavoidable.Before a command that can create, modify, or delete Azure resources, confirm the target environment, subscription, tenant, region, and expected scope.
Treat an explicit user request to deploy, provision, destroy, or configure a pipeline as approval for that named action. Otherwise, ask before running
azd up,azd provision,azd deploy,azd down, orazd pipeline config.Do not replace Bicep with Terraform, Terraform with Bicep, or an established hosting service unless the user requests that architectural change.
Preserve resources and state owned outside the current
azdproject.
Use these defaults
| Concern | Preferred default |
|---|---|
| Project manifest | One azure.yaml at the repository root |
| Application code | src/<service-name> per independently deployable service |
| Infrastructure | infra with a thin entry point and reusable modules |
| IaC provider | Bicep unless the repository or user chooses Terraform |
| Deployment environments | Separate named environments for dev, test, staging, and production |
| Local AZD state | .azure/<environment-name> and excluded from source control |
| Shared environment state | AZD remote environments backed by Azure Blob Storage |
| Secrets | Managed identity/RBAC first, then Key Vault references |
| Automation scripts | Short, idempotent scripts under scripts/azd |
| CI authentication | Workload identity federation/OIDC where supported |
| Routine development | azd up for simple workflows; separate phases for controlled workflows |
Implementation workflow
1. Model the application
Define one
servicesentry for each independently deployable component.Keep service keys stable because they participate in resource discovery and deployment.
Map each service to its actual
project,language, andhost.Keep shared infrastructure in IaC rather than inventing a fake deployable service.
Declare dependencies with supported
azure.yamlfields instead of relying on file order.
2. Model infrastructure
Keep
main.bicepormain.tfas the orchestration entry point.Split reusable or independently understandable infrastructure into modules.
Parameterize environment-specific values; do not fork the IaC tree per environment.
Output only stable, nonsecret values required by deployment or application configuration.
Use deterministic naming and consistent tags that include the project and environment.
Add role assignments to identities rather than distributing service keys.
Use infrastructure layers only when separate scopes or lifecycle dependencies justify them.
3. Model environments
Use predictable names such as
<project>-devfor shared environments and<alias>-devfor personal environments.Use
azd env set,azd env unset, andazd env set-secretrather than editing.envdirectly.Use
-eor--environmentin scripts and automation so the target is explicit.Use
azd env refreshto synchronize deployment outputs after another actor changes an environment.Configure AZD remote state when a team shares environment state.
4. Add hooks only for lifecycle gaps
Prefer declarative IaC and native service configuration over hooks.
Use root hooks for project-wide behavior and service hooks for service-specific behavior.
Keep nontrivial hook logic in versioned scripts under
scripts/azd.Set
shellexplicitly. Providewindowsandposixvariants when necessary.Make hooks idempotent, noninteractive in CI, and fail on errors unless failure is intentionally nonblocking.
Test a hook independently with
azd hooks run <hook-name>.
5. Build CI/CD deliberately
Keep the pipeline definition with the template and review generated changes from
azd pipeline config.Use short-lived federated credentials where the provider supports them.
Run tests and IaC validation before provisioning.
Use explicit environments and
--no-promptin automation.Add protected production environments and approval gates.
For Terraform, configure protected remote state before pipeline setup and account for current AZD authentication limitations.
Validate before finishing
Run only checks applicable to the repository:
Application: existing formatter, linter, type-check, build, and tests
Bicep: az bicep build --file infra/main.bicep
Terraform: terraform fmt -check -recursive
terraform init -backend=false
terraform validate
AZD hooks: azd hooks run <hook-name>
Packaging: azd packageFor a Bicep what-if or Terraform plan, choose the correct deployment scope and environment. These checks can authenticate to Azure or read remote state, so follow the safety guardrails.
Verify that:
azure.yamlpaths exist and service settings match the source projects.The IaC entry point and provider agree with
azure.yaml.Required deployment outputs match the variables consumed by services, hooks, and pipelines.
.gitignoreexcludes.azure, secrets, local state, and generated artifacts.No secret appears in tracked content or command output.
Documentation explains prerequisites, environment creation, deployment, verification, and cleanup.
Report the result
State:
The files and behavior changed.
The IaC provider and environment assumptions.
The checks performed.
Any cloud-changing command deliberately not run.
Any beta or preview feature the solution relies on.
Do not claim deployment success unless the target environment was actually deployed and verified.
Files
- ATTRIBUTION.mdAdded by AutoGineer840 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md7.5 KiB
- examples/azure.yaml767 B
- references/iac-and-environments.md6.8 KiB
- references/official-docs.md3.6 KiB
- references/project-structure.md5.3 KiB
- references/security-cicd-operations.md7.3 KiB
references/security-cicd-operations.md
Security, hooks, CI/CD, and operations
Identity and secret handling
Use this order of preference:
Managed identity with least-privilege RBAC.
Workload identity federation for CI/CD.
Key Vault reference through
azd env set-secret.Short-lived secret material only when no identity-based option exists.
Never:
Store a plaintext secret in
.azure/<environment>/.env.Commit environment files, credentials, certificates, or Terraform state.
Put secrets in IaC outputs.
Echo environment values indiscriminately in hooks or pipelines.
Pass a secret directly on a command line when the shell or CI system can record it.
Grant broad subscription roles when resource-group or resource scope is enough.
azd env set-secret <name> stores a Key Vault reference in the AZD environment. Resolve it only where needed:
Map it to an
@secure()Bicep parameter.Use a hook
secretsmapping for a hook process.Choose between a pipeline variable containing the Key Vault reference or a pipeline secret containing the resolved value.
Prefer the reference approach when the pipeline identity can read Key Vault because rotation does not require republishing a resolved pipeline secret.
Hooks
Use hooks for validation, generated runtime configuration, data preparation, smoke checks, or lifecycle coordination that IaC and native AZD behavior cannot express.
Hook rules
Prefer external scripts over long inline commands.
Store scripts under
scripts/azd.Set
shell: shorshell: pwshexplicitly.Supply
windowsandposiximplementations when syntax differs.Use paths relative to the documented hook working directory.
Make scripts idempotent and safe to rerun.
Keep
continueOnErrorfalse unless the operation is observability-only or genuinely optional.Use noninteractive behavior in CI.
Do not install unpinned dependencies on every run if a reproducible tool setup can do it once.
Do not log secret values or all environment variables.
Test with
azd hooks run <hook-name>before coupling the hook to a complete deployment.
Example:
hooks:
preprovision:
windows:
shell: pwsh
run: ./scripts/azd/validate.ps1
interactive: false
continueOnError: false
posix:
shell: sh
run: ./scripts/azd/validate.sh
interactive: false
continueOnError: falseUse root hooks for the whole project. Put service-specific hooks under that service's azure.yaml entry.
Deployment workflow
The normal AZD lifecycle is:
Package application artifacts.
Provision or update infrastructure.
Deploy application artifacts.
azd up is the convenient combined workflow and is appropriate for routine development and simple deployments.
Use separate commands when:
Infrastructure review or approval must happen before deployment.
The application is redeployed frequently without infrastructure changes.
Troubleshooting requires isolating package, provision, or deploy failures.
A complex dependency requires a custom order.
azd package
azd provision -e <environment>
azd deploy -e <environment>Customize workflows.up.steps only when a real dependency requires another order, such as provisioning before a build that needs a generated endpoint. Do not customize the workflow merely to mirror a pipeline's naming conventions.
Full-stack and multi-service dependencies
Map service dependencies before implementation.
Let Bicep or Terraform handle one-directional infrastructure dependencies.
Use provisioning outputs for endpoints and names needed during deployment.
Use runtime configuration, such as Azure App Configuration or a generated config file, when settings must change without rebuilding.
Avoid circular compile-time dependencies between front-end and back-end services.
Use hooks or a custom workflow only when outputs and runtime configuration cannot resolve the dependency.
Test the strategy independently in development, test, and production-like environments.
CI/CD
Pipeline design
A robust pipeline separates:
Application format, lint, build, and tests.
IaC format and static validation.
What-if or plan review at the correct scope.
Provisioning with an explicit AZD environment.
Deployment.
Smoke or health verification.
Production approval and rollback/cleanup procedures.
Use:
--no-promptin automation.A fixed
-eor--environment.Protected environments and required reviewers for production.
Concurrency controls to prevent simultaneous writes to one environment.
Least-privilege identities scoped to the target environment.
Pinned action and tool versions with a managed update process.
azd pipeline config
Current Microsoft documentation marks azd pipeline config as beta. Before running it:
Review the pipeline definition bundled with the template.
Confirm repository, organization, environment, subscription, and authentication mode.
Expect repository, identity, variable, secret, commit, push, and pipeline side effects.
Review generated workflow and permission changes before production use.
Rerun it when
pipeline.variablesorpipeline.secretschanges.
For GitHub Actions, AZD configures OIDC/federated credentials by default for supported scenarios. Current documentation says the AZD Terraform pipeline flow does not support OIDC, so evaluate the authentication tradeoff explicitly rather than silently falling back to a long-lived credential.
For Terraform, configure protected remote state before pipeline setup.
Validation and preview
Run local checks before Azure-changing commands:
Bicep
az bicep build --file infra/main.bicepUse an Azure deployment what-if at the scope declared by the template. Do not assume resource-group scope.
Terraform
terraform fmt -check -recursive
terraform init -backend=false
terraform validateUse terraform plan only after confirming the backend, workspace/state key, variables, and Azure identity.
AZD and application
Run existing application checks.
Run relevant hooks independently.
Run
azd packageto verify service paths and packaging.Confirm IaC outputs match variables consumed during deployment.
Inspect the environment name before provision, deploy, or down.
Troubleshooting sequence
Identify whether the failure is package, provision, deploy, hook, authentication, or resource discovery.
Re-run the smallest failing phase rather than
azd up.Check the selected environment and expected subscription, tenant, and region.
Check
azure.yamlpaths, provider, service names, host types, and resource discovery tags.Refresh environment outputs with
azd env refreshwhen Azure state changed elsewhere.For Terraform, verify both AZD and Azure CLI authentication and the correct remote state.
For hooks, run the hook directly and verify its shell, working directory, and environment dependencies.
Use debug logging only when needed, and redact sensitive values before sharing logs.
Cleanup
Confirm the exact environment before
azd down.Explain that cleanup can delete data-bearing resources.
Preserve externally owned or shared resources.
For ephemeral environments, automate cleanup and include a fallback for failed pipeline runs.
Verify deletion rather than assuming command success.
Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs a command-line tool
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- First committed by
massimobonanni
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/azure-developer-cli · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- massimobonanni
AutoGineer is not affiliated with or endorsed by massimobonanni or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download azure-developer-cli.zip