コンテンツにスキップ
Docs Try Aspire
Docs Try

aspire destroy command

このコンテンツはまだ日本語訳がありません。

aspire destroy - Tear down a previously deployed Aspire environment.

Aspire CLI
aspire destroy [options] [[--] <additional arguments>...]

The aspire destroy command tears down an environment that was previously deployed with aspire deploy. It completes the deployment lifecycle: aspire publishaspire deployaspire destroy.

The Aspire CLI uses the following logic, in order, to determine which AppHost project to process:

  • The --apphost option.

    This option specifies the path to the Aspire AppHost project file to process.

  • The rooted aspire.config.json file.

    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.json files 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 down using persisted deployment state.
  • Kubernetes (Helm): Confirms, then runs helm uninstall using 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.

When you use --non-interactive, also pass --yes to explicitly confirm the destructive operation. Omitting --yes when using --non-interactive is an error:

Aspire CLI
aspire destroy --non-interactive --yes

If you specify --non-interactive without --yes, the command exits with an error:

Output
The destroy command requires --yes when the --non-interactive option is specified.

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:

Output
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.

Output
12:51:48 (destroy-compose-compose) → Running compose down for compose using Docker
12: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
------------------------------------------------------------

The following options are available:

  • -y, --yes

    Skip 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 destroy from 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-path

    The output path containing deployment artifacts to destroy. Defaults to the aspire-output folder relative to the AppHost.

  • --pipeline-log-level

    Set the minimum log level for pipeline logging. Valid values are: trace, debug, information, warning, error, critical. The default is information.

  • -e, --environment

    The environment to use for the operation. The default is Production.

  • --include-exception-details

    Include exception details (stack traces) in pipeline logs.

  • --list-steps

    List 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-build

    Don’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, --help

    Prints 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-interactive

    Run the command in non-interactive mode, disabling all interactive prompts and spinners.

  • --nologo

    Suppress the startup banner and telemetry notice.

  • --banner

    Display the animated Aspire CLI welcome banner.

  • --wait-for-debugger

    Wait for a debugger to attach before running a command.

  • 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'