Skip to content

Vault CLI ignoring enviroment variable VAULT_ADDR in Windows Powershell #29549

Open
@huttsMichael

Description

Describe the bug
Vault CLI does not seem to use the environment variable $VAULT_ADDR within Powershell on Windows.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a brand new instance of Windows with the Vault CLI binary
  2. Set the enviroment variable: set VAULT_ADDR="https://OUR_VAULT_IP:8200"
  3. Run any vault command: vault status
  4. Vault CLI defaults to 127.0.0.1 and does not attempt to connect to the external IP

Expected behavior
Vault CLI connects to the IP set without any issues

Environment:

  • Vault Server Version (retrieve with vault status): N/A
  • Vault CLI Version (retrieve with vault version): Vault v1.18.4 (503be62), built 2025-01-29T13:57:54Z
  • Server Operating System/Architecture: N/A

Additional context
There are no existing config files or anything when testing, I've confirmed this behavior on a brand new setup. Here is the process in full for reference

PS C:\...\vault_1.18.4_windows_amd64> .\vault.exe login -address="https://EXAMPLE:8200" -namespace="root" token="EXAMPLE"

Success! You are now authenticated. The token information displayed below is already stored in the token helper. You do NOT need to run "vault login" again. Future Vault requests will automatically use this token.

PS C:\...\vault_1.18.4_windows_amd64> set VAULT_ADDR="https://EXAMPLE:8200"

PS C:\...\vault_1.18.4_windows_amd64> $VAULT_ADDR
https://EXAMPLE:8200

PS C:\...\vault_1.18.4_windows_amd64> .\vault.exe status
WARNING! VAULT_ADDR and -address unset. Defaulting to https://127.0.0.1:8200.
Error checking seal status: Get "https://127.0.0.1:8200/v1/sys/seal-status": dial tcp 127.0.0.1:8200: connectex: No connection could be made because the target machine actively refused it.

To be clear everything works fine if you supply -address manually everytime. This is purely an issue with the environment variable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    coreIssues and Pull-Requests specific to Vault Core

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions