Azure Developer Azure Developer Cli
Azure Developer Azure Developer Cli
Get started
b GET STARTED
Install azd
g TUTORIAL
g TUTORIAL
Troubleshooting
Popular templates
s SAMPLE
Video content
d TRAINING
Community standups
c HOW-TO GUIDE
i REFERENCE
Azure Developer CLI Reference
What is the Azure Developer CLI?
Article • 09/12/2024
The Azure Developer CLI ( azd ) is an open-source tool that accelerates your path from a
local development environment to Azure. azd provides best practice, developer-friendly
commands that map to key stages in your workflow, whether you're working in the
terminal, your editor or integrated development environment (IDE), or CI/CD
(continuous integration/continuous deployment).
You can use azd with extensible blueprint templates that include everything you need to
get an application up and running on Azure. These templates include reusable
infrastructure as code assets and proof-of-concept application code that can be
replaced with your own app code. You can also create your own template or find one to
build upon.
Introductory video
https://www.youtube-nocookie.com/embed/9z3PiHSCcYs
Next steps
View supported languages and environments
Install the Azure Developer CLI.
Walk through the azd quickstart to see Azure Developer CLI in action.
Feedback
Was this page helpful? Yes No
Welcome to the Azure Developer CLI ( azd )! Let's get started with installing and learning
how to run azd .
Start by selecting your development environment. For more information about the pros
and cons of the different development environment choices, see Azure Developer CLI
(azd) supported environments.
For more advanced installation scenarios and instructions, see Azure Developer CLI
Installer Scripts .
Note: When you install azd , the following tools are installed within azd scope (meaning
they aren't installed globally) and are removed if azd is uninstalled:
Install azd
PowerShell
Update azd
PowerShell
Uninstall azd
PowerShell
winget uninstall microsoft.azd
azd version
Output
Request help
For information on how to file a bug, request help, or propose a new feature for the
Azure Developer CLI, please visit the troubleshooting and support page.
Next steps
Quickstart - Select and deploy an azd template
Feedback
Was this page helpful? Yes No
In this quickstart, you'll learn how to provision and deploy app resources to Azure using
an Azure Developer CLI (azd) template and only a few azd commands. azd templates
are standard code repositories that include your application source code, as well as azd
configuration and infrastructure files to provision Azure resources. To learn more about
azd templates and how they can accelerate your Azure provisioning and deployment
You can also select a template that matches your preferences from the Awesome AZD
template gallery site. Regardless of which template you use, you'll end up with the
template code in your development environment and be able to run commands to
build, redeploy, and monitor the app in Azure.
Local install
Prerequisites
Install the Azure Developer CLI.
An Azure account with an active subscription. Create one for free .
Node.js with npm (v 16.13.1 LTS)
Review the architecture diagram and the Azure resources you'll deploy in the
Node.js template README .
Initialize the project
1. In File Explorer or a terminal, create a new empty directory, and change into it.
2. Run the azd init command and specify the template you want to use as a
parameter:
After you specify the environment, azd clones the template project to your
machine and initializes the project.
azd up
3. Once you are signed-in to Azure, you will be prompted for the following
information:
ノ Expand table
Parameter Description
Azure Location The Azure location where your resources will be deployed.
Azure Subscription The Azure Subscription where your resources will be deployed.
Select your desired values and press enter. The azd up command handles the
following tasks for you using the template configuration and infrastructure
files:
When the azd up command completes successfully, the CLI displays two links
to view resources created:
7 Note
You can call azd up as many times as you like to both provision and
deploy updates to your application. The deployment may fail due to a
resource being undeployable in the selected region. Because this is a
quick start, it is safe to delete the .azure directory and try azd up again.
When asked, select a different region. In a more advanced scenario you
could selectively edit files within the .azure directory to change the
region.
Clean up resources
When you no longer need the resources created in this article, run the following
command to power down the app:
If you want to redeploy to a different region, delete the .azure directory before running
azd up again. In a more advanced scenario you could selectively edit files within the
Request help
For information on how to file a bug, request help, or propose a new feature for the
Azure Developer CLI, please visit the troubleshooting and support page.
Next steps
Learn how to run and debug apps with azd.
Troubleshoot common problems when using Azure Developer CLI (azd).
Read the Azure Developer CLI frequently asked questions (FAQ).
Feedback
Was this page helpful? Yes No
In this quickstart, you explore and customize an Azure Developer CLI template. The hello-azd
template provides a simple starting point for building and deploying applications to Azure
using the Azure Developer CLI ( azd ). This quickstart expands on the concepts demonstrated in
the Quickstart - Deploy an azd template article.
Prerequisites
To complete this quickstart in your browser you'll need:
infra folder - Contains all of the Bicep or Terraform infrastructure as code files for the
azd template. azd executes these files to create the Azure resources required by your
app.
src folder - Contains the app source code. azd packages and deploys the code based on
configurations in azure.yaml .
azure.yaml file - A configuration file that maps source code folders in your project to
Azure resources defined in the infra folder for deployment. For example, you might
define an API service and a web front-end service in separate folders and map them to
different Azure resources for deployment.
.azure folder - Contains essential Azure configurations, such as the location to deploy
resources.
For example, most azd templates match the following folder structure:
Visit the Azure Developer CLI templates overview article for more details about azd template
structure.
deploy to Azure using a single command. The template provides a friendly UI with information
about azd and a small demo tool that allows you to upload and view support tickets.
Codespaces
4. After the Codespaces environment loads, initialize the azd template using the azd
init command:
Bash
1. Expand the src folder to view the source code of the app.
The hello-azd template includes a containerized .NET app that provides a simple UI
to learn about azd and manage sample ticket data. azd also supports other
languages like JavaScript and Python.
When you run azd up , the app is packaged as a container image and deployed to
Azure Container Apps.
This template uses Bicep files ( .bicep ) to create Azure resources, but you can also
use Terraform ( .tf ).
The main.bicep file creates Azure resources by referencing other Bicep modules in
the infra folder, such as an Azure Storage account:
Bicep
// Omitted...
// Omitted...
3. At the root of the template, open the azure.yaml file to view essential template
configurations:
The aca service configuration instructs azd to package and deploy the source code
in the src folder to the Azure Container App provisioned by the Bicep modules you
explored previously.
The docker configurations instruct azd to package and deploy the app as a
container.
yml
metadata:
template: hello-azd-dotnet # Specifies the template being used
name: azd-starter # Name of the project
services:
aca: # Define the Azure Container App service
project: ./src # Path to the source code
language: csharp # Programming language
host: containerapp # Hosting service
docker:
path: ./Dockerfile # Location of the Dockerfile
1. In the src > Components > Pages folder, open the Home.razor component.
2. Replace the Hello, Azure Developer CLI! header text at the top of the page with a different
message, such as Hello, customized template! and save your changes.
razor
4. Locate the block of Bicep code around line 75 that creates a storage account and a blob
container:
Bicep
Bicep
azd up
3. To see your updated application live, open the URL printed in the azd console output
logs in your browser.
4. To view the two blob containers that were created, navigate to the created storage
account in the Azure portal.
Conclusion
In this quickstart, you explored the structure of the hello-azd template, customized its
application and infrastructure, and deployed it to Azure using the Azure Developer CLI. For
more advanced scenarios, explore other templates or dive deeper into the azd documentation.
Next steps
What are Azure Developer CLI commands?
What are Azure Developer CLI templates?
Create Azure Developer CLI templates overview
Explore the Azure Developer CLI template
galleries
Article • 04/14/2025
Azure Developer CLI ( azd ) templates simplify the process of building, provisioning, and
deploying applications on Azure. This document explores what these templates are, their
purpose, and the available galleries, including Awesome AZD and the AI Template Gallery.
Include infrastructure as code to create app resources like Azure App Service or Azure
OpenAI
Define deployment configurations to package and deploy apps built with various
languages
Enable simplified, automated workflows for provisioning resources and deploying
applications
Provide starting points or architectural examples for building cloud-native apps
For more detailed information on azd templates, visit the templates overview page.
Awesome AZD
Awesome AZD is a community-driven collection of Azure Developer CLI templates, tools,
and resources. It includes templates for various application types, contributed by both
Microsoft and the developer community. The gallery is designed to showcase best practices
and innovative use cases for azd .
To learn more or contribute to the Awesome AZD gallery, visit the Awesome AZD GitHub
repository .
The AI Template Gallery simplifies the process of building and deploying AI-driven applications
by providing ready-to-use templates and best practices.
1. Create a repository containing your templates. Each template should follow the Azure
Developer CLI template structure, including application code, infrastructure as code files,
and deployment configurations.
2. Use the azd template command to add your repository as a source. For example:
Bash
3. Once added, you can list and use your custom templates just like the predefined ones:
Bash
By adding your own template sources, you can extend the capabilities of the Azure Developer
CLI and streamline development for your team or projects.
Conclusion
Azure Developer CLI template galleries, such as Awesome AZD and the AI Template Gallery,
provide developers with powerful starting points for building and deploying applications on
Azure. Whether you're creating a web app, exploring AI capabilities, or learning best practices,
these galleries offer valuable resources to accelerate your development process.
Supported languages and environments
Article • 09/13/2024
ノ Expand table
Local Machine Not in a container, You control all You have to manually Stable
via CLI dependencies are dependencies. You install all
manually installed may already have dependencies.
by you, and the some of the
project is run on dependencies
your local machine. installed. You don't
need Docker
installed.
Visual Studio Run and debug You can work with Requires installing an Beta
Code azd templates azd using a code extension.
using the Visual editor and extension
Studio Code system you may
extension . already be
comfortable with.
Visual Studio Run and debug You can work with Requires installing a Alpha
azd templates azd using an IDE you separate preview
using Visual Studio may already be version of Visual
(preview) . comfortable with. Studio.
DevContainer / Container with all Other than VS Code, You need to clone the Beta
VS Code dependencies Docker, and the repository. The
Remote - installed and run Remote Containers container
Containers on your local VS Code extension, initialization can take
machine. all dependencies are a long time.
installed for you in
the DevContainer.
GitHub Container with all All dependencies are Run and debug that Beta
Codespaces dependencies installed without requires launching a
installed and cloning the code web browser is
running on locally. currently not
Environment Description Pros Cons Feature
Stage
experimental and need to be enabled manually with azd config to use them. beta
features may experience breaking changes. stable features are not expected to
experience breaking changes.
For more information about each feature stage, see feature versioning and release
strategy. For a list of all features and their stages, see Alpha, Beta, and Stable Feature
Stages .
ノ Expand table
Azure Kubernetes Service Beta (only for projects deployable via kubectl apply -f )
ノ Expand table
Node.js Stable
Language Feature Stage
Python Stable
.NET Stable
Java Stable
For more information about each feature stage, see feature versioning and release
strategy
Next Steps
Install the Azure Developer CLI.
Walk through the azd quickstart to see Azure Developer CLI in action.
Feedback
Was this page helpful? Yes No
Azure provides multiple command-line tools to help users interact with cloud services. Two of
the most commonly used tools are the Azure Developer CLI and the Azure CLI. While both
options enable users to manage and deploy resources on Azure, they're designed for different
audiences and use cases. The following sections provide an overview of each tool, highlight
their differences, and offer comparisons to help you select the best tool for different situations.
High-level commands oriented around app lifecycle stages, such as provisioning and
deployment
A template system to define infrastructure as code and deployment configurations for
your app
Automated provisioning and deployment of app resources
Built-in CI/CD pipeline setup for GitHub Actions or Azure Pipelines
Galleries of starter app templates for common app architectures
Compare commands
You can print the available commands for both CLI tools to visualize these differences. For
example, run the Azure Developer CLI command azd help to view information about the tool
and available commands:
Output
Usage
azd [command]
Commands
Configure and develop your app
auth : Authenticate with Azure.
config : Manage azd configurations (ex: default Azure subscription,
location).
hooks : Develop, test and run hooks for an application. (Beta)
init : Initialize a new application.
restore : Restores the application's dependencies. (Beta)
template : Find and view template details. (Beta)
The commands in the preceding output map to high level development workflow concerns,
such as managing app deployments, app configuration, and monitoring.
However, if you run the az help command for the Azure CLI, you see output that resembles
the following output:
Output
Group
az
Subgroups:
account : Manage Azure subscription information.
acr : Manage private registries with Azure Container
Registries.
ad : Manage Microsoft Entra ID (formerly known as
Azure Active
Directory, Azure AD, AAD) entities needed for
Azure role-based
access control (Azure RBAC) through Microsoft
Graph API.
advisor : Manage Azure Advisor.
afd : Manage Azure Front Door Standard/Premium.
aks : Manage Azure Kubernetes Services.
ams : Manage Azure Media Services resources.
apim : Manage Azure API Management services.
appconfig : Manage App Configurations.
appservice : Manage App Service plans.
aro : Manage Azure Red Hat OpenShift clusters.
backup : Manage Azure Backups.
batch : Manage Azure Batch.
bicep : Bicep CLI command group.
billing : Manage Azure Billing.
bot : Manage Microsoft Azure Bot Service.
cache : Commands to manage CLI objects cached using
the `--defer`
In the preceding output, all of the commands focus on managing configurations for specific
Azure resources, such as Azure Container Registries or Azure Billing services.
Compare features
The following table highlights the key differences between the Azure Developer CLI and the
Azure CLI in more detail:
ノ Expand table
Primary use case End-to-end app lifecycle management Azure resource administration &
Functionality Azure Developer CLI ( azd ) Azure CLI ( az )
management
Type of tasks Provisioning and deploying app resources, Resource administration and scripting
CI/CD pipeline setup
IaC support Native support for IaC tools like Bicep and Requires separate IaC setup and
Terraform integration
The Azure Developer CLI is best suited for scenarios where you need to manage the end-to-
end workflow for application development and deployment. Example use cases include:
Conclusion
The Azure Developer CLI and Azure CLI are complementary tools designed for different
audiences and use cases. The Azure Developer CLI simplifies app packaging, provisioning, and
deployment for developers, while the Azure CLI provides granular control for administrative
tasks. Depending on your role and requirements, you can use one or both tools to achieve
your goals on Azure.
Explore the azd up workflow
Article • 04/29/2025
The Azure Developer CLI ( azd ) enables you to provision and deploy application resources on
Azure with only a single command using azd up . This guide provides a detailed breakdown of
azd up and how the different stages of this workflow command correlate to the structure of an
azd template.
For more information about getting started with azd and the hello-azd template, visit the
Quickstart: Deploy an Azure Developer CLI template article.
Essential concepts
When working with an azd template, you can provision and deploy your app resources on
Azure using the azd up command. Run the command from a terminal window that is open to
your template folder:
azd up
azd up is designed so that you can repeatedly run the command as you develop your app, and
the new changes are deployed incrementally. The command initiates a powerful workflow that
essentially wraps three specific stages:
You can also run each of these stages individually using their respective command, but azd up
provides a convenience wrapper to streamline the overall process. Each stage plays a critical
role in ensuring a smooth and automated deployment process. You can influence the azd up
workflow stages using configurations in the template azure.yaml file. The following sections
explore each stage in more detail.
The app code is prepared for deployment. Depending on the programming language the
template app is built with, packaging can involve building or compiling the app, bundling
dependencies, or creating deployment artifacts such as Docker images.
The azd template structure typically includes a src folder where the application code
resides. Build scripts or configuration files (such as a Dockerfile) can influence how the
application should be packaged.
The azure.yaml file contains configuration mappings that tell azd where your app code
lives and which language it uses so azd can package it appropriately.
This stage ensures that the application is in a deployable state before moving to the next
step.
You can run the packaging process on its own outside of azd up using the azd package
command:
azd package
For example, consider the following project structure and configurations of the hello-azd
starter template:
In the preceding image, the azure.yaml file:
When you run azd up (or azd package ), the Azure Developer CLI uses this combination of
configurations to build and package the app code in the src directory as a .NET container
image. If a Dockerfile wasn't configured, azd could also package the .NET app using the
standard .NET publishing process.
You can also run the provisioning process on its own outside of azd up using the azd
provision command:
azd provision
Bicep
Using the preceding Bicep code, azd creates the following resources:
You can also run the deployment process on its own outside of azd up using the azd deploy
command:
azd deploy
YAML
metadata:
template: hello-azd-dotnet
name: azd-starter
services:
aca:
project: ./src # The location of the service source code
language: csharp
host: containerapp # The provisioned resource to deploy the service to
docker:
path: ./Dockerfile
The preceding code instructs azd to deploy the artifacts packaged from the code in the src
folder to the containerapp that was created during the provisioning stage. You can also define
multiple services and map each to a different host.
Conclusion
The azd up workflow streamlines the process of deploying applications to Azure by
automating the packaging, provisioning, and deployment stages. Developers can ensure a
consistent and efficient deployment process by adhering to the azd template structure.
Whether you're deploying a simple web app or a complex microservices architecture, the azd
up command simplifies the journey from code to cloud.
Azure Developer CLI commands
overview
Article • 01/21/2025
The Azure Developer CLI ( azd ) is designed to streamline the end-to-end developer
workflow on Azure. azd provides high-level commands that act as abstractions to
simplify common developer tasks such as project initialization, infrastructure
provisioning, code deployment, and monitoring. azd commands are available in the
terminal, an integrated development environment (IDE), or through CI/CD (continuous
integration/continuous deployment) pipelines. In this article, you'll learn about the
following:
7 Note
Visit the Deploy an Azure Developer CLI template quickstart to explore a sample
azd command workflow in more detail.
The following table highlights the differences between a sample azd command and
other Azure command-line tools. Note that the azd provision command performs
numerous tasks at once, and does not have a direct equivalent in these other tools.
Many Azure CLI or PowerShell commands would be required to accomplish the same
task.
ノ Expand table
Azure CLI az webapp create --resource- Provisions a new web app in the specified
group myResourceGroup --plan resource group and app service plan.
myAppServicePlan --name
myWebApp
integration with the azd template system. Azure Developer CLI templates are code
projects that adhere to azd structural conventions and include sample application code,
infrastructure files, and configuration files. Most azd templates include the following:
azure.yaml file - A configuration file that defines one or more services in your
project and maps them to Azure resources defined in the infra folder for
deployment.
Without azd commands, these templates are just standard code repositories. Essentially,
azd templates serve as foundational blueprints, while CLI commands act as the engine
The azd provision command creates resources in Azure using the infrastructure-
as-code files in the infra folder of a template.
The azd deploy command deploys an app or service defined in the src folder.
7 Note
azd can also create and manage some Azure resources without the need to define
7 Note
For a complete list of azd commands and their parameters, visit the Azure
Developer CLI reference page.
template. This command essentially sets up the necessary files and directories to
start working with azd .
azd up : A convenience command to provision, package, and deploy all of your app
Infrastructure Provisioning
azd provision : Provisions the required Azure resources such as Azure Container
Code Deployment
azd package : Packages the application's code to be deployed to Azure.
azd deploy : Deploys your application code to the resources created by the azd
provision command.
application
Environment Management
azd env list : Lists all the different environments (e.g., development, staging,
Resource Cleanup
azd down : Deletes the Azure resources created by the template to clean up your
Next steps
What are Azure Developer CLI templates?
Feedback
Was this page helpful? Yes No
Azure Developer CLI ( azd ) templates are regular code repositories that include sample
application code, as well as azd configuration and infrastructure files. azd templates
enable you to provision Azure resources, deploy your application, configure CI/CD
pipelines, and more. You can either create your own templates, or get started using an
existing template from a template repository such as Awesome AZD . In this article,
you'll learn about the following concepts:
How azd templates enable you to provision and deploy app resources
How azd templates are structured
How to decide whether to use an existing template or create one
Explore existing azd starter templates
For example, suppose you work at a company that operates a ticket management and
customer communication platform, which requires the following Azure resources:
Two App Service instances and an App Service Plan to host a front-end web app
and back-end API
A Key Vault instance to store secure app secrets
A Cosmos DB database to permanently store app data
Azure Monitor resources such as Application Insights dashboards
A Service Bus to manage scalable messaging
CI/CD pipelines to ensure changes can be reliably deployed through an
automated, repeatable process.
Rather than starting from the ground up, with azd you can leverage existing
architecture templates to provision and deploy most of the resources for you. The
development team can then focus on building the app and making smaller adjustments
to the template architecture.
files that are used by the commands to perform tasks such as provisioning Azure
resources and deploy the app code to them.
For example, a typical azd workflow using an existing template includes the following
steps:
1. Run the azd init command with the --template parameter to clone an existing
template down from GitHub.
2. Run the azd auth login command to authenticate to your Azure subscription.
3. Run the azd up command to provision and deploy the template resources to
Azure. The azd up command leverages the configuration and infrastructure-as-
code (IaC) files in your template to provision Azure resources and deploy your
application to those resources.
azd up
4. Once your environment is set up in Azure, you can locally modify the application
features or Azure resource templates and then run azd up again to provision your
changes.
Understand Azure Developer CLI template
structure
All azd templates share a similar file structure based on azd conventions. Here are the
minimum required assets:
infra folder - Contains all of the Bicep or Terraform infrastructure as code files for
the azd template. azd executes these files to create the Azure resources required
to host your app.
azure.yaml file - A configuration file that defines one or more services in your
project and maps them to Azure resources defined in the infra folder for
deployment. For example, you might define an API service and a web front-end
service and map them to different Azure resources for deployment.
src folder - Contains all of the deployable app source code. Some azd templates
exclude the src folder and only provide infrastructure assets so you can add your
own application code.
7 Note
Templates that exclude the src folder are generally designed as infrastructure
starter templates.
azd templates also optionally include one or more of the following folders:
.github folder - Holds the CI/CD workflow files for GitHub Actions, the default
For example, a common azd template might match the following folder structure:
Start with an existing template or create your
own
There are two main approaches to working with azd templates:
For example, the following azd templates provide starting points for common app
architectures and frameworks:
C#
ノ Expand table
Template App host Tech stack
React Web App with C# API and Azure App Service Azure Cosmos DB for
MongoDB on Azure NoSQL, Bicep
React Web App with C# API and SQL Azure App Service Azure SQL Database,
Database on Azure Bicep
Static React Web App + Functions with Azure Static Web Apps, Azure SQL Database,
C# API and SQL Database on Azure Azure Functions Bicep
The following resources provide more information about creating your own templates:
Microsoft is not responsible for any non-Microsoft templates and does not screen these
templates for security, privacy, compatibility, or performance issues. The templates you
use with Azure Developer CLI, including those provided from Microsoft, are not
supported by any Microsoft support program or service. Any Microsoft-provided
templates are provided AS IS without warranty of any kind.
Next steps
Select and deploy a template
Feedback
Was this page helpful? Yes No
Azure Developer CLI ( azd ) features are introduced and supported using a phased
approach. Features begin in the alpha stage and then advance to beta and stable after
meeting various criteria. This article describes the definitions, expectations and
advancement requirements for each phase. See a full list of each feature /command
supported by azd and its current stage on GitHub
Alpha Features
All features start as alpha features (e.g., experimental). In this phase, the goal is to
receive sufficient usage to get meaningful feedback around the feature's design,
functionality and user experience. Alpha features can be enabled and managed using
the azd config command.
) Important
Definition
These features are under active development.
Features are hidden behind a feature flag, which interested users must explicitly
opt into.
There are no guarantees about the long-term stability or support of experimental
features.
No commitment that the feature is something the product team plans to advance
to preview or stable stage (it's an experiment).
Beta Features
The goal of this phase is to improve the feature experience and advance beyond proof
of concept.
) Important
Definition
Unlike alpha features, a user doesn't need to take explicit action to use a beta
feature.
Reduced number of breaking changes across releases for beta features as
functionality matures updates are made based on customer feedback.
Breaking changes are documented with explanations regarding how to digest
these breaks.
Beta commands are denoted as such (Beta) in azd product help.
Stable Features
Definition
The product team stand behind these features.
Breaking changes in these areas are unexpected.
The product team ensures that any breaking changes are rolled out in a way that
minimizes impact.
Use in business-critical scenarios.
Request help
For information on how to file a bug, request help, or propose a new feature for the
Azure Developer CLI, please visit the troubleshooting and support page.
Feedback
Was this page helpful? Yes No
The Azure Developer CLI ( azd ) utilizes templates to provision and deploy app resources
to the cloud. Developers can add support for azd commands and features by converting
their applications to templates. This article provides a contextual overview of the
different options for building azd templates. Once you understand the concepts in this
article, visit the following resources for more detailed implementation guides:
7 Note
This article assumes a general understanding of azd templates. Visit the template
overview doc for more information about templates.
An infra folder that holds the infrastructure as code (Bicep or Terraform) files.
An azure.yaml configuration file that maps your application services to the
provisioned infrastructure resources.
Other optional directories are often included as well, such as a .github folder with
assets to create a CI/CD pipeline. Visit the template overview doc for more information
about templates.
After converting this sample app to an azd template, the same app repository contains
the following:
The original app resources are unchanged, but new assets were added that azd
depends on for commands such as azd up :
An infra folder was added that includes Bicep files to create Azure resources.
An azure.yaml configuration file was added to map the app code in the src
directory to the provision Azure resources.
A .azure folder was created to hold azd environment variables.
A .github folder (optional) was added to support CI/CD pipelines through GitHub
actions.
Run the azd init command in the root of the directory you'd like to convert to an azd
template :
azd init
Visit the Start with your app code to create a template tutorial for details on how to
implement this approach and more information on which Azure resources support
automatic detection and scaffolding.
Select a template
Select this option to use an existing template that defines many of your Azure resources
and architectural goals as a starting point. azd will prompt you to select a starter
template or another template from the awesome-azd gallery. When you select a
template, the assets of that template are added to your existing project directory to use
as a starting point. Some templates include sample app code that you can replace with
your own, while some (called "starter templates") are infrastructure only.
Use the azd init command to pull down an existing template to an empty directory
and use it as a starting point for your own app. If the template includes app source
code, you can either build off of that code or replace the source code directory with
your own.
Visit the Start with an existing template tutorial for details on how to implement this
approach.
See also
Use an existing template for your app.
Create a template from your app code
Request help
For information on how to file a bug, request help, or propose a new feature for the
Azure Developer CLI, please visit the troubleshooting and support page.
Next steps
Azure Developer CLI FAQ
Feedback
Was this page helpful? Yes No
The Azure Developer CLI ( azd ) composability (compose) feature enables you to progressively
compose the Azure resources required for your app without manually writing Bicep code.
Compose also uses Azure Verified Modules (AVM) when possible, providing recommended
practices using building blocks for Azure.
7 Note
The azd compose feature is currently in alpha and shouldn't be used in production apps.
Changes to alpha features in subsequent releases can result in breaking changes. Visit the
azd feature versioning and release strategy and feature stages pages for more
information. Use the Feedback button on the upper right to share feedback about the
compose feature and this article.
Bash
Start with a prebuilt template, which defines resources and services to be provisioned and
deployed on Azure, and then customize. Browse templates in the AI template gallery or
the community gallery .
Start from an existing codebase by following the instructions in the simplified init flow.
Any further customization required the user to manually modify the Bicep files—until the
introduction of the compose feature.
Streamline resource creation with compose
The azd compose feature introduces a third option to add Azure resources to your apps.
Developers use the azd add command to instruct azd to compose new Azure resources and
update template configurations using minimal prompt workflows. This feature is useful for
developers who want to avoid writing Bicep or using an existing template.
Run the azd add command to start the compose workflow and add a new resource:
Bash
azd add
This command begins a prompt-based workflow that allows you to select a new resource to
create for your app:
Output
? What would you like to add? [Use arrows to move, type to filter]
> AI
Database
Host service
Key Vault
Messaging
Storage account
~Existing resource
When you're finished adding resources with azd add , run azd up or azd provision to create
the resources in Azure. azd manages resource creation internally until you Generate Bicep files
for the resources for further customization.
Visit the Build a minimal template using the compose feature article for a full walkthrough of
this feature.
Next steps
Compose quickstart
Build a minimal template using the Azure
Developer CLI compose feature
Article • 04/25/2025
The Azure Developer CLI ( azd ) composability (compose) feature enables you to progressively
compose the Azure resources required for your app without manually writing Bicep code. In
this article, you learn how to work with the compose feature to build a minimal template. Visit
the azd compose overview article for more conceptual information about this feature.
7 Note
The azd compose feature is currently in alpha and shouldn't be used in production apps.
Changes to alpha features in subsequent releases can result in breaking changes. Visit the
azd feature versioning and release strategy and feature stages pages for more
information. Use the Feedback button on the upper right to share feedback about the
compose feature and this article.
Use code in the current directory (for apps that target Azure Container Apps for hosting)
Create a minimal project
Templates initialized through the Select a template flow aren't currently supported. The azd
compose feature manages infrastructure for you and isn't compatible with templates that have
existing infra folder assets. Visit the Generate the Bicep code article and template creation
workflows page for more information.
Complete the following steps to add new resources to your template without writing any code:
2. Run the azd add command to add a new resource and start the compose workflow:
Bash
azd add
3. Select one of the supported resources to add to your app. For this example, select
Database .
Output
? What would you like to add? [Use arrows to move, type to filter]
> AI
Database
Host service
Key Vault
Messaging
Storage account
~Existing resource
Output
Output
6. If your app contains services, azd prompts you to select the service that uses this
resource.
Output
7. azd generates a preview of the required changes to the azure.yaml file. Press Enter to
accept and apply the changes.
Output
+ azddata:
+ type: db.postgres
webfrontend:
type: host.containerapp
uses:
- azddb
+ - azddata
port: 80
8. Run the azd up command to provision any changes made through the azd add
command. In this example, azd provisions a PostgreSQL database in Azure.
9. Run the azd add command again to add other resources, such as an OpenAI service.
services and resources composed through the azd add command using the corresponding
services and resources nodes. Consider the following example of an azure.yaml file updated
yml
name: azdcomposesample
metadata:
template: azd-init@1.11.0
services:
webfrontend:
project: src
host: containerapp
language: dotnet
resources:
webfrontend:
type: host.containerapp
port: 80
uses:
- azdsql
- azdchat
azdsql:
type: db.postgres
azdchat:
type: ai.openai.model
model:
name: gpt-4o
version: "2024-08-06"
Next steps
Generate Bicep code using the compose feature
Generate Bicep using the compose feature
Article • 04/25/2025
The Azure Developer CLI ( azd ) compose feature simplifies the process of building, deploying,
and managing cloud applications. By using azd compose , you can define and manage the
infrastructure and application code for your project in a unified way. This guide explains how to
generate Bicep code from the azd compose feature, enabling you to customize your cloud
infrastructure to meet your specific requirements.
7 Note
The azd infra synth feature is currently in alpha status and must be enabled before use:
Bash
When you run the azd infra synth command, the in-memory state is converted into Bicep
files in the infra folder. At this point, the infrastructure state transitions from being managed
in-memory to being represented as code, allowing for further customization.
Tip
Use azd compose to quickly prototype your infrastructure before committing to file-based
changes with azd infra synth .
Bash
azd infra synth
This command generates the corresponding Bicep files in the infra folder of your app.
7 Note
Running the azd infra synth command exits you from the azd compose feature and the
simplified initialization process. Any changes you make to the generated Bicep files are
not tracked by azd compose . For example, if you edit the Bicep code and then run azd
infra synth again, azd overwrites your changes with the regenerated code.
Next steps
Create Azure Developer CLI templates overview
Add Azure Developer CLI support to
your app using an existing template
Article • 09/13/2024
The Azure Developer CLI ( azd ) provides two different workflows to initialize a template
to use with your app, which include:
Use code in the current directory: This approach analyzes your app and
autogenerates supported infrastructure and configuration resources.
Select a template: This approach allows you to integrate an existing template with
your app, or use an existing template as a starting point for a new app.
Both of these approaches are explored in the Create Azure Developer CLI templates
overview doc.
In this article, you learn how to add support for the Azure Developer CLI ( azd ) to your
app through the Select a template approach. Visit the Add azd support to your app
using an existing template doc for more information on the alternative approach. You
can also visit the Training - build and deploy azd templates for more information on
building azd templates.
In this example, you'll use the Starter - Bicep template, which includes the essential
structure of an azd template and some useful boilerplate code to get started. Starter
templates are a great choice when you want to scaffold out the correct template
structure and starting resources, but still author your own infrastructure files.
1. To follow along with the steps ahead using an existing sample application, clone
the following starter project to an empty directory on your computer:
Bash
2. In your command line tool of choice, navigate to the root directory of the cloned
project.
Bash
azd init
5. From the list of templates, select Starter - Bicep. You can type the template name
or use your keyboard arrow keys to find it.
7. After you run azd init , the following assets are added to your current directory:
txt
1. Open the root project directory in your editor of choice, such as Visual Studio
Code.
2. Open the main.bicep file in the infra folder using your editor. This file contains
useful boilerplate code to setup essential variables, parameters, and naming
conventions. Beneath the comment block around line 50 that reads Add resources
to be provisioned below , add the following Bicep:
Bicep
7 Note
yml
name: msdocs-python-flask-webapp-quickstart
services:
web:
project: .
language: py
host: appservice
2. When the command finishes, click the link in the command output to navigate to
the deployed site.
Your project is now compatible with Azure Developer CLI and can be used as a template.
7 Note
azd also supports using Buildpack for containerizing your apps by default. If
your azd template targets Azure Container Apps or Azure Kubernetes Service but
does not include a Docker file, azd automatically generates an image using
Buildpack.
Feedback
Was this page helpful? Yes No
The Azure Developer CLI ( azd ) provides two different workflows to initialize a template
to use with your app, which include:
Use code in the current directory: This approach analyzes your app and
autogenerates supported infrastructure and configuration resources.
Select a template: This approach allows you to integrate an existing template with
your app, or use an existing template as a starting point for a new app.
Both of these approaches are explored in the Create Azure Developer CLI templates
overview doc.
In this article, you learn how to add support for the Azure Developer CLI ( azd ) to your
app through the Use code in the current directory approach. Visit the Add azd support
to your app using an existing template doc for more information on the alternative
approach. You can also visit the Training - build and deploy azd templates for more
information on building azd templates.
Bash
Bash
azd init
4. When prompted, select the option to Use code in the current directory. azd
analyzes the project and provides a summary of the detected services and
recommended Azure hosting resources.
5. Select Confirm and continue initializing my app. azd generates the following
assets in the project root directory:
More details on this detection and generation process are provided later in the
article.
6. The generated files work as-is for the provided sample app and may for your own
apps as well. If necessary, the generated files can be modified to fit your needs. For
example, you may need to further modify the infrastructure-as-code files in the
infra folder if your app relies on Azure resources beyond those that were
identified by azd .
7. Run the azd up command to provision and deploy your app to Azure.
Bash
azd up
8. When prompted, select the desired subscription and location to begin the
provisioning and deployment process.
9. When the process completes, click the link in the azd output to open the app in
the browser.
Detection
The azd init command detects project files for supported languages located in your
project directory and subdirectories. azd also scans package dependencies to gather
information about the web frameworks or databases your app uses. If needed, you can
manually add or edit the detected components as presented in the confirmation
summary prompt.
Supported languages:
Python
JavaScript/TypeScript
.NET
Java
Supported databases:
MongoDB
PostgreSQL
For Python and JavaScript/TypeScript, web frameworks and databases are
automatically detected.
When a JavaScript/TypeScript project uses a front-end (or client-side) web
framework, it is classified as a front-end service. If your service uses a front-end
web framework that is currently undetected, you may select JQuery to provide
equivalent front-end service classification and behavior.
Generation
After you confirm the detected components, azd init generates the infrastructure-as-
code files needed to deploy your application to Azure.
Supported hosts:
Azure Container Apps.
For databases, the supported mapping between database technology and service
used:
MongoDB: Azure CosmosDB API for MongoDB
PostgreSQL: Azure Database for PostgreSQL flexible server
Redis: Azure Container Apps Redis add-on
Services using databases will have environment variables that provide connection
to the database pre-configured by default.
When both front-end and back-end services are detected, CORS configuration on
the Azure host for back-end services will be updated to allow the default hosting
domain of front-end services. This can be modified or removed as necessary in the
Infrastructure as Code configuration files.
2. Create a devcontainer.json file inside of the .devcontainer folder with the desired
configurations. The azd starter template provides a sample devcontainer.json
file that you can copy into your project and modify as needed.
Read more about working with dev containers on the Visual Studio Code
documentation.
1. Add a .github folder for GitHub actions or a .ado folder for Azure DevOps to the
root of your project.
2. Add a workflow file into the new folder. The azd starter template provides a
Sample GitHub Actions workflow file and Sample Azure DevOps Pipelines files
for each platform that you can copy into your project and modify as needed.
3. You may also need to update the main.parameters.json file in your infra folder
with the required environment variables for your workflow to run.
Feedback
Was this page helpful? Yes No
In this article, you'll learn how to use the Azure Developer CLI ( azd ) to push template
changes through a CI/CD pipeline such as GitHub Actions or Azure DevOps. For this
example you'll use the React Web App with Node.js API and MongoDB on Azure
template, but you can apply the principles you learn in this article to any of the Azure
Developer CLI templates.
7 Note
The azd pipeline config command is still in beta. Read more about alpha and beta
feature support on the feature versioning and release strategy page.
Prerequisites
Install the Azure Developer CLI.
Deploy the Node.js template.
Visual Studio Code installed.
azd templates may or may not include a default GitHub Actions and/or Azure DevOps
pipeline configuration file called azure-dev.yml , which is required to setup CI/CD. This
configuration file provisions your Azure resources and deploy your code to the main
branch. You can find azure-dev.yml :
You can use the configuration file as-is or modify it to suit your needs.
7 Note
Make sure your template has a pipeline definition ( azure-dev.yaml ) before calling
azd pipeline config . azd does not automatically create this file. See Create a
Use the azd pipeline config command to configure a CI/CD pipeline, which handles
the following tasks:
Creates and configures a service principal for the app on the Azure subscription.
Your user must have either Owner role or Contributor + User Access
Administrator roles within the Azure subscription to allow azd to create and assign
For more granular control over this process, or if you user does not have the required
roles, you can manually configure a pipeline .
GitHub Actions
1. Run the following command to create the Azure service principal and
configure the pipeline:
This command, optionally creates a GitHub repository and pushes code to the
new repo.
7 Note
3. When prompted about committing and pushing your local changes to start a
new GitHub Actions run, specify y .
4. In the terminal window, view the results of the azd pipeline config
command. The azd pipeline config command will output the GitHub
repository name for your project.
5. Using your browser, open the GitHub repository for your project.
5. Commit your change. Committing the change starts the GitHub Action
pipeline to deploy the update.
6. Using your browser, open your project's GitHub repository to see both:
Your commit
The commit from GitHub Actions being set up.
Add azd as a GitHub action . This action will install azd . To use it, you can add the
following to .github\workflows\azure-dev.yml :
yml
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install azd
uses: Azure/setup-azd@v0.1.0
Clean up resources
When you no longer need the Azure resources created in this article, run the following
command:
azd down
Advanced features
You can extend the azd pipeline config command for specific template scenarios or
requirements, as described in the following sections.
pipeline variables whenever it executes. The pipeline definition then references those
variables:
YAML
env:
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
When the pipeline runs, azd gets the values from the environment, which is mapped to
the variables and secrets. Depending on the template, there might be settings which
you can control using environment variables. For example, an environment variable
named KEY_VAULT_NAME could be set to define the name of a Key Vault resource within
the template infrastructure. For such cases, the list of variables and secrets can be
defined by the template, using the azure.yaml . For example, consider the following
azure.yaml configuration:
YAML
pipeline:
variables:
- KEY_VAULT_NAME
- STORAGE_NAME
secrets:
- CONNECTION_STRING
With this configuration, azd checks if any of the variables or secrets have a non-empty
value in the environment. azd then creates either a variable or a secret for the pipeline
using the name of the key in the configuration as the name of the variable or secret, and
the non-string value from the environment for the value.
The azure-dev.yaml pipeline definition can then reference the variables or secrets:
YAML
7 Note
You must run azd pipeline config after updating the list of secrets or variables in
azure.yaml for azd to reset the pipeline values.
Infrastructure parameters
Consider the following bicep example:
Bicep
@secure()
param BlobStorageConnection string
The parameter BlobStorageConnection has no default value set, so azd prompts the user
to enter a value. However, there is no interactive prompt during CI/CD. azd must
request the value for the parameter when you run azd pipeline config , save the value
in the pipeline, and then fetch the value again when the pipeline runs.
and set the value of all the required parameters in the pipeline. You only need to
reference this secret in your pipeline:
YAML
When the pipeline runs, azd takes the values for the parameters from the secret,
removing the need for an interactive prompt.
7 Note
You must re-run azd pipeline config if you add a new parameter.
trigger
permissions
operating system or pool
steps to be run
The following examples demonstrate how to create a definition file and related
configurations for GitHub Actions and Azure Pipelines.
GitHub Actions
You can use the following template as a starting point for your own pipeline
definition:
YAML
on:
workflow_dispatch:
push:
# Run when commits are pushed to mainline branch (main or master)
# Set this to the mainline branch you are using
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
# azd build-in variables.
# This variables are always set by `azd pipeline config`
# You can set them as global env (apply to all steps) or you can add
them to individual steps' environment
env:
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
## Define the additional variables or secrets that are required
globally (provision and deploy)
# ADDITIONAL_VARIABLE_PLACEHOLDER: ${{
variables.ADDITIONAL_VARIABLE_PLACEHOLDER }}
# ADDITIONAL_SECRET_PLACEHOLDER: ${{
secrets.ADDITIONAL_SECRET_PLACEHOLDER }}
steps:
- name: Checkout
uses: actions/checkout@v4
Feedback
Was this page helpful? Yes No
In this article, you learn how to use Azure Developer CLI ( azd ) to monitor your app
health.
While we use the React Web App with Node.js API and MongoDB on Azure template
for this guide, you can use any of the Azure Developer CLI templates.
7 Note
The azd monitor command is still in beta. Read more about alpha and beta feature
support on the feature versioning and release strategy page.
Prerequisites
Install the Azure Developer CLI
Run azd init and azd up for the Node.js template
ノ Expand table
Clean up resources
When you no longer need the resources created in this article, run the azd down
command to delete the resource group:
azd down
See also
Azure Monitor documentation
Request help
For information on how to file a bug, request help, or propose a new feature for the
Azure Developer CLI, please visit the troubleshooting and support page.
Next steps
Make your project Azure Developer CLI (azd) compatible
Feedback
Was this page helpful? Yes No
Azure Developer CLI ( azd ) supports deployments at both the subscription and resource
group scopes. By default, azd creates a resource group that contains the provisioned
resources in the subscription you choose during the azd up workflow. However, azd
also allows you to deploy to an existing resource group. When you choose an existing
resource group, the scope of permissions needed to run azd provision is reduced from
subscription level to the resource group level.
In this article, you learn how to modify templates to enable resource group scoped
deployments.
7 Note
Resource Group Scoped Deployment is currently a beta feature. Learn more about
our versioning strategy.
Bicep
targetScope = 'resourceGroup'
3. Use resource group instead of subscription when you create a unique resource
token in main.bicep , .
Bicep
4. Remove the following section of code in main.bicep that organizes resources into
a resource group.
Bicep
// Organize resources in a resource group
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: !empty(resourceGroupName) ? resourceGroupName :
'${abbrs.resourcesResourceGroups}${environmentName}'
location: location
tags: tags
}
yml
AZURE_RESOURCE_GROUP: $(AZURE_RESOURCE_GROUP)
7 Note
For an example of these changes applied to the React Web App with Node.js API
and MongoDB on Azure template , see this GitHub comparison .
To set the resource group to deploy to manually, you can set AZURE_RESOURCE_GROUP in
your environment. Learn more about that here.
Alternatively, if you do not have a resource group specified in your environment, azd
prompts you to pick an existing resource group from your subscription or create a new
one when you run azd provision .
Next steps
Azure Developer CLI FAQ
Feedback
Was this page helpful? Yes No
Azure Developer CLI ( azd ) supports external third-party container registries for
deployment. To use this feature, you need to manually authenticate to the external
container registry before calling azd deploy.
Authentication
Run docker login and authenticate to your external container registry. You may need to
follow additional setup or configuration steps for your specific registry provider.
Example scenarios
You can configure azd to push and pull images from an external container registry in
the azure.yaml file of your template. Support for additional container registries provides
greater flexibility for your deployment workflows.
yml
name: todo-nodejs-mongo-aca
metadata:
template: todo-nodejs-mongo-aca@0.0.1-beta
services:
nginx:
image: docker.io/<username>/nginx:latest
host: containerapp
7 Note
Your containerapp infra configuration must configure credentials when pulling
containers from private container registries.
yml
# azure.yaml
name: todo-nodejs-mongo-aca
metadata:
template: todo-nodejs-mongo-aca@0.0.1-beta
services:
nginx:
image: nginx
host: containerapp
docker:
registry: docker.io/<username>
image: nginx
tag: latest
During a call to azd deploy the nginx image will be pulled from the configured image. In
this case it is a public image on docker hub. The container/image will be retagged and
pushed to the docker registry.
yml
# azure.yaml
name: todo-nodejs-mongo-aca
metadata:
template: todo-nodejs-mongo-aca@0.0.1-beta
services:
api:
project: ./src/api
host: containerapp
docker:
registry: docker.io/<username>
image: todo-api
During azd deploy the container source will be built, tagged and push to the docker
registry.
Feedback
Was this page helpful? Yes No
The Azure Developer CLI ( azd ) supports Azure deployment stacks for template
deployments. An Azure deployment stack is a resource that enables you to manage a
group of Azure resources as a single, cohesive unit. By using deployment stacks, you can
gain additional control over the set of resources associated with your azd template and
app.
Bash
7 Note
Azure deployment stacks support is currently an alpha feature, which is why it must
be enabled manually. However, deployment stacks will become the default
deployment behavior of azd in a future release. Learn more about our versioning
strategy.
Verify the feature was enabled successfully using the azd config show command:
Bash
Bash
azd up
azd uses the scope defined in the main.bicep file of your template for the Azure
Select the deployment stack to view the management pages for it:
Delete a deployment stack
By default, you can delete a deployment stack and its associated resources using the
standard azd down command:
Bash
azd down
The exact behavior of azd down and deployment stacks is configured using the
azure.yaml file.
file to influence the behavior of the Azure deployment stack. These settings map to the
standard options detailed in Deployment stacks documentation. Consider the following
azure.yaml example:
yml
name: todo-nodejs-mongo-aca
metadata:
template: todo-nodejs-mongo-aca@0.0.1-beta
infra:
provider: bicep
deploymentStacks:
actionOnUnmanage:
resources: delete
resourceGroups: delete
denySettings:
mode: denyDelete
excludedActions:
- Microsoft.Resources/subscriptions/resourceGroups/delete
excludedResources:
- <your-resource-id-1>
- <your-resource-id-2>
excludedPrincipals:
- <your-targeted-principal-id-1>
- <your-targeted-principal-id-2>
applyToChildScopes: true
# ...
# Remaining file contents omitted
# ...
In the preceding example, the following options are defined in the deploymentStacks
section:
deployment stack.
detach leaves resources in place but removes their association to the deleted
deployment stack.
denySettings: A subsection that provides nuanced control over the resources of
the deployment stack.
mode: Determines high level restrictions on the deployment stack resources.
Possible values include:
none is the default value and allows the deployment stack resources to be
deleted and also prevents new resources from being added to the
deployment stack.
excludedActions: Lists the Azure role-based access control (RBAC) actions that
are not allowed on the deployment stack resources.
excludedResources: Lists the resource IDs that are excluded from the
denySettings .
excludedPrincipals: Lists the service principal IDs that are excluded from the
denySettings .
applyToChildScopes: A boolean value that sets whether the deny settings apply
to child resources of resources in the deployment stack. For example, a SQL
Server resource has child database resources.
Feedback
Was this page helpful? Yes No
The Azure Developer CLI enables you to quickly and easily deploy to an Azure ML
Studio or Azure AI Foundry online endpoint. azd supports the following Azure AI
Foundry/ML studio features, which you'll learn to configure in the sections ahead:
Custom environments
Environments can be viewed with Azure ML Studio under the Environments
section.
Custom models
Models can be viewed with Azure ML Studio under the models section.
Prompt flows
Flows can be viewed with Azure ML Studio under the flows section.
Flows can be viewed with Azure AI Foundry portal under the flows section.
Online deployments (within Online-Endpoint)
Deployments can be viewed with Azure ML Studio under the deployments
section.
Deployments can be viewed with Azure AI Foundry portal under the
deployments section.
Prerequisites
To work with Azure AI Foundry/ML studio online endpoints, you'll need the following:
The Azure AI Foundry Starter template can help create all the required infrastructure
to get started with Azure AI Foundry endpoints.
Configure the Azure AI Foundry/ML studio
online endpoint
Configure support for AI/ML online endpoints in the services section of the azure.yaml
file:
Consider the following sample azure.yaml file that configures these features:
YAML
name: contoso-chat
metadata:
template: contoso-chat@0.0.1-beta
services:
chat:
# Referenced new ai.endpoint host type
host: ai.endpoint
# New config flow for AI project configuration
config:
# The name of the Azure AI Foundry workspace
workspace: ${AZUREAI_PROJECT_NAME}
# Optional: Path to custom ML environment manifest
environment:
path: deployment/docker/environment.yml
# Optional: Path to your prompt flow folder that contains the flow
manifest
flow:
path: ./contoso-chat
# Optional: Path to custom model manifest
model:
path: deployment/chat-model.yaml
overrides:
"properties.azureml.promptflow.source_flow_id":
${AZUREAI_FLOW_NAME}
# Required: Path to deployment manifest
deployment:
path: deployment/chat-deployment.yaml
environment:
PRT_CONFIG_OVERRIDE:
deployment.subscription_id=${AZURE_SUBSCRIPTION_ID},deployment.resource_grou
p=${AZURE_RESOURCE_GROUP},deployment.workspace_name=${AZUREAI_PROJECT_NAME},
deployment.endpoint_name=${AZUREAI_ENDPOINT_NAME},deployment.deployment_name
=${AZUREAI_DEPLOYMENT_NAME}
The config.deployment section is required and creates a new online deployment to the
associated online endpoint from the referenced yaml file definition. This functionality
handles various concerns for you, including the following:
Flow
The flow configuration section is optional and supports the following values:
path: The relative path to a folder that contains the flow manifest.
7 Note
7 Note
Model
The model configuration section is optional and supports following values:
7 Note
Deployment
The deployment configuration section is required and supports the following values:
environment: A map of key value pairs to set environment variables for the
deployment. Supports environment variable substitutions from OS/AZD
environment variables using ${VAR_NAME} syntax.
overrides: Any custom overrides to apply to the deployment.
7 Note
Feedback
Was this page helpful? Yes No
The Azure Developer CLI ( azd ) allows you to add ignore files in your templates that
specify files and directories to exclude from the deployment package for App Service
and Function Apps. This features provides granular control at the service level over
which files are included in the packaging process.
deployments.
.funcignore influences packaging exclusions for Azure Functions deployments.
These ignore files are applied based on the targeted deployment service, ensuring users
can independently customize file exclusions when packaging for Azure App Service and
Azure Functions. Both types of packaging ignore files follow these rules:
Exclusion examples
In your azd template, add a .webappignore or .funcignore file to the root folder of the
service you intend to deploy to Azure App Service or Azure Functions. Update the
content of those ignore files to include or exclude files using the following patterns:
Node.js
text
logs/*
testfile.js
Exclude folders or files that are ignored by default when the .webappignore or
.funcignore file is not present:
text
node_modules/
Feedback
Was this page helpful? Yes No
The Azure Developer CLI provides support for Helm and Kustomize to improve the
provisioning and deployment process to Azure Kubernetes Service (AKS). Helm and
Kustomize are tools that help you configure and manage Kubernetes applications. In the
sections ahead, you'll learn how to enable and customize support for these tools in your
azd templates.
Azure CLI
yml
name: todo-nodejs-mongo-aks
metadata:
template: todo-nodejs-mongo-aks@0.0.1-beta
services:
argocd:
host: aks
k8s:
namespace: argo
service:
name: argocd-server
helm:
repositories:
- name: argo
url: https://argoproj.github.io/argo-helm
releases:
- name: argocd
chart: argo/argo-cd
verson: 5.51.4
jupyterhub:
host: aks
k8s:
namespace: jupyterhub
service:
name: proxy-public
helm:
repositories:
- name: jupyterhub
url: https://hub.jupyter.org/helm-chart/
releases:
- name: jupyterhub
chart: jupyterhub/jupyterhub
version: 3.1.0
The azd deploy command handles the following tasks using the helm section:
Azure CLI
dir : Relative path from the service to your Kustomize directory that contains a
kustomization.yaml file.
Use cases
The following Kustomize use cases are supported by azd .
yml
# azure.yaml
name: todo-nodejs-mongo-aks
metadata:
template: todo-nodejs-mongo-aks@0.0.1-beta
services:
api:
project: ./src/api
language: js
host: aks
k8s:
kustomize:
dir: ./kustomize/base
yml
# azure.yaml
name: todo-nodejs-mongo-aks
metadata:
template: todo-nodejs-mongo-aks@0.0.1-beta
services:
api:
project: ./src/api
language: js
host: aks
k8s:
kustomize:
dir: ./kustomize/overlays/${AZURE_ENV_NAME}
The following example specifies an edits configuration and sets any valid kustomize
edit ... command. azd automatically interpolates any environment variables
yml
# azure.yaml
name: todo-nodejs-mongo-aks
metadata:
template: todo-nodejs-mongo-aks@0.0.1-beta
services:
api:
project: ./src/api
language: js
host: aks
k8s:
kustomize:
dir: ./kustomize/overlays/${AZURE_ENV_NAME}
edits:
- set image todo-api=${SERVICE_API_IMAGE_NAME}
The kustomize configuration section supports a env section where one or many
key/value pairs can be defined. This configuration automatically generates a temporary
.env file within your kustomization directory that can be used by a configMapGenerator .
The following configuration will create a .env with the specified key/value pairs.
yml
# azure.yaml
name: todo-nodejs-mongo-aks
metadata:
template: todo-nodejs-mongo-aks@0.0.1-beta
services:
api:
project: ./src/api
language: js
host: aks
k8s:
kustomize:
dir: ./kustomize/overlays/${AZURE_ENV_NAME}
edits:
- set image todo-api=${SERVICE_API_IMAGE_NAME}
env:
AZURE_AKS_IDENTITY_CLIENT_ID: ${AZURE_AKS_IDENTITY_CLIENT_ID}
AZURE_KEY_VAULT_ENDPOINT: ${AZURE_KEY_VAULT_ENDPOINT}
APPLICATIONINSIGHTS_CONNECTION_STRING:
${APPLICATIONINSIGHTS_CONNECTION_STRING}
The configMapGenerator generates a k8s config map with the specified name and
contains all the key/value pairs referenced within the .env file.
yml
# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
- ingress.yaml
configMapGenerator:
- name: todo-web-config
envs:
- .env
Feedback
Was this page helpful? Yes No
You can configure remote state within the state.remote element of azd configuration
backend: The name of the backend type used for remote state
config: Map of key/value pairs unique to each remote state provider
Enable by project
azure.yaml
YAML
name: azd-project-name
state:
remote:
backend: AzureBlobStorage
config:
accountName: saazdremotestate
containerName: myproject # Defaults to project name if not specified
Enable globally
azd config.json
JSON
{
"state": {
"remote": {
"backend": "AzureBlobStorage",
"config": {
"accountName": "saazdremotestate"
}
}
}
}
Configuration
accountName: Name of the Azure storage account
containerName: Name of the container within the storage account where
configuration is stored. Defaults to the current azd project name if not specified
endpoint: Azure Endpoint used when configuring remote state. Defaults to
core.windows.net
When selecting an environment that does not exist locally, the remote state is copied to
a new local environment.
For example, consider the output from azd env list above. To copy the remote state,
dev to your local environment you would run the following:
Feedback
Was this page helpful? Yes No
The Azure Developer CLI (azd) provides support for Azure Deployment Environments.
An Azure Deployment Environment (ADE) is a preconfigured collection of Azure
resources deployed in predefined subscriptions. Azure governance is applied to those
subscriptions based on the type of environment, such as sandbox, testing, staging, or
production. With Azure Deployment Environments, your can enforce enterprise security
policies and provide a curated set of predefined infrastructure as code (IaC) templates.
Prerequisites
Verify you have completed the following prerequisites to work with Azure Deployment
Environments using azd :
Configured environment types at the dev center level and project level
Ensure the developer has Deployment Environments User role on the project
Tip
Bash
azd config set platform.type devcenter
When platform.type is set to devcenter , all azd remote environment state and
provisioning will leverage new dev center components. This configuration also means
that the infra folder in your local templates will effectively be ignored. Instead, azd will
use one of the infrastructure templates defined in your dev center catalog for resource
provisioning.
You can also disable dev center support via the following command:
Bash
azd init
The azd init command experience in dev center mode shows all the azd compatible
ADE templates for selection from your configured catalog. During the init process, after
azd clones down the template code, the azure.yaml file will automatically be updated
to include a platform section with the selected configuration based on the template
that was chosen. The configuration includes the dev center name, catalog, and
environment definition.
Bash
`azd init`
azd up
The azd up command will package, provision, and deploy your application to Azure
Deployment Environments. However, the provision stage of the azd up command will
use the curated infrastructure-as-code templates in your remote dev center, while the
deployment stage will deploy the source code in your azd template. While dev center
mode is enabled, azd will ignore the infra folder in your local azd template and only
provision resources using the dev center templates. The command will also prompt you
for any necessary values, such as the Azure Deployment Environment project or
environment type.
Bash
azd up
Bash
azd provision
The azd provision command will create new dev center environments. The command
will prompt you for any missing values, such as the environment type or project. When
the command runs, it will use the associated infrastructure template to provision the
correct set of Azure resources for that environment. While dev center mode is enabled,
azd will ignore the infra folder in your local azd template and only provision resources
Bash
azd provision
Bash
the dev center catalog. Templates in the catalog may or may not assign tags to
provisioned Azure resources for you to associate your app services with in the
azure.yaml file. If the templates do not assign tags, you can address this issue in one of
two ways:
Work with your dev center catalog administrator to ensure the provisioned Azure
resources include tags to associate them with services defined in your azure.yaml
file.
yml
services:
api:
project: ./src/api
host: containerapp
language: js
resourceName: sample-api-containerapp
web:
project: ./src/web
host: containerapp
language: js
resourceName: sample-web-containerapp
1. Environment variables
2. Azd environment configuration
3. Project configuration
4. User configuration
azd will automatically prompt you for any configuration values that are missing from
these sources. Each of these configuration options is detailed in the following sections.
Environment variables
The following environment variables will be discovered and used by azd :
AZURE_DEVCENTER_NAME
AZURE_DEVCENTER_PROJECT
AZURE_DEVCENTER_CATALOG
AZURE_DEVCENTER_ENVIRONMENT_DEFINITION
AZURE_DEVCENTER_ENVIRONMENT_TYPE
AZURE_DEVCENTER_ENVIRONMENT_USER
Define configurations
Define configurations for your dev centers at the azd environment scope in
.azure/<env>/config.json file:
JSON
{
"platform": {
"config": {
"catalog": "SampleCatalog",
"environmentDefinition": "Todo",
"environmentType": "Dev",
"name": "sample-devcenter",
"Project": "SampleProject"
}
}
}
Project scope
Define configurations for your dev centers at the azd project scope in the platform
node of the azure.yaml file:
YAML
name: todo-nodejs-mongo-aca
metadata:
template: todo-nodejs-mongo-aca@0.0.1-beta
platform:
type: devcenter
config:
catalog: SampleCatalog
environmentDefinition: Todo
name: sample-devcenter
project: SampleProject
services:
api:
project: ./src/api
host: containerapp
language: js
web:
project: ./src/web
host: containerapp
language: js
User scope
Define configurations for your dev centers at the user scope in the
~/<user_profile>/.azd/config.json file:
JSON
{
"platform": {
"config": {
"catalog": "SampleCatalog",
"environmentDefinition": "Todo",
"environmentType": "Dev",
"name": "sample-devcenter",
"Project": "SampleProject"
}
}
}
Feedback
Was this page helpful? Yes No
Environment variables influence how resources are provisioned and deployed to Azure.
This is especially useful when running azd in CI/CD workflow scenarios.
Bash
export AZURE_LOCATION=westus3
PowerShell
$env:AZURE_LOCATION='westus3'
In the main.parameters.json file, you can reference AZURE_LOCATION and allow for
environment substitution using the following syntax:
JSON
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-
01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"value": "${AZURE_LOCATION}"
}
}
}
ノ Expand table
container app
services.
ノ Expand table
feature is useful for scenarios where you want to demo or present azd commands in a
public setting.
The demo mode introduces the environment variable: AZD_DEMO_MODE . To enable demo
mode, run:
Bash
If you want demo mode to persist across reboots, you can also run:
Bash
or in PowerShell:
Bash
$env:AZD_DEMO_MODE="true"
Feedback
Was this page helpful? Yes No
Get help at Microsoft Q&A
Environment variables FAQ
Article • 09/13/2024
This article answers frequently asked questions about working with environment
variables and the Azure Developer CLI ( azd ).
directory of your project and are separate from your system/OS environment variables.
azd environment variables configure template provisioning and deployment tasks and
are accessible using commands such as azd env or azd env get-values.
System environment variables are not directly accessible through azd commands and
should be managed with custom shell or PowerShell scripts, generally using azd hooks.
Can azd commands directly read and write system
environment variables?
No, azd commands cannot read or write system environment variables. Commands
such as azd env set or azd env get-values operate on values stored in the template .env
file for a specific azd environment. azd environments are managed using subfolders in
the .azure/<environment name> directory of your project template, which enables your
template to have multiple environments. Environment subfolders hold configuration
files such as .env that describe the environment.
Use custom shell or PowerShell scripts with azd hooks to read or write system level
environment variables.
JSON
After a successful azd up or azd provision , azd writes these two variables to the .env
file in the .azure/<environment name> directory of your project:
Output
API_BASE_URL="<example-api-url>"
output REACT_APP_WEB_BASE_URL="<example-app-url>"
You can then access those variables from the .env file using azd env get-values.
Tip
Use caution when setting system environment variables, as they can cause conflicts
with other templates that share the same environment variable names.
7 Note
Use caution when copying azd environment variables to your local system or other
operating environments. System environment variables with matching names can
be picked up by azd and cause conflicts between different azd templates or
different azd environments.
yml
postprovision:
windows:
shell: pwsh
run: ./scripts/map-env-vars.ps1
interactive: false
continueOnError: false
posix:
shell: sh
run: ./scripts/map-env-vars.sh
interactive: false
continueOnError: false
The referenced shell script for Linux retrieves the azd environment variables and exports
them as system environment variables:
Bash
The referenced PowerShell script for Windows retrieves the azd environment variables
and exports them as system environment variables:
PowerShell
Next steps
Manage environment variables
Feedback
Was this page helpful? Yes No
Azure Developer CLI ( azd ) supports multiple infrastructures as code (IaC) providers,
including:
Bicep
Terraform
By default, azd assumes Bicep as the IaC provider. Refer to the Comparing Terraform
and Bicep article for help deciding which IaC provider is best for your project.
7 Note
Terraform is still in beta. Read more about alpha and beta feature support on the
feature versioning and release strategy page
Pre-requisites
Install and configure Terraform
Install and log into Azure CLI (v 2.38.0+)
Review the architecture diagram and the Azure resources you'll deploy in the
Node.js or Python Terraform template.
7 Note
While azd doesn't rely on an Azure CLI login, Terraform requires Azure CLI. Read
more about this requirement from Terraform's official documentation .
YAML
infra:
provider: terraform
2. Add all your .tf files to the infra directory found in the root of your project.
3. Run azd up .
7 Note
Check out these two azd templates with Terraform as IaC Provider: Node.js and
Terraform and Python and Terraform .
By default, azd assumes the use of local state file. If you ran azd up before enabling
remote state, you need to run azd down and switch to remote state file.
To allow shared access to the state data, and allow multiple people work together
on that collection of infrastructure resources
To avoid exposing sensitive information included in state file
To decrease the chance of inadvertent deletion because of storing state locally
JSON
{
"storage_account_name": "${RS_STORAGE_ACCOUNT}",
"container_name": "${RS_CONTAINER_NAME}",
"key": "azd/azdremotetest.tfstate",
"resource_group_name": "${RS_RESOURCE_GROUP}"
}
3. Update provider.tf found in the infra folder to set the backend to be remote
Console
4. Run azd env set <key> <value> to add configuration in the .env file. For example:
5. Run the next azd command as per your usual workflow. When remote state is
detected, azd initializes Terraform with the configured backend configuration.
6. To share the environment with teammates, make sure they run azd env refresh -e
<environmentName> to refresh environment settings in the local system, and
See also
Learn more about Terraform's dependency on Azure CLI .
For more on remote state, see store Terraform state in Azure Storage.
Template: React Web App with Node.js API and MongoDB (Terraform) on Azure
Next steps
Azure Developer CLI FAQ
Feedback
Was this page helpful? Yes No
The Azure Developer CLI ( azd ) has been extended to support deploying .NET Aspire
projects. Use this guide to walk through the process of creating and deploying a .NET
Aspire project to Azure Container Apps using the Azure Developer CLI. In this tutorial,
you'll learn the following concepts:
Prerequisites
To work with .NET Aspire, you need the following installed locally:
For more information, see .NET Aspire setup and tooling, and .NET Aspire SDK.
You will also need to have the Azure Developer CLI installed locally. Common install
options include the following:
Windows
PowerShell
1. When azd targets a .NET Aspire project it starts the AppHost with a special
command ( dotnet run --project AppHost.csproj --output-path manifest.json --
publisher manifest ), which produces the Aspire manifest file.
7 Note
azd also enables you to output the generated Bicep to an infra folder in your
project, which you can read more about in the Generating Bicep from .NET Aspire
app model section.
.NET CLI
The previous commands create a new .NET Aspire project based on the aspire-starter
template which includes a dependency on Redis cache. It runs the .NET Aspire project
which verifies that everything is working correctly.
2. Execute the azd init command to initialize your project with azd , which will
inspect the local directory structure and determine the type of app.
azd init
For more information on the azd init command, see azd init.
3. Select Use code in the current directory when azd prompts you with two app
initialization options.
Output
? How do you want to initialize your app? [Use arrows to move, type to
filter]
> Use code in the current directory
Select a template
4. After scanning the directory, azd prompts you to confirm that it found the correct
.NET Aspire AppHost project. Select the Confirm and continue initializing my app
option.
Output
Detected services:
.NET (Aspire)
Detected in:
D:\source\repos\AspireSample\AspireSample.AppHost\AspireSample.AppHost.
csproj
azd will generate the files necessary to host your app on Azure using
Azure Container Apps.
Output
azd generates a number of files and places them into the working directory. These files
are:
azure.yaml: Describes the services of the app, such as .NET Aspire AppHost project,
and maps them to Azure resources.
.azure/config.json: Configuration file that informs azd what the current active
environment is.
.azure/aspireazddev/.env: Contains environment specific overrides.
yml
# yaml-language-server:
$schema=https://raw.githubusercontent.com/Azure/azure-
dev/main/schemas/v1.0/azure.yaml.json
name: AspireSample
services:
app:
language: dotnet
project: .\AspireSample.AppHost\AspireSample.AppHost.csproj
host: containerapp
Resource naming
When you create new Azure resources, it's important to follow the naming
requirements. For Azure Container Apps, the name must be 2-32 characters long and
consist of lowercase letters, numbers, and hyphens. The name must start with a letter
and end with an alphanumeric character.
For more information, see Naming rules and restrictions for Azure resources.
Initial deployment
1. In order to deploy the .NET Aspire project, authenticate to Azure AD to call the
Azure resource management APIs.
2. Once authenticated, run the following command from the AppHost project
directory to provision and deploy the application.
) Important
To push container images to the Azure Container Registry (ACR), you need to
have Microsoft.Authorization/roleAssignments/write access. This can be
achieved by enabling an Admin user on the registry. Open the Azure Portal,
navigate to the ACR resource / Settings / Access keys, and then select the
Admin user checkbox. For more information, see Enable admin user.
3. When prompted, select the subscription and location the resources should be
deployed to. Once these options are selected the .NET Aspire project will be
deployed.
Output
The final line of output from the azd command is a link to the Azure Portal that
shows all of the Azure resources that were deployed:
webfrontend : Contains code from the web project in the starter template.
apiservice : Contains code from the API service project in the starter template.
Just like in local development, the configuration of connection strings has been handled
automatically. In this case, azd was responsible for interpreting the application model
and translating it to the appropriate deployment steps. As an example, consider the
connection string and service discovery variables that are injected into the webfrontend
container so that it knows how to connect to the Redis cache and apiservice .
For more information on how .NET Aspire projects handle connection strings and service
discovery, see .NET Aspire orchestration overview.
To speed up deployment of code changes, azd supports deploying code updates in the
container image. This is done using the azd deploy command:
azd deploy
Output
Deploying services (azd deploy)
It's not necessary to deploy all services each time. azd understands the .NET Aspire
project model, it's possible to deploy just one of the services specified using the
following command:
For more information, see Azure Developer CLI reference: azd deploy.
To see this in action, update the Program.cs file in the AppHost project to the following:
C#
builder.AddProject<Projects.AspireSample_Web>("webfrontend")
.WithReference(cache)
.WithReference(apiservice);
builder.Build().Run();
azd provision
The azd provision command updates the infrastructure by creating a container app to
host the Postgres database. The azd provision command didn't update the connection
strings for the apiservice container. In order to have connection strings updated to
point to the newly provisioned Postgres database the azd deploy command needs to be
invoked again. When in doubt, use azd up to both provision and deploy.
Clean up resources
Remember to clean up the Azure resources that you've created during this walkthrough.
Because `azd knows the resource group in which it created the resources it can be used
to spin down the environment using the following command:
azd down
The previous command may take some time to execute, but when completed the
resource group and all its resources should be deleted.
Output
? Total resources to delete: 7, are you sure you want to continue? Yes
Deleting your resources can take some time.
azd includes the ability to output the Bicep it uses for provisioning via following
command:
After this command is executed in the starter template example used in this guide, the
following files are created in the AppHost project directory:
The infra\resources.bicep file doesn't contain any definition of the container apps
themselves (with the exception of container apps which are dependencies such as Redis
and Postgres):
Bicep
resource managedIdentity
'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'mi-${resourceToken}'
location: location
tags: tags
}
resource logAnalyticsWorkspace
'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: 'law-${resourceToken}'
location: location
properties: {
sku: {
name: 'PerGB2018'
}
}
tags: tags
}
For more information on using Bicep to automate deployments to Azure see, What is
Bicep?
The definition of the container apps from the .NET service projects is contained within
the containerApp/tmpl.yaml files in the manifests directory in each project respectively.
Here is an example from the webfrontend project:
yml
location: {{ .Env.AZURE_LOCATION }}
identity:
type: UserAssigned
userAssignedIdentities:
? "{{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}"
: {}
properties:
environmentId: {{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_ID }}
configuration:
activeRevisionsMode: single
ingress:
external: true
targetPort: 8080
transport: http
allowInsecure: false
registries:
- server: {{ .Env.AZURE_CONTAINER_REGISTRY_ENDPOINT }}
identity: {{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}
template:
containers:
- image: {{ .Env.SERVICE_WEBFRONTEND_IMAGE_NAME }}
name: webfrontend
env:
- name: AZURE_CLIENT_ID
value: {{ .Env.MANAGED_IDENTITY_CLIENT_ID }}
- name: ConnectionStrings__cache
value: {{ connectionString "cache" }}
- name: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES
value: "true"
- name: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES
value: "true"
- name: services__apiservice__0
value: http://apiservice.internal.{{
.Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
- name: services__apiservice__1
value: https://apiservice.internal.{{
.Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
tags:
azd-service-name: webfrontend
aspire-resource-name: webfrontend
After executing the azd infra synth command, when azd provision and azd deploy
are called they use the Bicep and supporting generated files.
) Important
If azd infra synth is called again, it replaces any modified files with freshly
generated ones and prompts you for confirmation before doing so.
This will prompt the user for subscription and resource group information again and
subsequent azd up , azd provision , and azd deploy invocations will use this new
environment by default. The --environment switch can be applied to these commands
to switch between environments.
Clean up resources
Run the following Azure CLI command to delete the resource group when you no longer
need the Azure resources you created. Deleting the resource group also deletes the
resources contained inside of it.
Azure CLI
The Azure Developer CLI ( azd ) enables you to deploy .NET Aspire projects using GitHub
Actions or Azure Devops pipelines by automatically configuring the required
authentication and environment settings. This article walks you through the process of
creating and deploying a .NET Aspire project on Azure Container Apps using azd . You
learn the following concepts:
Prerequisites
To work with .NET Aspire, you need the following installed locally:
For more information, see .NET Aspire setup and tooling, and .NET Aspire SDK.
You also need to have the Azure Developer CLI installed locally (version 1.5.1 or higher).
Common install options include the following:
Windows
PowerShell
2. Execute the azd init command to initialize your project with azd , which will
inspect the local directory structure and determine the type of app.
azd init
For more information on the azd init command, see azd init.
3. Select Use code in the current directory when azd prompts you with two app
initialization options.
Output
? How do you want to initialize your app? [Use arrows to move, type to
filter]
> Use code in the current directory
Select a template
4. After scanning the directory, azd prompts you to confirm that it found the correct
.NET Aspire AppHost project. Select the Confirm and continue initializing my app
option.
Output
Detected services:
.NET (Aspire)
Detected in:
D:\source\repos\AspireSample\AspireSample.AppHost\AspireSample.AppHost.
csproj
azd will generate the files necessary to host your app on Azure using
Azure Container Apps.
? Select an option [Use arrows to move, type to filter]
> Confirm and continue initializing my app
Cancel and exit
Output
azd generates a number of files and places them into the working directory. These files
are:
azure.yaml: Describes the services of the app, such as .NET Aspire AppHost project,
and maps them to Azure resources.
.azure/config.json: Configuration file that informs azd what the current active
environment is.
.azure/aspireazddev/.env: Contains environment specific overrides.
1. Run the azd pipeline config command to configure your deployment pipeline
and securely connect it to Azure:
2. Select the subscription to provision and deploy the app resources to.
3. Select the Azure location to use for the resources.
4. When prompted whether to create a new Git repository in the directory, enter y
7 Note
Creating a GitHub repository required you being logged into GitHub. There
are a few selections that vary based on your preferences. After logging in, you
will be prompted to create a new repository in the current directory.
5. Select Create a new private GitHub repository to configure the git remote.
6. Enter a name of your choice for the new GitHub repository or press enter to use
the default name. azd creates a new repository in GitHub and configures it with
the necessary secrets required to authenticate to Azure.
7. Enter y to proceed when azd prompts you to commit and push your local
changes to start the configured pipeline.
2. Select the Actions tab to view the repository workflows. You should see the new
workflow either running or already completed. Select the workflow to view the job
steps and details in the logs of the run. For example, you can expand steps such as
Install .NET Aspire Workload or Deploy application to see the details of the
completed action.
3. Select Deploy Application to expand the logs for that step. You should see two
endpoint urls printed out for the apiservice and webfrontend . Select either of
these links to open them in another browser tab and explore the deployed
application.
Congratulations! You successfully deployed a .NET Aspire project using the Azure
Developer CLI and GitHub Actions.
Clean up resources
Run the following Azure CLI command to delete the resource group when you no longer
need the Azure resources you created. Deleting the resource group also deletes the
resources contained inside of it.
Azure CLI
The Azure Developer CLI ( azd ) allows you to manage azd configurations using a set of
azd config commands. These configuration settings include useful defaults such as
your Azure subscription and location, as well as settings used by other azd commands
or features. You can also get and set your own custom values and use them in scripts or
custom functionality.
Tip
The default Azure subscription or location to use when you provision or deploy
resources
Which alpha features are enabled
Which template source locations are configured
Custom values set by the user for scripts or other purposes
By default, the config.json file contains only a few configurations for the default azd
template source locations. As you use various features of the Azure Developer CLI, some
values are populated in config.json automatically. For example, the first time you run
the azd up command, the subscription and location you select for provisioning and
deployment are stored in the defaults section of the file.
JSON
{
"defaults": {
"location": "eastus2",
"subscription": "your-subscription-id"
},
"template": {
"sources": {
"awesome-azd": {
"key": "awesome-azd",
"location": "https://aka.ms/awesome-azd/templates.json",
"name": "Awesome AZD",
"type": "awesome-azd"
},
"default": {
"key": "default",
"name": "default"
}
}
}
}
azd config list-alpha : Display the list of available features in alpha stage.
These commands are explored more in the following sections. You can also visit the
Azure Developer CLI commands reference page to learn more about azd commands.
Display configurations
View the current contents of the entire config.json file at any time by running the azd
config show command:
Sample output:
JSON
{
"defaults": {
"location": "eastus2",
"subscription": "your-subscription-id"
},
"template": {
"sources": {
"awesome-azd": {
"key": "awesome-azd",
"location": "https://aka.ms/awesome-azd/templates.json",
"name": "Awesome AZD",
"type": "awesome-azd"
},
"default": {
"key": "default",
"name": "default"
}
}
}
}
Display a specific configuration value using the azd config get <key> command:
Sample output:
JSON
"defaults": {
"location": "eastus2",
"subscription": "your-subscription-id"
}
Enabling or disabling alpha features is a common configuration task, so azd also
includes a convenience command to view the current status of alpha features:
Sample output:
Output
Name: aca.persistDomains
Description: Do not change custom domains when deploying Azure Container
Apps.
Status: Off
Name: aca.persistIngressSessionAffinity
Description: Do not change Ingress Session Affinity when deploying Azure
Container Apps.
Status: Off
Name: aks.helm
Description: Enable Helm support for AKS deployments.
Status: On
Name: aks.kustomize
Description: Enable Kustomize support for AKS deployments.
Status: Off
Name: azd.operations
Description: Extends provisioning providers with azd operations.
Status: Off
Name: compose
Description: Enable simplified app-centric modeling. Run `azd add` to add
Azure components to your project.
Status: On
Name: deployment.stacks
Description: Enables Azure deployment stacks for ARM/Bicep based
deployments.
Status: Off
Name: infraSynth
Description: Enable the `infra synth` command to write generated
infrastructure to disk.
Status: Off
Use the azd config set <key> <value> command to add a configuration setting to the
config.json file.
7 Note
Use . syntax to traverse JSON object structures when you get and set
configuration values, such as in the case of alpha.compose .
Verify the setting was enabled using the azd config get <key> command, such as the
following:
Sample output:
JSON
"on"
In this scenario, you can also run azd config get alpha to view the entire JSON object
in the config.json file:
JSON
{
"compose": "on"
}
Sample output:
JSON
hello-world
Reset configurations
You can reset the Azure Developer CLI config.json file back to its defaults using the azd
config reset command, which deletes the contents of the file:
When you run azd config show after a reset, you will simply see an empty object:
JSON
{}
Next steps
Create Azure Developer CLI templates overview
Feedback
Was this page helpful? Yes No
The Azure Developer CLI supports various extension points to customize your workflows
and deployments. The hooks middleware allows you to execute custom scripts before
and after azd commands and service lifecycle events. hooks follow a naming convention
using pre and post prefixes on the matching azd command or service event name.
For example, you may want to run a custom script in the following scenarios:
Available hooks
The following azd command hooks are available:
prerestore and postrestore : Run before and after package dependencies are
restored.
preprovision and postprovision : Run before and after Azure resources are
created.
predeploy and postdeploy : Run before and after the application code is deployed
to Azure.
preup and postup : Run before and after the combined deployment pipeline. Up is
prerestore and postrestore : Run before and after the service packages and
container is built.
prepackage and postpackage : Run before and after the app is packaged for
deployment.
predeploy and postdeploy : Run before and after the service code is deployed to
Azure.
Hook configuration
Hooks can be registered in your azure.yaml file at the root or within a specific service
configuration. All types of hooks support the following configuration options:
continueOnError : When set will continue to execute even after a script error
occurred during a command hook (default false).
interactive : When set will bind the running script to the console stdin , stdout &
stderr (default false).
windows : Specifies that the nested configurations will only apply on windows OS. If
OSes (Linux & MaxOS). If this configuration option is excluded, the hook executes
on all platforms.
Hook examples
The following examples demonstrate different types of hook registrations and
configurations.
The project directory (where the azure.yaml file is located) is the default current
working directory ( cwd ) for command hooks.
yml
name: todo-nodejs-mongo
metadata:
template: todo-nodejs-mongo@0.0.1-beta
hooks:
prerestore: # Example of an inline script. (shell is required for inline
scripts)
shell: sh
run: echo 'Hello'
preprovision: # Example of external script (Relative path from project
root)
run: ./hooks/preprovision.sh
services:
web:
project: ./src/web
dist: build
language: js
host: appservice
api:
project: ./src/api
language: js
host: appservice
Service registration
Hooks can also be configured to run only for specific services defined in your .yaml file.
The service directory (same path as defined in the project property of the service
configuration in the azure.yaml file) is the default cwd for service hooks.
yml
name: todo-nodejs-mongo
metadata:
template: todo-nodejs-mongo@0.0.1-beta
services:
web:
project: ./src/web
dist: build
language: js
host: appservice
api:
project: ./src/api
language: js
host: appservice
hooks:
prerestore: # Example of an inline script. (shell is required for
inline scripts)
shell: sh
run: echo 'Restoring API service...'
prepackage: # Example of external script (Relative path from service
path)
run: ./hooks/prepackage.sh
OS specific hooks
Optionally, hooks can also be configured to run either on Windows or Posix (Linux &
MaxOS). By default, if the Windows or Posix configurations are excluded the hook
executes on all platforms.
yml
name: todo-nodejs-mongo
metadata:
template: todo-nodejs-mongo@0.0.1-beta
hooks:
prerestore:
posix: # Only runs on Posix environments
shell: sh
run: echo 'Hello'
windows: # Only runs on Windows environments
shell: pwsh
run: Write-Host "Hello"
services:
web:
project: ./src/web
dist: build
language: js
host: appservice
api:
project: ./src/api
language: js
host: appservice
yml
name: example-project
services:
api:
project: src/api
host: containerapp
language: ts
hooks:
postprovision:
- shell: sh
run: scripts/postprovision1.sh
- shell: sh
run: scripts/postprovision2.sh
hooks:
postprovision:
- shell: sh
run: scripts/postprovision1.sh
- shell: sh
run: scripts/postprovision2.sh
variables from your local environment using the ${YOUR_ENVIRONMENT VARIABLE} syntax.
azd automatically sets certain environment variables in the .env file when commands
are run, such as AZURE_ENV_NAME and AZURE_LOCATION . Output parameters from the
main.bicep file are also set in the .env file. The manage environment variables page
Hooks can get and set environment variables inline or through referenced scripts, as
demonstrated in the following example:
yml
name: azure-search-openai-demo
metadata:
template: azure-search-openai-demo@0.0.2-beta
services:
backend:
project: ./app/backend
language: py
host: appservice
hooks:
postprovision:
windows: # Run referenced script that uses environment variables (script
shown below)
shell: pwsh
run: ./scripts/prepdocs.ps1
interactive: true
continueOnError: false
posix:
shell: sh
run: ./scripts/prepdocs.sh
interactive: true
continueOnError: false
postdeploy: # Pull environment variable inline from local device and set
in .env file
shell: sh
run: azd env set REACT_APP_WEB_BASE_URL ${SERVICE_WEB_ENDPOINT_URL}
The referenced: prepdocs.sh script:
Bash
Request help
For information on how to file a bug, request help, or propose a new feature for the
Azure Developer CLI, please visit the troubleshooting and support page.
Feedback
Was this page helpful? Yes No
By default, some Azure Developer CLI commands display Azure subscription IDs in the
console output. This behavior is useful during development to monitor deployments
and template behavior. However, azd also includes a demo mode to hide Azure
subscription IDs for scenarios such as public presentations that use azd commands,
screen sharing with other users, or any other situation where you want to keep your
subscription IDs hidden.
Bash
Bash
Bash
7 Note
After setting the AZD_DEMO_MODE environment variables, you may need to close and
reopen your terminal window to reload the variable and apply the changes.
Feedback
Was this page helpful? Yes No
The Azure Developer CLI is designed around a powerful template system that
streamlines deploying and provisioning Azure resources. While developing with azd ,
you have the option to either build your own template, or choose from a configurable
list of existing templates. In this article, you learn how to work with template lists and
configure your local azd installation to support different template list sources.
JSON
[
{
"name": "Starter - Bicep",
"description": "A starter template with Bicep as infrastructure
provider",
"repositoryPath": "azd-starter-bicep",
"tags": ["bicep"]
},
{
"name": "Starter - Terraform",
"description": "A starter template with Terraform as infrastructure
provider",
"repositoryPath": "azd-starter-terraform",
"tags": ["terraform"]
}
]
Each template entry in the JSON configuration file includes the following properties:
For a full example, see this JSON file , which is the default template source included in
azd .
azd allows you to enable multiple template sources at a time. The following template
awesome-azd - A list of the templates from the Awesome AZD gallery that is
enabled by default.
default - A small set of curated templates to demonstrate different tech stacks.
file - A local/network path that points to a template source JSON configuration file.
url - An HTTP(S) addressable path that points to a template source JSON
configuration file.
gh - Points to a GitHub repository.
ade - Points to an Azure Deployment Environment template list. Learn more about
Azure Developer CLI support for Azure Deployment Environments.
Use the azd template source list command to list all currently configured template
sources:
Output
Use the azd template source remove command to remove a template source:
Use the azd config reset command to reset the template configuration back to default
settings:
For example, a default installation of azd lists the following templates from the
awesome-azd template source:
Output
Name Source
Repository Path
Event Driven Java Application with Azure Service Bus Awesome AZD
Azure-Samples/ASA-Samples-Event-Driven-Application
Static React Web App with Java API and PostgreSQL Awesome AZD
Azure-Samples/ASA-Samples-Web-Application
SAP CAP on Azure App Service Quickstart Awesome AZD
Azure-Samples/app-service-javascript-sap-cap-quickstart
SAP Cloud SDK on Azure App Service Quickstart (TypeScript) Awesome AZD
Azure-Samples/app-service-javascript-sap-cloud-sdk-quickstart
Java Spring Apps with Azure OpenAI Awesome AZD
Azure-Samples/app-templates-java-openai-springapps
WordPress with Azure Container Apps Awesome AZD
Azure-Samples/apptemplate-wordpress-on-ACA
Bicep template to bootstrap Azure Deployment Environments Awesome AZD
Azure-Samples/azd-deployment-environments
Starter - Bicep Awesome AZD
Azure-Samples/azd-starter-bicep
Starter - Terraform Awesome AZD
Azure-Samples/azd-starter-terraform
...
# Additional templates omitted
Include the --source flag to only list templates from a specific source:
To initialize a template from the displayed list, run the azd init command and provide
the repository path of the template:
Next steps
Azure Developer CLI support for Azure Deployment Environments
Feedback
Was this page helpful? Yes No
This guide explains how to configure the Azure Developer CLI to provision resources
and deploy applications in different clouds.
The Azure Public cloud is the default and will be used if no cloud is specified.
Authentication
When switching between clouds, run azd auth login to authenticate with the set cloud.
The following example sets a sovereign cloud and runs azd auth login to authenticate
with that cloud:
Bash
Cloud configurations
Clouds can be configured at the user, project, or environment level. The order of
configuration precedence is:
4. If no cloud is set in the user configuration azd uses the public AzureCloud
Configure clouds with user settings (azd config set)
Set the cloud for all azd operations using azd config
Bash
Bash
Bash
YAML
name: project-name
cloud:
name: AzureCloud
# ...
YAML
name: project-name
cloud:
name: AzureChinaCloud
# ...
YAML
name: project-name
cloud:
name: AzureUSGovernment
# ...
JSON
{
"cloud": {
"name": "AzureCloud"
}
}
JSON
{
"cloud": {
"name": "AzureChinaCloud"
}
}
JSON
{
"cloud": {
"name": "AzureUSGovernment"
}
}
auth
config
deploy
down
env
provision
up
monitor
show
public (default)
usgovernment
china
Bash
Bash
Bash
This article provides solutions to common problems that might arise when you're using
Azure Developer CLI (azd).
You can also report bugs by opening GitHub Issues in the Azure Developer CLI GitHub
repository .
Bash
azd up --debug
You can also send the debugging output to a local text file for improved usability. This
approach allows the debugging info to be ingested by other monitoring systems and
can also be useful when filing an issue on GitHub.
) Important
Make sure to redact any sensitive information when submitting debug logs on
GitHub or saving them to other diagnostics systems.
Bash
Solution
Run azd auth login to refresh the access token.
Bash
Follow the prompts from the azd auth login command to complete the sign-in process
and update your cached credentials.
by default but a specific released version like 1.0.0 can also be specified).
Once installed, the version of azd symbolically linked in ~/bin will take precedence over
the version of azd symbolically linked in /usr/local/bin .
To revert to using the version of azd already installed on Cloud Shell in bash:
1. Run rm ~/bin/azd
2. Run rm -rf ~/azd
Solution
Use another host to perform tasks that require the docker daemon. One option is to use
docker-machine, as described in the Cloud Shell troubleshooting documentation.
the following error message: "Error: failed to compile bicep template: failed running Az
PowerShell module bicep build: exit code: 1, stdout: , stderr: WARNING: A new Bicep
release is available: v0.4.1272."
Solution
Previously, Bicep was a preqrequisite for installing and using azd . azd now
automatically installs Bicep within the local azd scope (not globally) and this issue
should now be resolved. However, if you want to use a different version, you can set the
environment variable: AZD_BICEP_TOOL_PATH to point to the location of the version you
need.
"Can't provision certain resources in an Azure region because the region is out of
capacity."
"Relevant resource provider isn't present in that region."
Solution
1. Go to the Azure portal .
4. Verify that you've specified an environment name that's the same as your
environment name.
This will cause an issue, as using this or any prior version on any Linux set-up (WSL, ssh-
remote, devcontainer, etc.) already provides an .azd folder with read-only mode.
Solution
1. Manually delete the already provided .azd folder:
Bash
rm -r ~/.azd
2. Run azd init for azd to create the folder again with the right access levels.
development environment.
Bash
You are most likely to encounter this issue when azd is run from a GitHub action. As a
workaround, after you build your site, copy staticwebapp.config.json into the build
folder. You can automate this step this by using a prepackage or predeploy command
hook, which allows you to execute custom scripts at various points in the azd command
workflows.
incremental permissions updates through Bicep, which effectively means the GitHub
Actions workflow overwrites the Access Policy permissions of the local user.
The recommended solution to this issue is to use separate environment names for local
development and GitHub Actions workflows. Read more about using multiple
environments with the azd env command on the FAQ page.
Solution
This is a known issue. While we address this issue, try the following command:
Bash
To fix this issue, upgrade the v8-compile-cache package in the affected project:
1. Change directory to the service which failed ( src/api in the case of failed
packaging service 'api' )
This error is related to your Microsoft Entra tenant enablement of Conditional Access
Policies. The specific policy requires that you are signed in into a supported device
platform.
You may also be receiving this error due to being logged in using the device code
mechanism, which prevents Microsoft Entra ID from detecting your device platform
correctly.
Solution
To configure the workflow, you need to give GitHub permission to deploy to Azure on
your behalf. Authorize GitHub by creating an Azure Service Principal stored in a GitHub
secret named AZURE_CREDENTIALS . Select your Codespace host for steps:
Browser
1. Make sure you're running on a device listed as supported, per the error
message.
3. You may receive an error with message localhost refused to connect after
logging in. If so:
a. Copy the URL.
b. Run curl '<pasted url>' (URL in quotes) in a new Codespaces terminal.
Feedback
Was this page helpful? Yes No
Azure Developer CLI ( azd ) templates often use hooks to execute custom scripts before
and after azd lifecycle events, such as provisioning and deployment. Users can choose
between Bash or PowerShell to write these custom scripts, depending on their
preference and the environment they're working in. If you plan to use templates that
rely on PowerShell to execute scripts, make sure you have PowerShell 7.4 or higher
installed to avoid potential errors.
PowerShell considerations
If a template relies on PowerShell to execute hook scripts, you'll encounter an error
when running commands like azd up if PowerShell version 7.x isn't installed. The Azure
Developer CLI ( azd ) doesn't check for PowerShell installation before running commands;
it only checks when executing a PowerShell hook script.
Bash
pwsh --version
YAML
name: my-azure-project
services:
- name: my-service
hooks:
postprovision:
windows:
shell: pwsh
run: ./scripts/prepdocs.ps1
For the postprovision hook, note that PowerShell is specified as the shell environment
for the prepdocs.ps1 script. This template would encounter an error during command
workflows such as azd up or azd provision if PowerShell 7.x isn't installed on the
device. When you see these types of PowerShell configurations in a template
azure.yaml file, verify that PowerShell is installed on your device before running the
template.
Next steps
Customize your Azure Developer CLI workflows using command event hooks
Feedback
Was this page helpful? Yes No
This article answers commonly asked questions about Azure Developer CLI.
General
How do I uninstall Azure Developer CLI?
There are different options for uninstalling azd depending on how you originally installed it.
Visit the installation page for details.
azd focuses on the high level developer workflow. Apart from provisioning/managing Azure
resources, azd helps to stitch cloud components, local development configuration, and
pipeline automation together into a complete solution.
Azure CLI is a control plane tool for creating and administering Azure infrastructure such as
virtual machines, virtual networks, and storage. The Azure CLI is designed around granular
commands for specific administrative tasks.
txt
1. Run azd init -t <template repo> to clone the template project to your local machine.
2. To pull down the existing env created using Codespaces, run azd env refresh . Make sure
you provide the same environment name, subscription and location as before.
passed as parameters for the names of the Key Vault and secret. If the value can't be retrieved,
a random password is generated instead.
JSON
"sqlAdminPassword": {
"value": "$(secretOrRandomPassword ${AZURE_KEY_VAULT_NAME} sqlAdminPassword)"
}
The output of secretOrRandomPassword should also be saved to Key Vault using Bicep for future
runs. Retrieving and reusing the same secrets across deploys can prevent errors or unintended
behaviors that can surface when repeatedly generating new values. To create a Key Vault and
store the generated secret in it, use the Bicep code below. You can view the full sample code
for these modules in the Azure Developer CLI GitHub repository .
JSON
This Bicep setup enables the following workflow for managing your secrets:
1. If the specified secret exists, it's retrieved from Key Vault using the
secretOrRandomPassword function.
2. If the secret doesn't exist, a Key Vault is created, and the randomly generated secret is
stored inside of it.
3. On future deploys, the secretOrRandomPassword method retrieves the stored secret now
that it exists in Key Vault. The Key Vault won't be recreated if it already exists, but the
same secret value will be stored again for the next run.
Our 'Azure Dev' authored templates allow for configuring the name of the resource. To do so,
you can add an entry to the main.parameters.json in the infra folder. For example:
JSON
"webServiceName": {
"value": "my-unique-name"
}
This entry creates a new resource named "my-unique-name" instead of a randomized value
such as "app-web-aj84u2adj" the next time you provision your application. You can either
manually remove the old resource group using the Azure portal or run azd down to remove all
previous deployments. After removing the resources, run azd provision to create them again
with the new name.
This name will need to be globally unique, otherwise you will receive an ARM error during azd
provision when it tries to create the resource.
Command: azd provision
How does the command know what resources to
provision?
The command uses Bicep templates, which are found under <your-project-directory-
name>/infra to provision Azure resources.
You can also go to https://portal.azure.com and then look for your resource group, which is
rg-<your-environment-name> . If any of the deployments fail, select the error link to get more
information.
For other resources, see Troubleshoot common Azure deployment errors - Azure Resource
Manager.
While we recommend using tags on resources, you can also use the resourceName property in
azure.yaml to provide an explicit resource name. In that case, the above logic isn't run.
If you don't want to skip any services, be sure to either run your command from the root folder
or add the --all flag to your command.
Command: azd up
Can I rerun `azd up`?
Yes. We use the incremental deployment mode.
While OIDC is supported as the default for GitHub Actions and Azure Pipeline (set as
federated), it isn't supported for Azure DevOps or Terraform.
For Azure DevOps, explicitly calling out --auth-type as federated will result in an error.
For Terraform:
If --auth-type isn't defined, it will fall back to clientcredentials and will result in a
warning.
If --auth-type is explicitly set to federated , it will result in an error.
{
"clientId": "<GUID>",
"clientSecret": "<GUID>",
"subscriptionId": "<GUID>",
"tenantId": "<GUID>",
(...)
}
Where can I find the log for the GitHub Actions job
that I triggered when I ran `azd pipeline config`?
Go to https://github.com/<your-github-account>/<your-repo>/actions , and then refer to the
log file in the workflow run.
azd templates are blueprint repositories that include proof-of-concept application code,
editor/IDE configurations, and infrastructure code written in Bicep or Terraform. These
templates are intended to be modified and adapted for your specific application
requirements and then used to get your application on Azure using the Azure Developer
CLI ( azd ). The azure.yaml schema defines and describes the apps and types of Azure
resources that are included in these templates.
Sample
Below is a generic example of an azure.yaml required for your azd template.
YAML
name: yourApp
metadata:
template: yourApp@0.0.1-beta
services:
web:
project: ./src/web # path to your web project
dist: build # relative path to service deployment artifacts
language: js # one of the supported languages
host: appservice # one of the supported Azure services
Compare with the azure.yaml from our ToDo NodeJs Mongo template :
YAML
name: todo-nodejs-mongo
metadata:
template: todo-nodejs-mongo@0.0.1-beta
services:
web:
project: ./src/web
dist: build
language: js
host: appservice
api:
project: ./src/api
language: js
host: appservice
Property descriptions
ノ Expand table
resourceGroup N (string) Name of the Azure resource group. When specified, will
override the resource group name used for infrastructure
provisioning.
metadata properties
ノ Expand table
infra properties
ノ Expand table
provider N (string) The infrastructure provider for the See the Terraform
application's Azure resources. (Default: bicep). sample below. bicep ,
terraform
YAML
name: yourApp-terraform
metadata:
template: yourApp-terraform@0.0.1-beta
services:
web:
project: ./src/web
dist: build
language: js
host: appservice
api:
project: ./src/api
language: js
host: appservice
infra:
provider: terraform
services properties
ノ Expand table
docker N Only applicable when host See the custom Docker sample below.
is containerapp . Can't path (string): Path to the Dockerfile.
contain extra properties. Default: ./Dockerfile ; context
(string): The docker build context.
When specified, overrides default
context. Default: . ; platform (string):
The platform target. Default: amd64 ;
Element Required Description Example
Name
hooks N Service level hooks. Hooks See Customize your Azure Developer
should match service event CLI workflows using command and
names prefixed with pre or event hooks for more details.
post depending on when
the script should execute.
When specifying paths they
should be relative to the
service path.
YAML
name: yourApp-aca
metadata:
template: yourApp-aca@0.0.1-beta
services:
api:
project: ./src/api
language: js
host: containerapp
docker:
path: ./Dockerfile
context: ../
web:
project: ./src/web
language: js
host: containerapp
docker:
remoteBuild: true
ノ Expand table
name N (string) Optional. The name of the k8s deployment resource api
to use during deployment. Used during deployment to
ensure if the k8s deployment rollout has been completed. If
not set, will search for a deployment resource in the same
namespace that contains the service name. Default: Service
name
ノ Expand table
name N (string) Optional. The name of the k8s service resource to use api
as the default service endpoint. Used when determining
endpoints for the default service resource. If not set, will
Element Required Description Example
Name
ノ Expand table
name N (string) Optional. The name of the k8s ingress resource to api
use as the default service endpoint. Used when
determining endpoints for the default ingress resource. If
not set, will search for a deployment resource in the same
namespace that contains the service name. Default:
Service name
relativePath N (string) Optional. The relative path to the service from the
root of your ingress controller. When set, will be
appended to the root of your ingress resource path.
metadata:
template: todo-nodejs-mongo-aks@0.0.1-beta
services:
web:
project: ./src/web
dist: build
language: js
host: aks
hooks:
postdeploy:
shell: sh
run: azd env set REACT_APP_WEB_BASE_URL ${SERVICE_WEB_ENDPOINT_URL}
api:
project: ./src/api
language: js
host: aks
k8s:
ingress:
relativePath: api
hooks:
postdeploy:
shell: sh
run: azd env set REACT_APP_API_BASE_URL ${SERVICE_API_ENDPOINT_URL}
pipeline properties
ノ Expand table
YAML
name: yourApp
services:
web:
project: src/web
dist: build
language: js
host: appservice
pipeline:
provider: azdo
workflows properties
ノ Expand table
up object No When specified will override the default behavior for the azd
up workflow.
up properties
ノ Expand table
Element Name Type Required Description
steps properties
ノ Expand table
azd string Yes The name and args of the azd command to execute.
Sample workflow
The following azure.yaml file changes the default behavior of azd up to move the azd
package step after the azd provision step using a workflow. This example could be used
in scenarios where you need to know the URLs of resources during the build or
packaging process.
yml
name: todo-nodejs-mongo
metadata:
template: todo-nodejs-mongo@0.0.1-beta
workflows:
up:
steps:
- azd: provision
- azd: deploy --all
Request help
For information on how to file a bug, request help, or propose a new feature for the
Azure Developer CLI, please visit the troubleshooting and support page.
Next steps
Learn more about Azure Developer CLI
Get started with azd init and azd up
Feedback
Was this page helpful? Yes No
This article explains the syntax and parameters for the various Azure Developer CLI commands.
azd
The Azure Developer CLI ( azd ) is an open-source tool that helps onboard and manage your
application on Azure
Options
Azure Developer CLI
See also
azd add: Add a component to your project. (Alpha)
azd auth: Authenticate with Azure.
azd config: Manage azd configurations (ex: default Azure subscription, location).
azd deploy: Deploy the application's code to Azure.
azd down: Delete Azure resources for an application.
azd env: Manage environments.
azd hooks: Develop, test and run hooks for an application. (Beta)
azd infra: Manage your Azure infrastructure.
azd init: Initialize a new application.
azd monitor: Monitor a deployed application. (Beta)
azd package: Packages the application's code to be deployed to Azure. (Beta)
azd pipeline: Manage and configure your deployment pipelines. (Beta)
azd provision: Provision the Azure resources for an application.
azd restore: Restores the application's dependencies. (Beta)
azd show: Display information about your app and its resources.
azd template: Find and view template details. (Beta)
azd up: Provision Azure resources, and deploy your project with a single command.
azd version: Print the version number of Azure Developer CLI.
azd add
Add a component to your project. (Alpha)
Options
Azure Developer CLI
--docs Opens the documentation for azd add in your web browser.
-h, --help Gets help for add.
See also
Back to top
azd auth
Authenticate with Azure.
Options
Azure Developer CLI
--docs Opens the documentation for azd auth in your web browser.
-h, --help Gets help for auth.
See also
azd auth login: Log in to Azure.
azd auth logout: Log out of Azure.
Back to top
Synopsis
Log in to Azure.
When run without any arguments, log in interactively using a browser. To log in using a device
code, pass --use-device-code.
To log in as a service principal, pass --client-id and --tenant-id as well as one of: --client-secret,
--client-certificate, or --federated-credential-provider.
To log in using a managed identity, pass --managed-identity, which will use the system
assigned managed identity. To use a user assigned managed identity, pass --client-id in
addition to --managed-identity with the client id of the user assigned managed identity you
wish to use.
Options
Azure Developer CLI
See also
azd auth: Authenticate with Azure.
Back to top
Synopsis
Log out of Azure
Options
Azure Developer CLI
--docs Opens the documentation for azd auth logout in your web browser.
-h, --help Gets help for logout.
See also
azd auth: Authenticate with Azure.
Back to top
azd config
Manage azd configurations (ex: default Azure subscription, location).
Synopsis
Manage the Azure Developer CLI user configuration, which includes your default Azure
subscription and location.
The easiest way to configure azd for the first time is to run azd init. The subscription and
location you select will be stored in the config.json file located in the config directory. To
configure azd anytime afterwards, you'll use azd config set.
Options
Azure Developer CLI
--docs Opens the documentation for azd config in your web browser.
-h, --help Gets help for config.
See also
azd config get: Gets a configuration.
azd config list-alpha: Display the list of available features in alpha stage.
azd config reset: Resets configuration to default.
azd config set: Sets a configuration.
azd config show: Show all the configuration values.
azd config unset: Unsets a configuration.
Back to top
Synopsis
Gets a configuration in the configuration path.
Options
Azure Developer CLI
--docs Opens the documentation for azd config get in your web browser.
-h, --help Gets help for get.
See also
azd config: Manage azd configurations (ex: default Azure subscription, location).
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd config list-alpha in your web
browser.
-h, --help Gets help for list-alpha.
See also
azd config: Manage azd configurations (ex: default Azure subscription, location).
Back to top
Synopsis
Resets all configuration in the configuration path.
Options
Azure Developer CLI
--docs Opens the documentation for azd config reset in your web browser.
-f, --force Force reset without confirmation.
-h, --help Gets help for reset.
See also
azd config: Manage azd configurations (ex: default Azure subscription, location).
Back to top
Synopsis
Sets a configuration in the configuration path.
Examples
Azure Developer CLI
Options
Azure Developer CLI
--docs Opens the documentation for azd config set in your web browser.
-h, --help Gets help for set.
See also
azd config: Manage azd configurations (ex: default Azure subscription, location).
Back to top
Synopsis
Show all configuration values in the configuration path.
Options
Azure Developer CLI
--docs Opens the documentation for azd config show in your web browser.
-h, --help Gets help for show.
See also
azd config: Manage azd configurations (ex: default Azure subscription, location).
Back to top
Synopsis
Removes a configuration in the configuration path.
Examples
Azure Developer CLI
Options
Azure Developer CLI
--docs Opens the documentation for azd config unset in your web browser.
-h, --help Gets help for unset.
See also
azd config: Manage azd configurations (ex: default Azure subscription, location).
Back to top
azd deploy
Deploy the application's code to Azure.
See also
Back to top
azd down
Delete Azure resources for an application.
Options
Azure Developer CLI
See also
Back to top
azd env
Manage environments.
Options
Azure Developer CLI
--docs Opens the documentation for azd env in your web browser.
-h, --help Gets help for env.
See also
azd env get-value: Get specific environment value.
azd env get-values: Get all environment values.
azd env list: List environments.
azd env new: Create a new environment and set it as the default.
azd env refresh: Refresh environment settings by using information from a previous
infrastructure provision.
azd env select: Set the default environment.
azd env set: Manage your environment settings.
azd env set-secret: Set a <name> as a reference to a Key Vault secret in the environment.
Back to top
Options
Azure Developer CLI
See also
azd env: Manage environments.
Back to top
azd env get-values
Get all environment values.
Options
Azure Developer CLI
See also
azd env: Manage environments.
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd env list in your web browser.
-h, --help Gets help for list.
See also
azd env: Manage environments.
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd env new in your web
browser.
-h, --help Gets help for new.
-l, --location string Azure location for the new environment
--subscription string Name or ID of an Azure subscription to use for the
new environment
See also
azd env: Manage environments.
Back to top
Options
Azure Developer CLI
See also
azd env: Manage environments.
Back to top
azd env select
Set the default environment.
Options
Azure Developer CLI
--docs Opens the documentation for azd env select in your web browser.
-h, --help Gets help for select.
See also
azd env: Manage environments.
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd env set in your web
browser.
-e, --environment string The name of the environment to use.
-h, --help Gets help for set.
See also
azd env: Manage environments.
Back to top
Synopsis
You can either create a new Key Vault secret or select an existing one. The provided name is the
key for the .env file which holds the secret reference to the Key Vault secret.
Options
Azure Developer CLI
See also
azd env: Manage environments.
Back to top
azd hooks
Develop, test and run hooks for an application. (Beta)
Options
Azure Developer CLI
--docs Opens the documentation for azd hooks in your web browser.
-h, --help Gets help for hooks.
See also
azd hooks run: Runs the specified hook for the project and services
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd hooks run in your web
browser.
-e, --environment string The name of the environment to use.
-h, --help Gets help for run.
--platform string Forces hooks to run for the specified platform.
--service string Only runs hooks for the specified service.
See also
azd hooks: Develop, test and run hooks for an application. (Beta)
Back to top
azd infra
Manage your Azure infrastructure.
Options
Azure Developer CLI
--docs Opens the documentation for azd infra in your web browser.
-h, --help Gets help for infra.
Options inherited from parent commands
Azure Developer CLI
See also
azd infra synth: Write IaC for your project to disk, allowing you to manage it by hand.
(Alpha)
Back to top
Options
Azure Developer CLI
azd init
Initialize a new application.
Options
Azure Developer CLI
-b, --branch string The template branch to initialize from. Must be used
with a template argument (--template or -t).
--docs Opens the documentation for azd init in your web
browser.
-e, --environment string The name of the environment to use.
-f, --filter strings The tag(s) used to filter template results. Supports
comma-separated values.
--from-code Initializes a new application from your existing
code.
-h, --help Gets help for init.
-l, --location string Azure location for the new environment
-s, --subscription string Name or ID of an Azure subscription to use for the
new environment
-t, --template string Initializes a new application from a template. You
can use Full URI, <owner>/<repository>, or <repository> if it's part of the azure-
samples organization.
--up Provision and deploy to Azure after initializing the
project from a template.
azd monitor
Monitor a deployed application. (Beta)
Options
Azure Developer CLI
See also
Back to top
azd package
Packages the application's code to be deployed to Azure. (Beta)
Azure Developer CLI
Options
Azure Developer CLI
See also
Back to top
azd pipeline
Manage and configure your deployment pipelines. (Beta)
Options
Azure Developer CLI
--docs Opens the documentation for azd pipeline in your web browser.
-h, --help Gets help for pipeline.
See also
azd pipeline config: Configure your deployment pipeline to connect securely to Azure.
(Beta)
Back to top
Options
Azure Developer CLI
See also
azd pipeline: Manage and configure your deployment pipelines. (Beta)
Back to top
azd provision
Provision the Azure resources for an application.
Options
Azure Developer CLI
See also
Back to top
azd restore
Restores the application's dependencies. (Beta)
Options
Azure Developer CLI
See also
Back to top
azd show
Display information about your app and its resources.
Options
Azure Developer CLI
See also
Back to top
azd template
Find and view template details. (Beta)
Options
Azure Developer CLI
--docs Opens the documentation for azd template in your web browser.
-h, --help Gets help for template.
Options inherited from parent commands
Azure Developer CLI
See also
azd template list: Show list of sample azd templates. (Beta)
azd template show: Show details for a given template. (Beta)
azd template source: View and manage template sources. (Beta)
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd template list in your web
browser.
-f, --filter strings The tag(s) used to filter template results. Supports
comma-separated values.
-h, --help Gets help for list.
-s, --source string Filters templates by source.
See also
azd template: Find and view template details. (Beta)
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd template show in your web browser.
-h, --help Gets help for show.
See also
azd template: Find and view template details. (Beta)
Back to top
--docs Opens the documentation for azd template source in your web
browser.
-h, --help Gets help for source.
See also
azd template: Find and view template details. (Beta)
azd template source add: Adds an azd template source with the specified key. (Beta)
azd template source list: Lists the configured azd template sources. (Beta)
azd template source remove: Removes the specified azd template source (Beta)
Back to top
Synopsis
The key can be any value that uniquely identifies the template source, with well-known values
being: ・default: Default templates ・awesome-azd: Templates from https://aka.ms/awesome-
azd
Options
Azure Developer CLI
See also
azd template source: View and manage template sources. (Beta)
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd template source list in your web
browser.
-h, --help Gets help for list.
See also
azd template source: View and manage template sources. (Beta)
Back to top
Options
Azure Developer CLI
--docs Opens the documentation for azd template source remove in your web
browser.
-h, --help Gets help for remove.
See also
azd template source: View and manage template sources. (Beta)
Back to top
azd up
Provision Azure resources, and deploy your project with a single command.
azd up [flags]
Options
Azure Developer CLI
See also
Back to top
azd version
Print the version number of Azure Developer CLI.
Options
Azure Developer CLI
--docs Opens the documentation for azd version in your web browser.
-h, --help Gets help for version.
See also
Back to top
CDN changes for the Azure Developer
CLI installation endpoints
Article • 01/09/2025
The Content Delivery Network (CDN) endpoint used to download and install azd is
changing due to the Azure CDN from Edgio retirement effective January 15, 2025. If you
install azd using a script, it's recommended you use the latest install scripts hosted at
https://aka.ms/install-azd.ps1 and https://aka.ms/install-azd.sh . Customers who
7 Note
Hard coding the CDN hostname directly to reference install scripts isn't a
supported scenario. If your logic depends on the hostname, then future changes to
hostnames could result in a breaking change to your application.
Recommended actions
Complete or verify the following to ensure your system is compatible with the CDN
changes:
Ensure you're using the latest GitHub Action ( v2 ) for azure/setup-azd in your
workflows.
Ensure you're using the latest Azure DevOps task version .
Ensure any custom install scripts reference the new host name. There's no change
to file paths after the host name.
Additional information and resources
For more on this change, follow the issue in the azd repository or read the FAQs on
Microsoft Learn documentation.
If you run into any problems or have suggestions, file an issue or start a discussion in
the Azure Developer CLI repository . You can also explore the troubleshooting
documentation .
Feedback
Was this page helpful? Yes No