Generated banner for Azure Developer CLI
Generated logo for Azure Developer CLI

Azure Developer CLI

GitHubOfficialFirst committed by massimobonanniDistributed by GitHub

  • Skill
  • Tool integration
  • Cloud and DevOps
  • MIT
  • No issues found

From the author

Design, create, review, migrate, or troubleshoot Azure Developer CLI (azd) projects using current Microsoft guidance. Use for azd, azure.yaml, AZD templates, Bicep or Terraform under infra, AZD environments and secrets, hooks, deployment workflows, and azd-managed CI/CD.
— the description by massimobonanni

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

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/github/azure-developer-cli/download
  2. Unzip 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:

  1. Find azure.yaml, the configured infra.path, source projects, deployment scripts, .gitignore, and pipeline definitions.

  2. Read azure.yaml before inferring services or the IaC provider.

  3. Identify whether the task is to create, migrate, review, deploy, or troubleshoot.

  4. Identify the active environment only when an environment-specific operation is required.

  5. Read the relevant reference:

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 .env files, 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-secret when 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, or azd 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 azd project.

Use these defaults

ConcernPreferred default
Project manifestOne azure.yaml at the repository root
Application codesrc/<service-name> per independently deployable service
Infrastructureinfra with a thin entry point and reusable modules
IaC providerBicep unless the repository or user chooses Terraform
Deployment environmentsSeparate named environments for dev, test, staging, and production
Local AZD state.azure/<environment-name> and excluded from source control
Shared environment stateAZD remote environments backed by Azure Blob Storage
SecretsManaged identity/RBAC first, then Key Vault references
Automation scriptsShort, idempotent scripts under scripts/azd
CI authenticationWorkload identity federation/OIDC where supported
Routine developmentazd up for simple workflows; separate phases for controlled workflows

Implementation workflow

1. Model the application
  • Define one services entry 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, and host.

  • Keep shared infrastructure in IaC rather than inventing a fake deployable service.

  • Declare dependencies with supported azure.yaml fields instead of relying on file order.

2. Model infrastructure
  • Keep main.bicep or main.tf as 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>-dev for shared environments and <alias>-dev for personal environments.

  • Use azd env set, azd env unset, and azd env set-secret rather than editing .env directly.

  • Use -e or --environment in scripts and automation so the target is explicit.

  • Use azd env refresh to 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 shell explicitly. Provide windows and posix variants 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-prompt in 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 package

For 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.yaml paths 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.

  • .gitignore excludes .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

references/iac-and-environments.md

Infrastructure as code and environments

Choose the provider deliberately

Bicep

Use Bicep when:

  • The project is Azure-only.

  • Native Azure resource coverage and immediate API support matter.

  • The team wants a stateless deployment model.

  • Azure Verified Modules cover common resource patterns.

Bicep is AZD's default IaC provider.

Terraform

Use Terraform when:

  • The repository already uses Terraform.

  • The team has established Terraform module, state, policy, and review practices.

  • Cross-provider infrastructure is a real requirement.

Current Microsoft documentation marks AZD Terraform support as beta. Surface this constraint and do not migrate a project to Terraform merely for familiarity.

Bicep structure

Keep main.bicep as an orchestration layer:

infra/
|-- main.bicep
|-- main.parameters.json
|-- modules/
|   |-- core/
|   |-- data/
|   |-- identity/
|   |-- observability/
|   |-- services/
Bicep practices
  • Declare the deployment targetScope intentionally.

  • Use modules for cohesive capabilities and repeated patterns.

  • Prefer Azure Verified Modules when they meet the requirement and the team accepts their versioning model.

  • Pin module versions; review upgrades rather than floating automatically.

  • Add descriptions and validation decorators to parameters.

  • Pass parameters down through modules instead of reading AZD environment variables inside every module.

  • Use deterministic names that respect each resource type's length and character constraints.

  • Use uniqueString with stable scope inputs where global uniqueness is required.

  • Apply consistent project, environment, owner, and cost tags when policy allows.

  • Use managed identities and narrowly scoped role assignments.

  • Avoid keys and connection strings when identity-based access is available.

  • Output resource IDs, names, and endpoints required by later phases.

  • Never output secret values. Deployment outputs are copied into the AZD environment.

