HashiCorp Vault Associate (003) exam dumps

HashiCorp Vault Associate (003) practice question 197 of 243

Vault Associate (003). Associate level, HashiCorp. Free question with the correct answer and a full explanation.

HashiCorp Vault Associate (003) Question 197

Single answer7c Configure environment variables

A platform engineer is troubleshooting why Vault CLI commands fail on a build server. Running vault status returns an error indicating it cannot connect to https://127.0.0.1:8200, but the Vault server is actually available at https://vault.prod.example.com:8200. The engineer also wants CLI output in JSON so scripts can parse responses consistently. Which environment variable configuration will address both requirements without changing every command?

  1. A

    Set VAULT_ADDR=https://vault.prod.example.com:8200 and VAULT_FORMAT=json in the shell environment

  2. B

    Set VAULT_SERVER=https://vault.prod.example.com:8200 and VAULT_OUTPUT=json in the shell environment

  3. C

    Set VAULT_ADDR=https://vault.prod.example.com:8200 and VAULT_TOKEN=json in the shell environment

  4. D

    Set VAULT_HOST=vault.prod.example.com and VAULT_PORT=8200 in the shell environment

Show answer and explanation

Correct answer: A

Explanation

The Vault CLI uses environment variables to avoid repeating connection and formatting flags on every command. By default, the CLI attempts to connect to https://127.0.0.1:8200 unless VAULT_ADDR is set or the -address flag is provided. For machine-readable output, VAULT_FORMAT=json is the correct environment variable. This is especially useful in CI/CD pipelines and build servers where consistent JSON output is needed for parsing. These behaviors are documented in the Vault CLI and environment variable documentation, and using environment variables in this way is a standard operational practice for Vault.

  • A. Correct.

    Correct. VAULT_ADDR tells the Vault CLI which server address to use instead of the default https://127.0.0.1:8200. VAULT_FORMAT=json sets the CLI output format to JSON for commands that support formatted output, which is a common best practice for automation and scripting.

  • B. Incorrect.

    Incorrect. VAULT_SERVER and VAULT_OUTPUT are not standard Vault CLI environment variables. A candidate might choose this because the names sound intuitive, but Vault expects VAULT_ADDR for the server address and VAULT_FORMAT for output formatting.

  • C. Incorrect.

    Incorrect. VAULT_ADDR is valid, but VAULT_TOKEN is used to provide an authentication token, not to control output format. This distractor targets confusion between commonly used Vault environment variables.

  • D. Incorrect.

    Incorrect. Vault CLI does not use VAULT_HOST and VAULT_PORT as separate environment variables for connection settings. The CLI expects a full URL in VAULT_ADDR, including scheme, host, and port.

Timed practice exam

Take a HashiCorp Vault Associate (003) practice test under exam conditions

70 questions in 60 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam