# aspire destroy command

## Name

`aspire destroy` - Tear down a previously deployed Aspire environment.

## Synopsis

```bash title="Aspire CLI"
aspire destroy [options] [[--] <additional arguments>...]
```

## 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`.

<Include relativePath="reference/cli/includes/project-search-logic-description.md" />

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.

:::caution
The `aspire destroy` command permanently removes deployed resources. For Azure environments, this deletes the entire resource group and all resources within it. This action cannot be undone.
:::

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

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

```bash title="Aspire CLI"
aspire destroy --non-interactive --yes
```

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

```text title="Output"
The destroy command requires --yes when the --non-interactive option is specified.
```

## 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`:

```text title="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.

```text title="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
------------------------------------------------------------
```

## Options

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.

- <Include relativePath="reference/cli/includes/option-project.md" />

- **`-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.

- <Include relativePath="reference/cli/includes/option-list-steps.md" />

- <Include relativePath="reference/cli/includes/option-no-build.md" />

- <Include relativePath="reference/cli/includes/option-help.md" />

- <Include relativePath="reference/cli/includes/option-log-level.md" />

- <Include relativePath="reference/cli/includes/option-non-interactive.md" />

- <Include relativePath="reference/cli/includes/option-nologo.md" />

- <Include relativePath="reference/cli/includes/option-banner.md" />

- <Include relativePath="reference/cli/includes/option-wait.md" />

## Examples

- Search the current directory structure for AppHost projects and destroy the deployed environment:

  ```bash title="Aspire CLI"
  aspire destroy
  ```

- Destroy the deployed environment without prompting for confirmation:

  ```bash title="Aspire CLI"
  aspire destroy --yes
  ```

- Destroy a specific AppHost project's deployed environment:

  ```bash title="Aspire CLI"
  aspire destroy --apphost './projects/apphost/orchestration.AppHost.csproj'
  ```

- Destroy a specific environment (non-default) without prompting:

  ```bash title="Aspire CLI"
  aspire destroy --environment Staging --yes
  ```

- Destroy in a CI/CD pipeline or automation script (non-interactive, requires `--yes`):

  ```bash title="Aspire CLI"
  aspire destroy --non-interactive --yes
  ```

- Destroy using a specific output path:

  ```bash title="Aspire CLI"
  aspire destroy --output-path './aspire-output'
  ```

## See also

- [aspire deploy](/reference/cli/commands/aspire-deploy/)
- [aspire publish](/reference/cli/commands/aspire-publish/)