aspire deploy
Deploy an AppHost to its deployment targets. (Preview)Usage
Description
Theaspire deploy command deploys your Aspire application to cloud environments like Azure Container Apps, Azure Kubernetes Service (AKS), or Kubernetes. It generates deployment manifests, provisions infrastructure, and deploys your services.
The
aspire deploy command is currently in preview and under active development.What it Does
- Builds the AppHost - Compiles your AppHost project
- Generates manifests - Creates deployment manifests based on your AppHost configuration
- Provisions infrastructure - Creates cloud resources (containers, databases, message queues)
- Deploys services - Publishes and deploys your containerized services
- Configures networking - Sets up ingress, service discovery, and communication
- Manages secrets - Securely handles connection strings and credentials
Options
The path to the Aspire AppHost project fileExample:
--apphost ./src/MyApp.AppHost/MyApp.AppHost.csprojIf not specified, the CLI searches for an AppHost project in the current directory and parent directories.The optional output path for deployment artifactsExample:
--output-path ./deployDeployment artifacts include manifests, Dockerfiles, and configuration files.The deployment environment nameExample:
--environment ProductionThis maps to ASP.NET Core environment names and can be used to configure environment-specific settings.Set the logging verbosity levelOptions:
Trace, Debug, Information, Warning, Error, CriticalExample: --log-level DebugInclude exception details in error messagesExample:
--include-exception-detailsUseful for debugging deployment failures.Clear the deployment cache and do not save deployment stateExample:
--clear-cacheForces a fresh deployment without using cached state.Examples
Deploy to default target
Deploy to a specific environment
ASPNETCORE_ENVIRONMENT=Production, which can be used to:
- Load environment-specific
appsettings.Production.jsonfiles - Configure production database connection strings
- Enable/disable features based on environment
Deploy with artifacts output
./deploy directory:
Deploy with debug logging
Force a clean deployment
Deployment Targets
Azure Container Apps
Deploy to Azure Container Apps for a fully managed serverless container platform:- Azure subscription
- Azure CLI (
az) installed and authenticated - Azure Container Apps extension
- Container Apps Environment
- Container Apps for each service
- Azure Container Registry for images
- Managed identities for services
- Azure resources for integrations (Redis, PostgreSQL, etc.)
Azure Kubernetes Service (AKS)
Deploy to AKS for full Kubernetes control:- Azure subscription
- Azure CLI (
az) installed and authenticated - kubectl installed
- AKS cluster created
- Kubernetes deployments
- Kubernetes services
- Ingress configurations
- ConfigMaps and Secrets
Kubernetes
Deploy to any Kubernetes cluster:- kubectl configured with cluster access
- Docker registry for images
Deployment Manifest
Theaspire deploy command generates a deployment manifest from your AppHost. The manifest describes:
- Projects - .NET services to containerize and deploy
- Containers - Pre-built container images to deploy
- Resources - Infrastructure dependencies (databases, caches, queues)
- Connections - Service-to-service references and connection strings
- Endpoints - HTTP/HTTPS ingress configuration
Environment Variables
Deployment injects environment variables for:- Connection strings - Database, cache, and message queue connections
- Service discovery - URLs for referenced services
- Configuration - AppHost-defined environment variables
Secrets Management
The deployment automatically:- Extracts connection strings and secrets from your AppHost
- Stores them securely in the target platform (Azure Key Vault, Kubernetes Secrets)
- Injects them as environment variables at runtime
- Never includes secrets in deployment manifests
Deployment State
The CLI maintains deployment state to enable:- Incremental updates (only changed resources)
- Resource cleanup on redeploy
- Environment isolation
--clear-cache.
Troubleshooting
Deployment fails with authentication error
Ensure you’re authenticated:Services fail to start
Check logs:Connection strings are missing
Verify environment variables:Resources aren’t provisioned
Check the deployment manifest:Limitations (Preview)
Current preview limitations:- Limited to Azure and Kubernetes deployment targets
- Some integration types may not support deployment
- Manual cleanup of cloud resources may be required
- Deployment state management is evolving
See Also
- Deployment Overview - Learn about deployment concepts
- Deploy to Azure - Azure-specific deployment guide
- Deploy to Kubernetes - Kubernetes deployment guide
- CLI Overview - Complete CLI command reference