Are you an LLM? You can read better optimized documentation at /docs/agent-guard/running-agents/pass-credentials.md for this page in Markdown format
Pass credentials into the microVM
By default the microVM gets nothing from your host environment beyond what the agent itself needs to authenticate (its own API key or OAuth token) and the proxy settings inherited from your shell. Every other credential has to be passed in explicitly.
Two mechanisms exist: --pass-env for arbitrary environment variables, and --pass-cloud-creds for cloud-provider credentials that often involve files as well as variables.
Both mechanisms deliver credentials over vsock and stage them on tmpfs inside the microVM. They are never written to disk on the host, never persisted in the microVM overlay, and discarded when the microVM exits.
Pass an environment variable
--pass-env <KEY> passes a single host environment variable into the microVM. The flag is repeatable.
To give the agent GitHub CLI access:
bash
export GH_TOKEN=$(gh auth token)
agentguard run claude-code --pass-env GH_TOKEN --workspace ~/projects/myappInside the microVM, gh picks up GH_TOKEN automatically and can open issues and pull requests on your behalf.
For private package registries:
bash
agentguard run claude-code \
--pass-env NPM_TOKEN \
--pass-env PIP_INDEX_URL \
--pass-env PIP_EXTRA_INDEX_URL \
--workspace ~/projects/myappFor service API keys, pass each one with its own flag:
bash
agentguard run claude-code \
--pass-env DATADOG_API_KEY \
--pass-env SENTRY_DSN \
--pass-env SLACK_BOT_TOKEN \
--workspace ~/projects/myappPass cloud provider credentials
--pass-cloud-creds <provider> passes only the variables and files needed by a named cloud provider. The flag is repeatable and accepts comma-separated values.
Valid providers: aws, gcp, azure, vault, kubernetes, all.
AWS
bash
agentguard run claude-code --pass-cloud-creds aws --workspace ~/projects/myappPasses AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_PROFILE, AWS_REGION, and AWS_DEFAULT_REGION. If AWS_SHARED_CREDENTIALS_FILE points to a file, the file is copied into the microVM at /run/creds/.cloud-creds/aws-credentials and the env var is rewritten to point at the new location.
GCP
bash
export GOOGLE_APPLICATION_CREDENTIALS=~/.config/gcloud/svc-account.json
agentguard run claude-code --pass-cloud-creds gcp --workspace ~/projects/myappThe service account key file is staged into the microVM and GOOGLE_APPLICATION_CREDENTIALS is rewritten to /run/creds/.cloud-creds/gcp-service-account.json. CLOUDSDK_CONFIG, GOOGLE_CLOUD_PROJECT, and GCLOUD_PROJECT are also passed when set.
Azure
bash
export AZURE_CLIENT_ID=... AZURE_CLIENT_SECRET=... AZURE_TENANT_ID=...
agentguard run claude-code --pass-cloud-creds azure --workspace ~/projects/myappPasses AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID, and AZURE_SUBSCRIPTION_ID.
Vault
bash
export VAULT_ADDR=https://vault.internal:8200
export VAULT_TOKEN=hvs.xxxxx
agentguard run claude-code --pass-cloud-creds vault --workspace ~/projects/myappPasses VAULT_ADDR, VAULT_TOKEN, and VAULT_NAMESPACE.
Kubernetes
bash
agentguard run claude-code --pass-cloud-creds kubernetes --workspace ~/projects/myappIf KUBECONFIG points to a file, the file is staged into the microVM and the env var is rewritten.
Combining providers
Use comma-separated values for multiple providers in one flag:
bash
agentguard run claude-code --pass-cloud-creds aws,gcp --workspace ~/projects/myappOr repeat the flag:
bash
agentguard run claude-code \
--pass-cloud-creds aws \
--pass-cloud-creds gcp \
--workspace ~/projects/myappPass every supported provider at once with all:
bash
agentguard run claude-code --pass-cloud-creds all --workspace ~/projects/myappCombining cloud credentials with other env vars
--pass-env and --pass-cloud-creds work together:
bash
export GH_TOKEN=$(gh auth token)
agentguard run claude-code \
--pass-cloud-creds aws \
--pass-env GH_TOKEN \
--pass-env CUSTOM_API_KEY \
--workspace ~/projects/myappOne-time credentials
For a credential needed only for a single run, set it inline rather than exporting it in your shell:
bash
GH_TOKEN=$(gh auth token) agentguard run claude-code --pass-env GH_TOKEN --workspace ~/projects/myappThe variable is read from the shell context for that one invocation and discarded when the microVM exits.
