Configure custom environment variables for Agent Proxy
OIDC and JWT-SVID dynamic claims can include values from environment variables present in Agent Proxy or Aembit CLI process environments. By default, Agent Proxy and Aembit CLI capture no custom variables. To enable capture, you must set an allowlist and make sure the variables are present in the process environment.
This page describes how to inject custom variables and configure the allowlist on each supported platform.
How capture works
Section titled “How capture works”A custom environment variable becomes available to dynamic claims only when both of the following are true:
- The variable is present in the Agent Proxy or Aembit CLI process environment.
- The variable name appears in
AEMBIT_ENV_VAR_ALLOWLIST, a comma-separated list of permitted variable names.
If a Credential Provider references a missing variable (absent from the process environment or the allowlist),
Agent Proxy logs a warning (requested env variable <name> is not in allow list) and omits the variable from
the credential request.
The credential request still proceeds, but without that claim value.
A small set of always-available variables (such as K8S_POD_NAME and AEMBIT_RESOURCE_SET_ID) bypass the allowlist
requirement.
See Always-available variables.
Set the allowlist
Section titled “Set the allowlist”Set AEMBIT_ENV_VAR_ALLOWLIST to a
comma-separated list of variable names that you want Aembit to capture.
AEMBIT_ENV_VAR_ALLOWLIST=CORPORATE_APP_ID,WEBSITE_HOSTNAME,AWS_LAMBDA_FUNCTION_NAMEThe allowlist must live in the same process environment as Agent Proxy or Aembit CLI itself. Where you set it depends on how you deploy each one:
- Linux VM: pass
AEMBIT_ENV_VAR_ALLOWLIST=<value>to Agent Proxy installer, or add it to asystemddrop-in for Agent Proxy service - Windows VM: pass
AEMBIT_ENV_VAR_ALLOWLIST=<value>as an MSI property tomsiexec, or set it as a machine-level environment variable - Kubernetes: set it under
agentProxy.envin your Helm values - Aembit CLI: export it in the shell that runs Aembit CLI
For the exact commands on each platform, see the following Configure by deployment section.
Aembit matches variable names exactly and treats them as case-sensitive.
Configure by deployment
Section titled “Configure by deployment”Choose the tab for your deployment platform.
On Linux, Agent Proxy runs as a systemd service.
Custom environment variables must live in the service’s environment, which means they go in a systemd
drop-in file.
Agent Proxy installer doesn’t accept custom variables directly, but it does accept AEMBIT_ENV_VAR_ALLOWLIST
as an installer environment variable.
You have three options for getting your custom variables and the allowlist into the service environment. The first option is the recommended path for most deployments.
Option 1: systemctl edit drop-in Recommended
Section titled “Option 1: systemctl edit drop-in ”Use systemctl edit to create a drop-in override that systemd applies on top of the shipped unit file.
-
Install Agent Proxy normally (without custom variables):
Terminal window sudo AEMBIT_AGENT_CONTROLLER=http://<agent-controller-host>:5000 ./install -
Open a drop-in editor for Agent Proxy service:
Terminal window sudo systemctl edit aembit_agent_proxy -
Add an
[Service]block with the allowlist and your custom variables, then save and exit:[Service]Environment="AEMBIT_ENV_VAR_ALLOWLIST=CORPORATE_APP_ID,WEBSITE_HOSTNAME"Environment="CORPORATE_APP_ID=app-1234"Environment="WEBSITE_HOSTNAME=example.com" -
Restart Agent Proxy service so it picks up the updated environment:
Terminal window sudo systemctl restart aembit_agent_proxy -
Confirm the running service has the variables you expect:
Terminal window systemctl show aembit_agent_proxy --property=Environment
systemctl edit writes the override to /etc/systemd/system/aembit_agent_proxy.service.d/override.conf,
which survives package upgrades.
Option 2: manually managed drop-in file
Section titled “Option 2: manually managed drop-in file”If you provision VMs with Ansible, Chef, Puppet, or another configuration-management tool, write a drop-in file directly so the tool can manage it as a regular file resource.
-
Create the drop-in directory:
Terminal window sudo mkdir -p /etc/systemd/system/aembit_agent_proxy.service.d -
Write a drop-in file (any
.conffilename works) containing your[Service]overrides:/etc/systemd/system/aembit_agent_proxy.service.d/aembit-env.conf [Service]Environment="AEMBIT_ENV_VAR_ALLOWLIST=CORPORATE_APP_ID,WEBSITE_HOSTNAME"Environment="CORPORATE_APP_ID=app-1234"Environment="WEBSITE_HOSTNAME=example.com" -
Reload
systemdand restart Agent Proxy service:Terminal window sudo systemctl daemon-reloadsudo systemctl restart aembit_agent_proxy
Option 3: pass the allowlist at install time, set custom variables in a drop-in
Section titled “Option 3: pass the allowlist at install time, set custom variables in a drop-in”Agent Proxy installer accepts AEMBIT_ENV_VAR_ALLOWLIST as an installer environment variable, so you can
configure the allowlist at install time and put your custom variables in a drop-in afterward.
-
Install Agent Proxy with
AEMBIT_ENV_VAR_ALLOWLISTset:Terminal window sudo AEMBIT_AGENT_CONTROLLER=http://<agent-controller-host>:5000 \AEMBIT_ENV_VAR_ALLOWLIST=CORPORATE_APP_ID,WEBSITE_HOSTNAME \./install -
Create a drop-in for your custom variables (using either of the preceding options):
[Service]Environment="CORPORATE_APP_ID=app-1234"Environment="WEBSITE_HOSTNAME=example.com" -
Restart Agent Proxy service:
Terminal window sudo systemctl restart aembit_agent_proxy
On Windows, Agent Proxy runs as a Windows service.
Set custom variables as machine-level environment variables so the service inherits them on start.
Agent Proxy MSI installer accepts AEMBIT_ENV_VAR_ALLOWLIST as an MSI property at install time.
-
Install Agent Proxy with
AEMBIT_ENV_VAR_ALLOWLISTset as an MSI property:Terminal window msiexec /i aembit_agent_proxy_windows_amd64_<version>.msi /l*v install.log ^AEMBIT_ENV_VAR_ALLOWLIST=CORPORATE_APP_ID,WEBSITE_HOSTNAME -
In an elevated PowerShell session, set each custom variable at the machine scope:
Terminal window [Environment]::SetEnvironmentVariable('CORPORATE_APP_ID', 'app-1234', 'Machine')[Environment]::SetEnvironmentVariable('WEBSITE_HOSTNAME', 'example.com', 'Machine') -
Restart Agent Proxy service so it picks up the new machine-level variables:
Terminal window Restart-Service aembit_agent_proxy -
Confirm the variables are visible to the service:
Terminal window [Environment]::GetEnvironmentVariable('CORPORATE_APP_ID', 'Machine')[Environment]::GetEnvironmentVariable('WEBSITE_HOSTNAME', 'Machine')
To remove a custom variable, set it to $null at the machine scope and restart the service:
[Environment]::SetEnvironmentVariable('CORPORATE_APP_ID', $null, 'Machine')Restart-Service aembit_agent_proxyYou can also set or change AEMBIT_ENV_VAR_ALLOWLIST after install time using the same
SetEnvironmentVariable(..., 'Machine') approach.
In a Kubernetes deployment, set custom variables on Agent Proxy container through the Helm chart’s
agentProxy.env block, then reference them in AEMBIT_ENV_VAR_ALLOWLIST.
-
Add custom variables and the allowlist to your Helm values:
agentProxy:env:AEMBIT_ENV_VAR_ALLOWLIST: "CORPORATE_APP_ID,WEBSITE_HOSTNAME"CORPORATE_APP_ID: "app-1234"WEBSITE_HOSTNAME: "example.com" -
Apply the values to your release:
Terminal window helm upgrade --install aembit-edge aembit/aembit-edge -f values.yaml -
Confirm the variables are visible in the running pod:
Terminal window kubectl exec -it <agent-proxy-pod> -- env | grep -E '^(CORPORATE_APP_ID|WEBSITE_HOSTNAME|AEMBIT_ENV_VAR_ALLOWLIST)='
The Aembit Helm chart automatically injects the always-available variables
K8S_POD_NAME and K8S_NAMESPACE from the Kubernetes downward API (via fieldRef: metadata.name and
fieldRef: metadata.namespace in the chart’s webhook template), so you don’t need to set them yourself.
You can set KUBERNETES_PROVIDER_ID
under agentProxy.env to identify the cluster.
Aembit CLI captures variables that are present in its own process environment. Export the variables and the allowlist in the same shell that runs Aembit CLI:
export AEMBIT_ENV_VAR_ALLOWLIST=CORPORATE_APP_ID,WEBSITE_HOSTNAMEexport CORPORATE_APP_ID=app-1234export WEBSITE_HOSTNAME=example.com
aembit <command>For persistent configuration, set these variables in your shell profile (Linux) or as user/system environment variables (Windows).
Verify Aembit captures a custom variable
Section titled “Verify Aembit captures a custom variable”After you configure a custom variable, verify that a dynamic claim can read it:
-
Add a temporary Custom Claim to an existing OIDC ID Token Credential Provider, for example:
- Claim Name:
test_custom_env - Value:
${os.environment.CORPORATE_APP_ID}
- Claim Name:
-
Trigger a credential request from a Client Workload.
-
Decode the issued token (for example, with jwt.io) and confirm the
test_custom_envclaim contains the expected value. -
Remove the temporary Custom Claim once you’ve confirmed capture works.
If the claim is empty, see Troubleshooting.
Always-available variables
Section titled “Always-available variables”Dynamic claims can read the following variables regardless of AEMBIT_ENV_VAR_ALLOWLIST,
provided each one exists in the process environment.
Reference them in dynamic claims with ${os.environment.<NAME>}, for example ${os.environment.CLIENT_WORKLOAD_ID}.
Kubernetes-only
Section titled “Kubernetes-only”Aembit populates these variables only on Kubernetes deployments:
| Variable | Typical source |
|---|---|
K8S_POD_NAME | Injected by the Aembit Helm chart |
K8S_NAMESPACE | Injected by the Aembit Helm chart |
KUBERNETES_PROVIDER_ID | Set by the customer in agentProxy.env |
All deployments
Section titled “All deployments”Aembit populates these variables on Linux Virtual Machines, Windows Virtual Machines, and Kubernetes:
| Variable | Typical source |
|---|---|
AEMBIT_RESOURCE_SET_ID | Set during install or in Helm values |
CLIENT_WORKLOAD_ID | Set per workload |
Behavior and scope
Section titled “Behavior and scope”Process boundary
Section titled “Process boundary”Aembit reads environment variables only from the Agent Proxy or Aembit CLI process environment. Variables set only in the Client Workload process aren’t visible to dynamic claims. Agent Proxy and Aembit CLI act as the boundary.
Supported platforms
Section titled “Supported platforms”Aembit captures custom environment variables on:
- Agent Proxy: Linux Virtual Machines, Windows Virtual Machines, and Kubernetes
- Aembit CLI: Linux and Windows Virtual Machines
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause | Resolution |
|---|---|---|
| Claim value is empty | Variable missing from the process environment | Confirm with systemctl show (Linux), [Environment]::GetEnvironmentVariable(..., 'Machine') (Windows), or kubectl exec ... env (K8s) |
Claim value is empty and Agent Proxy logs requested env variable <name> is not in allow list | Variable name not in AEMBIT_ENV_VAR_ALLOWLIST | Add the name to the allowlist and restart the service |
| Variable visible in shell but not in claim | Set in Client Workload process, not Agent Proxy/CLI process | Move the variable definition to Agent Proxy or Aembit CLI process environment |