> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usebruno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using with Bruno CLI

## Pre-requisites

Add the vault connection configuration to the collection's **secrets.json** file (create one if it doesn't exist).
You can use environment variables in the configuration to avoid hardcoding sensitive information.

This is the only additional configuration required to use the vault secrets in the collection using the CLI.

<br />

## Usage

There are 3 different CLI configurations that can be used.

#### Vault server with token authentication

```json filename="secrets.json" theme={null}
{
  "type": "vault",
  "cli": {
    "type": "vault-server",
    "vaultServerConfig": {
      "url": "http://localhost:8200",
      "namespace": "bruno",
      "auth": {
        "method": "token",
        "token": "{{authToken}}"
      }
    }
  },
  "data": [
    {
      "environment": "Prod",
      "secrets": [
        {
          "name": "db",
          "path": "secret/db",
          "enabled": true
        }
      ]
    }
  ]
}
```

Corresponding CLI command:

```bash copy theme={null}
bru run --env Prod --env-var authToken=your-vault-token
```

<br />

#### Vault server with appRole authentication

```json filename="secrets.json" theme={null}
{
  "type": "vault",
  "cli": {
    "type": "vault-server",
    "vaultServerConfig": {
      "url": "http://localhost:8200",
      "namespace": "bruno",
      "auth": {
        "method": "app_role",
        "appRole": {
          "role": "bruno",
          "roleId": "{{roleId}}",
          "secretId": "{{secretId}}"
        }
      }
    }
  },
  "data": [
    {
      "environment": "Prod",
      "secrets": [
        {
          "name": "db",
          "path": "secret/db",
          "enabled": true
        }
      ]
    }
  ]
}
```

Corresponding CLI command:

```bash copy theme={null}
bru run --env Prod --env-var roleId=your-role-id --env-var secretId=your-secret-id
```

<br />

#### Vault cloud with client credentials authentication

```json filename="secrets.json" theme={null}
{
  "type": "vault",
  "cli": {
    "type": "vault-cloud",
    "vaultCloudConfig": {
      "auth": {
        "method": "client-credentials",
        "clientCredentials": {
          "tokenEndpoint": "{{tokenEndpoint}}",
          "secretsEndPoint": "{{secretsEndpoint}}",
          "clientId": "{{clientId}}",
          "clientSecret": "{{clientSecret}}"
        }
      },
      "project": {
        "name": "{{projectName}}",
        "projectId": "{{projectId}}",
        "organizationId": "{{organizationId}}"
      }
    }
  },
  "data": [
    {
      "environment": "Prod",
      "secrets": [
        {
          "name": "db",
          "path": "secret/db",
          "enabled": true
        }
      ]
    }
  ]
}
```

Corresponding CLI command:

```bash copy theme={null}
bru run --env Prod --env-var tokenEndpoint=your-token-endpoint --env-var secretsEndpoint=your-secrets-endpoint --env-var clientId=your-client-id --env-var clientSecret=your-client-secret --env-var projectName=your-project-name --env-var projectId=your-project-id --env-var organizationId=your-organization-id
```
