Skip to content

Support selective resource deployment with aspire deploy --resource <name> #16166

@spboyer

Description

@spboyer

Problem

When working with multi-service applications, aspire deploy redeploys the entire application even when only a single service has changed. For inner-loop speed during active development against a deployed environment, developers need the ability to selectively deploy individual resources without re-running the full pipeline.

Current State

The pipeline step system already generates per-resource steps (e.g., build-<resource>, push-<resource>), visible via aspire do --list-steps. However, there is no CLI-level filter to target a single resource — aspire deploy always executes the full pipeline for all resources.

Proposed Experience

# Deploy only the "api" resource (build + push + deploy for just that resource)
aspire deploy --resource api

# Build only the "api" resource
aspire do build-api

# Deploy multiple specific resources
aspire deploy --resource api --resource worker

The --resource filter would:

  1. Resolve the named resource(s) from the application model
  2. Execute only the pipeline steps relevant to those resources (and their dependencies)
  3. Skip steps for unaffected resources
  4. Still run shared prerequisite steps (auth validation, parameter resolution)

Why This Matters

  • Inner-loop speed — Redeploying a 10-service app for a one-line change in one service is too slow
  • CI/CD efficiency — Monorepo pipelines can deploy only changed services
  • Cost — Avoid unnecessary container image builds and pushes for unchanged services
  • Parity with azd — Azure Developer CLI supports azd deploy --service <name> for selective deployment
  • Agent workflows — AI coding agents making targeted fixes should deploy only what they changed

Implementation Notes

The infrastructure for this largely exists:

  • WellKnownPipelineSteps already defines per-resource step patterns
  • PipelineStep has dependency tracking via DependsOn() / RequiredBy()
  • The pipeline executor could filter the step DAG to only include steps matching the target resource(s) and their transitive dependencies

The main work is:

  1. Add --resource option to DeployCommand and PipelineCommandBase
  2. Pass the filter to the AppHost pipeline executor
  3. Filter the step DAG before execution

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions