# aspire secret command

## Name

`aspire secret` - Manage AppHost user secrets.

## Synopsis

```bash title="Aspire CLI"
aspire secret [command] [options]
```

## Description

The `aspire secret` command manages user secrets for an Aspire AppHost project. User secrets provide a safe way to store sensitive configuration values—such as passwords, API keys, and connection strings—outside of your project files during local development.

Aspire uses user secrets to persist values that resources need across restarts, such as auto-generated passwords for database containers. When you add a persistent resource that requires a password, Aspire automatically initializes user secrets for the AppHost and saves the generated password. On subsequent runs, the saved password is reused so that the resource retains its state.

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

## Options

The following options are available:

- **`--apphost <apphost>`**

  The path to the Aspire AppHost project file.

- <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" />

## Commands

The following commands are available:

| Command                                                        | Function                      |
| -------------------------------------------------------------- | ----------------------------- |
| [`aspire secret set <key> <value>`](../aspire-secret-set/)     | Set a secret value.           |
| [`aspire secret get <key>`](../aspire-secret-get/)             | Get a secret value.           |
| [`aspire secret list`](../aspire-secret-list/)                 | List all secrets.             |
| [`aspire secret delete <key>`](../aspire-secret-delete/)       | Delete a secret.              |
| [`aspire secret path`](../aspire-secret-path/)                 | Show the secrets file path.   |

## Examples

- Set a secret value for the current AppHost:

  ```bash title="Aspire CLI"
  aspire secret set Parameters:postgres-password MySecretPassword123
  ```

- List all secrets for a specific AppHost:

  ```bash title="Aspire CLI"
  aspire secret list --apphost ./src/MyApp.AppHost/MyApp.AppHost.csproj
  ```

- Get the value of a specific secret:

  ```bash title="Aspire CLI"
  aspire secret get Parameters:postgres-password
  ```

- Show the path to the secrets file:

  ```bash title="Aspire CLI"
  aspire secret path
  ```