# BitwardenSecretManagerResource

- Module: [CommunityToolkit.Aspire.Hosting.Bitwarden.SecretManager](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager.md)
- Version: `13.5.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1)

Represents a Bitwarden Secrets Manager project and secret graph.

## Definition

```typescript
interface BitwardenSecretManagerResource
  extends IResource,
    IResourceWithWaitSupport {
  addSecret(name: string): BitwardenSecretResource;
  addSecretWithRemoteName(
      name: string,
      remoteName: string): BitwardenSecretResource;
  getSecret(name: string): BitwardenSecretResource;
  getSecretById(
      name: string,
      secretId: guid): BitwardenSecretResource;
  getSecretWithRemoteName(
      name: string,
      remoteName: string): BitwardenSecretResource;
  withApiUrl(apiUrl: string): BitwardenSecretManagerResource;
  withApiUrlFromExternalService(server: ExternalServiceResource): BitwardenSecretManagerResource;
  withApiUrlFromParameter(apiUrl: ParameterResource): BitwardenSecretManagerResource;
  withAuthCacheDirectory(authCacheDirectory: string): BitwardenSecretManagerResource;
  withCacheFile(cacheFile: string): BitwardenSecretManagerResource;
  withIdentityUrl(identityUrl: string): BitwardenSecretManagerResource;
  withIdentityUrlFromExternalService(server: ExternalServiceResource): BitwardenSecretManagerResource;
  withIdentityUrlFromParameter(identityUrl: ParameterResource): BitwardenSecretManagerResource;
}
```

## Methods

- [addSecret](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/addsecret.md) -- `method` -- Adds a managed Bitwarden secret whose local and remote names are the same. The secret value is resolved from configuration key `Parameters:{parentName}-{name}`.
    ```typescript
  addSecret(name: string): BitwardenSecretResource
  ```
- [addSecretWithRemoteName](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/addsecretwithremotename.md) -- `method` -- Adds a managed Bitwarden secret with distinct Aspire and remote names. The secret value is resolved from configuration key `Parameters:{parentName}-{name}`.
    ```typescript
  addSecretWithRemoteName(name: string, remoteName: string): BitwardenSecretResource
  ```
- [getSecret](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/getsecret.md) -- `method` -- Gets or creates a Bitwarden secret reference whose Aspire and remote names are the same. The secret must already exist in Bitwarden; use `AddSecret` if Aspire should own and write the secret value.
    ```typescript
  getSecret(name: string): BitwardenSecretResource
  ```
- [getSecretById](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/getsecretbyid.md) -- `method` -- Gets or creates a Bitwarden secret reference by secret identifier. Use this when multiple secrets share the same name and the identifier is the only unambiguous key. The secret must already exist in Bitwarden; use `AddSecret` if Aspire should own and write the secret value.
    ```typescript
  getSecretById(name: string, secretId: guid): BitwardenSecretResource
  ```
- [getSecretWithRemoteName](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/getsecretwithremotename.md) -- `method` -- Gets or creates a Bitwarden secret reference with distinct Aspire and remote names. The secret must already exist in Bitwarden; use `AddSecret` if Aspire should own and write the secret value.
    ```typescript
  getSecretWithRemoteName(name: string, remoteName: string): BitwardenSecretResource
  ```
- [withApiUrl](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/withapiurl.md) -- `method` -- Overrides the Bitwarden API URL.
    ```typescript
  withApiUrl(apiUrl: string): BitwardenSecretManagerResource
  ```
- [withApiUrlFromExternalService](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/withapiurlfromexternalservice.md) -- `method` -- Overrides the Bitwarden API URL using an external service resource. The Bitwarden resource will wait for the external service before authenticating.
    ```typescript
  withApiUrlFromExternalService(server: ExternalServiceResource): BitwardenSecretManagerResource
  ```
- [withApiUrlFromParameter](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/withapiurlfromparameter.md) -- `method` -- Overrides the Bitwarden API URL using a parameter.
    ```typescript
  withApiUrlFromParameter(apiUrl: ParameterResource): BitwardenSecretManagerResource
  ```
- [withAuthCacheDirectory](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/withauthcachedirectory.md) -- `method` -- Overrides the AppHost auth cache directory (Bitwarden SDK auth session used by the AppHost reconciler). Defaults to the Aspire store when not set. Override to reuse a cached auth session across CI runs. To configure the auth cache directory inside the deployed app, use `WithBitwardenAuthCacheDirectory``1`.
    ```typescript
  withAuthCacheDirectory(authCacheDirectory: string): BitwardenSecretManagerResource
  ```
- [withCacheFile](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/withcachefile.md) -- `method` -- Overrides the AppHost cache file path (integration bookkeeping: Bitwarden project ID, secret ID mappings). Defaults to `.bitwarden/{resourceName}.{environment}.json` relative to the AppHost directory. Override to share the cache across multiple AppHost projects, or to store it in a CI cache directory.
    ```typescript
  withCacheFile(cacheFile: string): BitwardenSecretManagerResource
  ```
- [withIdentityUrl](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/withidentityurl.md) -- `method` -- Overrides the Bitwarden identity URL.
    ```typescript
  withIdentityUrl(identityUrl: string): BitwardenSecretManagerResource
  ```
- [withIdentityUrlFromExternalService](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/withidentityurlfromexternalservice.md) -- `method` -- Overrides the Bitwarden identity URL using an external service resource. The Bitwarden resource will wait for the external service before authenticating.
    ```typescript
  withIdentityUrlFromExternalService(server: ExternalServiceResource): BitwardenSecretManagerResource
  ```
- [withIdentityUrlFromParameter](/reference/api/typescript/communitytoolkit.aspire.hosting.bitwarden.secretmanager/bitwardensecretmanagerresource/withidentityurlfromparameter.md) -- `method` -- Overrides the Bitwarden identity URL using a parameter.
    ```typescript
  withIdentityUrlFromParameter(identityUrl: ParameterResource): BitwardenSecretManagerResource
  ```
