aspire destroy command
aspire destroy - Tear down a previously deployed Aspire environment.
Synopsis
Section titled “Synopsis”aspire destroy [options] [[--] <additional arguments>...]Description
Section titled “Description”The aspire destroy command tears down an environment that was previously deployed with aspire deploy. It completes the deployment lifecycle: aspire publish → aspire deploy → aspire destroy.
The Aspire CLI uses the following logic, in order, to determine which AppHost project to process:
-
The
--apphostoption.This option specifies the path to the Aspire AppHost project file to process.
-
The rooted
aspire.config.jsonfile.If the rooted config exists in the current directory, it’s used. If not, the CLI walks up the directory structure looking for it. If Aspire finds the rooted config, it uses the recorded AppHost information to determine which project to process. Legacy
.aspire/settings.jsonfiles are still read during migration. -
Searches the current directory and subdirectories.
Starting in the current directory, the CLI gathers all AppHost projects from that directory and below. If a single project is discovered, it’s automatically selected. If multiple projects are discovered, they’re printed to the terminal for the user to manually select one of the projects.
Once a project is selected, either automatically or manually, Aspire records that selection in the rooted configuration so later commands can reuse it.
Each compute environment implements its own destroy step with contextual confirmation:
- Azure (ACA/App Service): Discovers resources in the resource group via ARM, shows them to the user, confirms, then deletes the resource group.
- Docker Compose: Confirms, then runs
docker compose downusing persisted deployment state. - Kubernetes (Helm): Confirms, then runs
helm uninstallusing the persisted release name and namespace.
The AppHost and selected compute environment must provide a destroy pipeline step. If no destroy step is registered, the command fails without deleting resources.
Before performing the destroy operation, the command displays contextual information about what will be removed and prompts for confirmation. Use the --yes flag to skip the confirmation prompt in automated or non-interactive scenarios.
Non-interactive usage
Section titled “Non-interactive usage”When you use --non-interactive, also pass --yes to explicitly confirm the destructive operation. Omitting --yes when using --non-interactive is an error:
aspire destroy --non-interactive --yesIf you specify --non-interactive without --yes, the command exits with an error:
The destroy command requires --yes when the --non-interactive option is specified.Output
Section titled “Output”Before running the destroy pipeline, aspire destroy displays contextual information about the deployed resources or deployment state that the selected compute environment plans to remove, unless --yes is specified. For example, Docker Compose environments prompt before running docker compose down:
Shut down Docker Compose environment 'compose'? This will stop and remove all containers, networks, and volumes.Confirm: [y/N]:After confirmation, the command runs the destroy pipeline and prints a result summary. The exact step names depend on the selected compute environment.
12:51:48 (destroy-compose-compose) → Running compose down for compose using Docker12:51:49 (destroy-compose-compose) ✓ Compose shutdown complete for compose (Docker) (1.3s)12:51:49 (destroy) i [INF] Deployment state cleared: <deployment-state-path>\production.json
------------------------------------------------------------✅ 8/8 steps succeeded • Total time: 1.64s
Steps Summary: Step timeline: 0s 1.61s │───────┬──────┬─────┬───────│ 2.10ms ✓ validate-compute-environments │╴ │ 1.60s ✓ pipeline-execution │╶──────────────────────────╴│ 1.60s ✓ destroy-compose-compose │╶──────────────────────────╴│ 2.07ms ✓ destroy │ ╴│
✅ Pipeline succeeded 🗑️ Compose: compose------------------------------------------------------------Options
Section titled “Options”The following options are available:
-
-y, --yesSkip the confirmation prompt and proceed with the destroy operation without user interaction. Use this flag in CI/CD pipelines or scripted environments.
-
--Delimits arguments to
aspire destroyfrom arguments for the AppHost. All arguments after this delimiter are passed to the AppHost. -
--apphost <apphost>The path to the Aspire AppHost project file.
-
-o, --output-pathThe output path containing deployment artifacts to destroy. Defaults to the
aspire-outputfolder relative to the AppHost. -
--pipeline-log-levelSet the minimum log level for pipeline logging. Valid values are:
trace,debug,information,warning,error,critical. The default isinformation. -
-e, --environmentThe environment to use for the operation. The default is
Production. -
--include-exception-detailsInclude exception details (stack traces) in pipeline logs.
-
--list-stepsList the pipeline steps that would be executed, without running them. Useful for inspecting what a pipeline command will do before invoking it for real.
-
--no-buildDon’t build or restore the AppHost project before running the command. Use this when you’ve already built the AppHost (for example, in a CI step) and want to skip the implicit build.
-
-?, -h, --helpPrints help and usage documentation for the available commands and options.
-
-l, --log-level <Critical|Debug|Error|Information|None|Trace|Warning>Set the minimum log level for console output. Use this option to increase diagnostics while troubleshooting or reduce output in scripted runs.
-
--non-interactiveRun the command in non-interactive mode, disabling all interactive prompts and spinners.
-
--nologoSuppress the startup banner and telemetry notice.
-
--bannerDisplay the animated Aspire CLI welcome banner.
-
--wait-for-debuggerWait for a debugger to attach before running a command.
Examples
Section titled “Examples”-
Search the current directory structure for AppHost projects and destroy the deployed environment:
Aspire CLI aspire destroy -
Destroy the deployed environment without prompting for confirmation:
Aspire CLI aspire destroy --yes -
Destroy a specific AppHost project’s deployed environment:
Aspire CLI aspire destroy --apphost './projects/apphost/orchestration.AppHost.csproj' -
Destroy a specific environment (non-default) without prompting:
Aspire CLI aspire destroy --environment Staging --yes -
Destroy in a CI/CD pipeline or automation script (non-interactive, requires
--yes):Aspire CLI aspire destroy --non-interactive --yes -
Destroy using a specific output path:
Aspire CLI aspire destroy --output-path './aspire-output'