When you compose your distributed app in Aspire’s AppHost, you’re not just defining services for local development and orchestration—you’re also setting up the foundation for deployment. The same composition you use to run and debug locally is leveraged when you publish your app, ensuring consistency from development through to production.
Aspire doesn’t get in the way of your existing deployment workflows. Instead, it provides a consistent way to define your application architecture that can be deployed across different environments and platforms.
Continuing from the three-tier architecture example, you can deploy the same app topology to various environments, whether it’s a local machine, a cloud provider, or your own servers.
This table shows how you can deploy the same resources across different platforms:
Resource
Local
AWS
Azure
On-Premises
Frontend
npm run dev
Elastic Container Service
Container Apps
Custom
API Service
Local process
AWS Lambda
Functions
Custom
PostgreSQL
docker.io/library/postgres
Relational Database Service
Database for Postgres
Custom
Aspire uses a pipeline-based deployment system that enables extensible, composable deployment workflows. This system allows you to customize how your applications are deployed while maintaining consistency across different environments.
The pipeline deployment system provides a flexible, concurrent model for deploying cloud applications. Pipelines break deployment into discrete, well-defined steps that can be optimized for performance and reliability while maintaining clear visibility into the deployment process.
Modern cloud applications require sophisticated deployment orchestration to handle the complexity of distributed systems. Aspire’s pipeline system provides:
Intelligent concurrency: Independent operations run in parallel, maximizing resource utilization and minimizing total deployment time
Granular control: Each step can be executed, monitored, and retried independently with specific error reporting and targeted recovery capabilities
Smart dependency management: Steps wait only for their actual dependencies, ensuring optimal execution order while maintaining correctness
Comprehensive observability: Real-time progress reporting at both step and sub-task levels provides clear visibility into deployment operations
Flexible execution: Run complete deployments or selective step execution based on your specific needs
A pipeline step represents a discrete unit of work in the application pipeline. Each step encapsulates a specific aspect of the deployment process, making the overall operation more manageable and debuggable.
Each step has:
Name: A unique identifier for the step
Action: The work to be performed during deployment
Dependencies: Other steps that must complete before this step runs
Resource context: Access to the application’s resource model and configuration
Pipeline steps operate at different levels of granularity. For example, when deploying a typical web application with a frontend, API service, database, and storage, the pipeline might include:
Infrastructure steps (can run in parallel):
provision-cosmosdb: Provision the CosmosDB database
provision-container-registry: Set up the container image registry
Build steps (can run in parallel):
build-apiservice: Build container image for the API service
build-webfrontend: Build container image for the frontend
Deployment steps (depend on builds and infrastructure):
push-apiservice: Push API service image to registry
push-webfrontend: Push frontend image to registry
deploy-apiservice: Deploy API service to compute platform
deploy-webfrontend: Deploy frontend to compute platform
This granular approach allows the pipeline to maximize parallelism—databases can be provisioned while container images are building, and as soon as both the container registry and an image are ready, the image can be pushed immediately without waiting for other unrelated operations.
Resource annotations: Steps contributed by resources in your application model (e.g., a database resource contributes its provisioning step)
Pipeline API calls: Steps added directly through pipeline configuration in your AppHost
This decentralized approach allows both framework components and user code to participate in the deployment process without requiring changes to a central configuration.
Dependencies in Aspire pipelines are explicit and purpose-driven, unlike traditional deployment systems where dependencies might be implicit or overly broad.
Aspire’s pipeline system is designed around intelligent orchestration of deployment operations, ensuring that your applications deploy efficiently and reliably across different environments.
The pipeline system uses fine-grained steps to provide precise control and visibility while maintaining deployment efficiency:
Resource-level granularity: Each infrastructure resource (databases, storage accounts, container registries) is provisioned as a separate step, enabling:
Precise error reporting: When a specific resource fails, you know exactly what went wrong
Targeted retry capabilities: Retry only the failed resource without affecting successfully provisioned components
Progress transparency: Clear visibility into which resources are provisioning and their current status
Flexible recovery: Ability to fix issues and continue from the point of failure
Operation-level organization: Related operations are grouped logically while maintaining independence:
Build operations: Multiple container images can build in parallel using available system resources
Push operations: Images can be pushed to registries as soon as they’re built and the registry is available
Deployment operations: Services deploy as soon as their dependencies (images, infrastructure) are ready
Aspire registers a default set of well-known steps that serve as integration points for the deployment pipeline. These steps provide a standardized way for resources and applications to participate in common deployment workflows.
WellKnownPipelineSteps.Deploy: The primary entry point for the aspire deploy command. This step orchestrates the complete deployment process including infrastructure provisioning, image building, and application deployment.
WellKnownPipelineSteps.Publish: The entry point for the aspire publish command, which typically generates deployment artifacts without executing the actual deployment.
WellKnownPipelineSteps.Build: The entry point for the aspire do build command, which builds container images for compute resources defined in the application.
WellKnownPipelineSteps.Push: The entry point for the aspire do push command, which pushes container images to registries after they have been built.
WellKnownPipelineSteps.BuildPrereq: Defines steps that are pre-requisites for building, such as dependency resolution, environment setup, and build tool validation.
WellKnownPipelineSteps.DeployPrereqs: Defines steps that are pre-requisites for deployment, such as authentication, environment validation, and prerequisite resource checks.
WellKnownPipelineSteps.PublishPrereqs: Defines steps that are pre-requisites for publishing, such as build environment setup and artifact preparation.
WellKnownPipelineSteps.PushPrereq: Defines steps that are pre-requisites for pushing container images, such as registry authentication and connection validation.
These well-known steps create a contract that allows different parts of the system to integrate predictably. For example, a custom authentication step can declare itself as required by DeployPrereqs, ensuring it runs before any deployment operations begin.
Resources in your application model can contribute their own pipeline steps through annotations. This pattern allows libraries and integrations to encapsulate their deployment logic without requiring changes to your application code.
How resource-contributed steps work:
Annotation-based registration: Resources use annotations to declare their pipeline steps
Automatic discovery: The pipeline system automatically discovers steps from all resources during the registration phase
Dependency integration: Resource steps can depend on well-known steps or other resource steps
Example: Static site resource contributing steps
A static site resource might contribute multiple related steps:
Each step handles a specific aspect of static site deployment:
Building site artifacts: Compile, optimize, and prepare static files
Configuring storage permissions: Set up appropriate access controls
Uploading files: Transfer built artifacts to cloud storage
Configuring CDN: Set up content distribution and routing
This approach keeps deployment logic close to the resource definition while allowing the pipeline system to optimize execution order and handle dependencies automatically.
Applications can add custom steps directly through the pipeline API for scenarios that don’t belong to a particular resource but are specific to the application’s deployment requirements.
Common application-specific step scenarios:
Database migrations: Running schema updates or data transformations
Smoke tests: Validating deployed services before marking deployment as complete
Configuration updates: Updating external services or third-party integrations
Notification workflows: Sending deployment status updates to team communication channels
var api =builder.AddDotnetProject("api","../Api/Api.csproj").WithReference(database);
This pattern enables applications to extend the deployment process with custom logic while benefiting from the pipeline’s dependency management and execution coordination.
The pipeline system provides sophisticated mechanisms for controlling how and when deployment steps are executed, giving you precise control over the deployment process.
The aspire do command allows you to execute individual steps and their dependencies, providing fine-grained control over the deployment process. This capability addresses several real-world deployment scenarios where running the entire pipeline isn’t necessary or desired.
Use cases for selective step execution:
Incremental deployments: After making changes to only your frontend code, run just the frontend-related steps rather than rebuilding and redeploying your entire application
Troubleshooting and retry: If a specific step fails (e.g., database provisioning times out), you can retry just that step and its dependents without repeating successful operations
Development workflows: During development, you might want to provision infrastructure once, then repeatedly deploy code changes without reprovisioning resources
Selective operations: Separate infrastructure provisioning from application deployment to align with organizational policies or approval processes
How selective execution works:
When you specify a step to run, the pipeline system automatically:
Includes all dependencies: Ensures prerequisite steps are executed in the correct order
Skips unnecessary steps: Avoids running steps that aren’t required for your target step
Maintains consistency: Validates that the deployment state remains coherent
Example selective execution scenarios:
Terminal window
# Provision only infrastructure resources
aspiredoprovision-infra
# Deploy only a specific service after code changes
aspiredodeploy-apiservice
# Run database migrations without full redeployment
The pipeline system is designed to maximize deployment performance through intelligent parallel execution while maintaining correctness and reliability.
Concurrency analysis and optimization:
The system performs sophisticated dependency analysis to identify and leverage opportunities for parallelization:
Independent operations: Steps with no dependencies on each other execute simultaneously, fully utilizing available system resources
Resource grouping: Related operations (such as multiple image builds) are coordinated to use shared resources efficiently
Critical path optimization: The system identifies the longest dependency chain and optimizes execution to minimize total deployment time
Resource-aware scheduling: CPU-intensive, I/O-intensive, and network operations are balanced to avoid resource contention
Real-world performance benefits:
A typical web application deployment demonstrates the effectiveness of pipeline parallelization:
Pipeline execution delivers optimal performance: 5-7 minutes total
Infrastructure provisioning (parallel): 3 minutes (limited by slowest resource)
Image building (parallel): 2 minutes (limited by slowest build)
CPU-intensive operations (container image building): Fully utilize available build capacity across multiple cores
I/O-intensive operations (image pushing, file uploads): Execute concurrently with appropriate rate limiting to avoid overwhelming network resources
Cloud API operations (resource provisioning): Run in parallel while respecting cloud provider rate limits and quotas
Failure handling and resilience:
The pipeline system provides robust failure handling during parallel execution:
Immediate failure detection: Failed steps are identified and reported quickly without waiting for unrelated operations to complete
Smart dependency cascade prevention: When a step fails, only its dependent steps are cancelled, allowing unrelated operations to continue
Partial success preservation: Successfully completed steps maintain their state and don’t need to be repeated during retry operations
Error isolation: Failures in one part of the pipeline are contained and don’t affect independent operations
The system maintains comprehensive logging and state information to support efficient debugging and recovery, ensuring that developers can quickly identify and resolve issues while preserving all successful work.
The aspire do command is the primary interface for interacting with the pipeline system. It provides fine-grained control over pipeline execution, allowing you to run specific steps, debug issues, and optimize deployment workflows.
Before executing pipeline steps, you can discover what steps would run for a given command using the --list-steps flag. Every pipeline command (aspire deploy, aspire publish, aspire destroy, and aspire do) accepts it:
Aspire CLI — Discover pipeline steps
aspiredeploy--list-steps
Example output:
Output
1. parameter-prompt
└─ No dependencies
2. provision-redis-infra
├─ Depends on: parameter-prompt
└─ Tags: provision-infra
3. build-webapi
├─ Depends on: parameter-prompt
└─ Tags: build-compute
4. deploy-webapi
├─ Depends on: provision-redis-infra, build-webapi
└─ Tags: deploy-compute
This lists the pipeline steps that would be executed by the chosen command, in execution order, without running them. Each entry shows the step’s position, the steps it depends on, and any tags it carries. Pair --list-steps with the command you intend to run (for example, aspire publish --list-steps or aspire do build --list-steps) to see exactly which steps a given invocation would trigger.
The pipeline system allows you to add custom steps to handle application-specific deployment requirements. You can add steps at two levels: application-level steps and resource-level steps.
Some steps, such as provision-{name}-containerapp for a resource configured with PublishAsAzureContainerAppJob(), are created by deployment targets that are only materialized while the before-start step runs. You can still reference these steps in dependsOn or requiredBy. When the AppHost starts, Aspire validates references only for before-start and the steps it depends on, so a step outside that set can depend on a step that doesn’t exist yet. When you publish, deploy, or run a specific step, Aspire validates every step’s references before running anything, and by then the dependency resolves and orders correctly.
A step that participates in before-start that references an unknown step still fails with an unknown step error.
If you’re deploying to testing, staging, production, or other environments, you might want to take different deployment actions in each case. You can use the pipeline context to create environment-specific pipeline steps:
Multi-environment deployment
var builder =DistributedApplication.CreateBuilder(args);
If you want to ensure a database is populated as part of your deployment, you can create a step that integrates database migrations into the deployment pipeline:
Database migrations step
var builder =DistributedApplication.CreateBuilder(args);
var database =builder.AddPostgres("db");
// Add migration step that runs after database is provisioned
Aspire 13.0 replaces the publishing callback system with the more flexible pipeline system. If you’re upgrading from Aspire 9.x, you’ll need to migrate your code.
Follow these steps to replace your Aspire 9.x publishing code with Aspire 13.x pipelines:
Identify publishing callbacks in your code that use WithPublishingCallback.
Convert callbacks to pipeline steps using WithPipelineStepFactory or builder.Pipeline.AddStep.
Update dependencies with parameters or properties. When using builder.Pipeline.AddStep, configure dependencies with the dependsOn / requiredBy parameters. When creating PipelineStep instances directly, use the DependsOn and RequiredBySteps properties.
Test the migration using aspire deploy --list-steps and aspire deploy.