Parameter flow

Use main.parameters.json to map AZD environment values into Bicep:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "environmentName": {
      "value": "${AZURE_ENV_NAME}"
    },
    "location": {
      "value": "${AZURE_LOCATION}"
    }
  }
}

Match those values in the entry point:

@description('Stable name of the AZD deployment environment.')
@minLength(1)
param environmentName string

@description('Primary Azure region for this deployment.')
param location string

Use outputs as the contract between provisioning and later AZD phases:

output SERVICE_API_ENDPOINT_URL string = api.outputs.endpoint

Choose stable output names because services, hooks, and pipelines may consume them as environment variables.

When using AZD environment secrets with Bicep:

  • Mark the Bicep input with @secure().

  • Map the AZD secret reference through main.parameters.json.

  • Do not output the secure value.

  • Be aware that current AZD documentation says environment secrets are not supported with .bicepparam files.

Terraform structure and state

Terraform practices
  • Set infra.provider: terraform explicitly in azure.yaml.

  • Keep all AZD-managed .tf files under the configured infrastructure path.

  • Pin Terraform and provider versions and commit the dependency lock file.

  • Use modules with clear inputs and outputs.

  • Mark sensitive variables and outputs as sensitive, but remember that sensitive values can still exist in state.

  • Do not commit .tfstate, plan files, crash logs, or provider credentials.

  • Avoid splitting ownership of the same Azure resource between AZD and an unrelated Terraform root module.

Authentication

Terraform's Azure provider uses Azure CLI authentication by default and does not use the AZD credential cache. Prefer the documented single-sign-in configuration:

azd config set auth.useAzCliAuth true
az login

Otherwise, both azd auth login and az login are required.

Remote state

Configure a protected remote backend before azd pipeline config or collaborative deployments:

  • Use a dedicated storage account and private container where appropriate.

  • Restrict access with RBAC and network controls.

  • Enable platform protections such as versioning, soft delete, and resource locks according to organizational policy.

  • Use a distinct state key per project and environment.

  • Treat state as sensitive data.

  • Do not store backend access keys in source control.

AZD reads Terraform backend settings from infra/provider.conf.json when configured according to the official Terraform integration.

Environment strategy

AZD stores local environment state under:

.azure/
|-- config.json
|-- <environment-name>/
    |-- .env
    |-- config.json

The entire .azure directory should remain out of source control.

Naming

Use names that make ownership and lifecycle clear:

  • Shared: <project>-dev, <project>-test, <project>-prod

  • Personal: <alias>-<purpose> or <alias>-dev

  • Ephemeral: <project>-pr-<number> when automation also guarantees cleanup

Keep the name short enough to support resources with restrictive naming limits.

Management

Use AZD commands rather than manual file editing:

azd env new <name>
azd env list
azd env select <name>
azd env set <key> <value>
azd env get-value <key>
azd env unset <key>
azd env refresh

In automation and potentially destructive operations, target the environment explicitly:

azd provision -e <environment> --no-prompt
azd deploy -e <environment> --no-prompt
Configuration rules
  • Keep one IaC codebase and vary behavior through parameters.

  • Keep nonsecret defaults in reviewed configuration or IaC, not in committed .azure files.

  • Use azd env set for deployment-specific nonsecret settings.

  • Allow IaC outputs to populate computed resource names and endpoints.

  • Avoid environment-name conditionals scattered across modules. Prefer explicit feature or SKU parameters.

  • Use azd env refresh after another actor changes deployment outputs.

  • Do not assume the currently selected environment in scripts.

Shared and remote environments

Configure state.remote when teammates or automation need a shared AZD environment:

state:
  remote:
    backend: AzureBlobStorage
    config:
      accountName: <storage-account-name>
      containerName: <project-container-name>

Remote AZD state synchronizes .env and AZD config.json; it is separate from Terraform remote state. A Terraform project that collaborates through AZD can require both:

  • AZD remote state for environment configuration.

  • Terraform remote state for managed infrastructure state.

Protect both stores with least-privilege RBAC and appropriate data-protection settings.

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
GitHub avatar of massimobonannimassimobonanni
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