Skip to content

.NET Aspire — azd Environments Explained

azd env new dev doesn’t create anything in Azure. It creates a local config file. Here’s what actually happens—and why it matters for your Aspire deployment.

An azd environment is NOT an Azure resource—it’s a local configuration profile that tells azd which subscription, region, and settings to use when deploying.

Aspectazd EnvironmentAzure Resource Group
Location~/.azd/environments/{name}/ (local)Azure portal (cloud)
Created byazd env newazd up
ContainsConfig files, .env variables, deployment settingsActual cloud resources (containers, DBs, registries)
Deleted byrm -rf ~/.azd/environments/{name}azd down

When you run:

Terminal window
azd env new dev

azd creates a local folder structure with your deployment configuration:

~/.azd/environments/dev/
├── .env # Environment variables
├── config.json # Deployment metadata
└── .azure/ # Azure-specific settings

It prompts for:

  1. Azure subscription (which account to bill)
  2. Azure region (where to deploy)
  3. Environment name (dev, staging, prod)

No Azure resources are created yet. This is just local configuration.

This is when real Azure resources get created:

Terminal window
azd up
  1. Resource Group — Container for all resources
  2. Container Apps Environment — Hosts your Aspire services
  3. Azure Container Registry — Stores your container images
  4. Database Account — Your app’s data layer
  5. Static Web App — Serves your frontend
  6. Application Insights — Monitoring and telemetry
  7. Managed Identities — Secure service-to-service auth
  8. Networking & Security — HTTPS, CORS, service discovery

azd generates consistent resource names using the {type}-{project}-{env} pattern:

Resource TypePatternExample
Resource Grouprg-{project}-{env}rg-myapp-dev
Container Apps Envcae-{project}-{env}cae-myapp-dev
Container Registryacr{project}{env}acrmyappdev
Databasecosmos-{project}-{env}cosmos-myapp-dev
Static Web Appswa-{project}-{env}swa-myapp-dev
App Insightsai-{project}-{env}ai-myapp-dev
Terminal window
# Create a new environment (local config only)
azd env new <environment-name>
# List all local environments
azd env list
# Switch to a different environment
azd env select <environment-name>
# View current environment variables
azd env get-values
# Set a variable for the current environment
azd env set <KEY> <VALUE>
# Deploy everything for current environment
azd up
# Remove all Azure resources (keep local config)
azd down
# Update only application code (without re-provisioning)
azd deploy

The complete flow from local development to production:

  1. Create Environment: azd env new dev (configuration only)
  2. Deploy Everything: azd up (creates all Azure resources)
  3. Make Changes: Edit code locally
  4. Update Deployment: azd deploy (updates application, keeps infrastructure)
  5. Clean Up: azd down (removes all Azure resources)

With Aspire’s AppHost and azd’s orchestration, you get Infrastructure as Code without writing infrastructure code. Aspire defines your services; azd deploys them consistently.