Azure Developer CLI (azd)
Ce contenu n’est pas encore disponible dans votre langue.
The Azure Developer CLI (azd) is a developer-oriented command-line tool that can provision Azure resources and deploy applications from your local environment or CI/CD pipelines. It integrates with Aspire by consuming the deployment manifest format to understand your app model and automatically provision the corresponding Azure resources.
When to use azd
Section titled “When to use azd”While aspire deploy is the recommended path, azd remains useful in several scenarios:
- You have existing
azdworkflows and infrastructure templates you want to continue using. - You need
azd pipeline configfor automated CI/CD setup with GitHub Actions or Azure DevOps. - You want to use
azdenvironment management features to manage multiple deployment environments. - You’re working with teams already familiar with
azdconventions and tooling.
Prerequisites
Section titled “Prerequisites”- Azure Developer CLI installed
- An active Azure subscription — create one for free
- Aspire CLI installed
Basic workflow
Section titled “Basic workflow”-
Initialize your project — run
azd initfrom your AppHost directory. When prompted, select Use code in the current directory soazddetects the Aspire app model.Initialize azd in the AppHost directory azd init -
Provision and deploy — run
azd upto provision the required Azure resources and deploy your application in a single step. This combines theazd provisionandazd deploycommands.Provision infrastructure and deploy azd up -
Redeploy without reprovisioning — after the initial deployment, use
azd deployto push code changes without reprovisioning infrastructure.Deploy updated code azd deploy
aspire deploy vs azd comparison
Section titled “aspire deploy vs azd comparison”| Feature | aspire deploy | azd |
|---|---|---|
| Azure Container Apps | ✅ | ✅ |
| Azure App Service | ✅ | ❌ |
| Infrastructure provisioning | Built-in | Built-in |
| CI/CD pipeline setup | Manual | azd pipeline config |
| Environment management | State caching | azd env |
| Manifest dependency | No | Yes |
Resource naming
Section titled “Resource naming”The aspire deploy path and azd use different resource naming schemes by default. If you’re upgrading from an existing azd deployment to aspire deploy, use WithAzdResourceNaming() to preserve the original naming convention. This avoids creating duplicate Azure resources:
var builder = DistributedApplication.CreateBuilder(args);
builder.AddAzureContainerAppEnvironment("env") .WithAzdResourceNaming();import { createBuilder } from './.modules/aspire.js';
const builder = await createBuilder();
const env = await builder.addAzureContainerAppEnvironment('env');await env.withAzdResourceNaming();Deployment manifest
Section titled “Deployment manifest”The azd tool relies on the deployment manifest format to understand your application topology. The manifest is a JSON document generated from the AppHost that describes resources, bindings, and parameters. It’s produced automatically when azd invokes the AppHost during deployment.
See also
Section titled “See also”- Deploy using the Aspire CLI — recommended deployment path
- Deployment manifest format
- Azure Developer CLI documentation