Configuration & Usage
Detailed configuration, credential resolution order, caching, and runtime behavior for the bx-azure-secrets module.
This guide covers effective settings, credential source precedence, local development, and operational behavior for bx-azure-secrets.
๐ง Configuration Sources
Each setting is resolved independently in this order:
this.azureinApplication.bx(per-application)Module settings in
boxlang.json(global)Azure environment variables /
DefaultAzureCredential
๐งฉ Application.bx (Per-App)
Use this.azure when each app needs isolated vault or identity behavior.
class {
this.name = "myApp"
this.azure = {
vaultUrl : "https://my-vault.vault.azure.net/",
tenantId : "",
clientId : "",
clientSecret : "",
cacheTTL : 300
}
}When this.azure is present, the module creates and reuses a dedicated SecretClient for that application.
๐ Global boxlang.json Settings
๐ฑ Environment Variable Fallback
Supported environment mappings:
vaultUrl
AZURE_KEY_VAULT_URL, fallback AZURE_KEYVAULT_URL
tenantId
AZURE_TENANT_ID
clientId
AZURE_CLIENT_ID
clientSecret
AZURE_CLIENT_SECRET
If explicit credentials are not configured, the module can also rely on Azure credential sources such as managed identity, workload identity, Azure CLI, or environment credentials through DefaultAzureCredential.
๐ Settings Reference
vaultUrl
string
""
Azure Key Vault URL required for secret resolution
tenantId
string
""
Optional Azure tenant id for service principal authentication
clientId
string
""
Optional application client id or managed identity client id
clientSecret
string
""
Optional Azure client secret
cacheTTL
numeric
300
Cache time-to-live in seconds
๐ Usage Examples
Resolve a secret directly:
Resolve with a fallback value:
Use in datasource config:
๐ง Caching Behavior
Cache key format is
vaultUrl:secretNameSuccessful secret fetches are cached in-memory
Expired entries are refreshed on next access
Set
cacheTTLto0for effectively no cache reuse
๐ Client Lifecycle
Per-app client: Used when
this.azureexistsGlobal client: Used when module settings provide vault-based config
Default credential client: Used when relying only on Azure environment variables or credential chain defaults
Per-app clients are released on application shutdown, and all clients are closed or dereferenced on module/runtime shutdown.
๐งช Local Development with Azure CLI
Authenticate with Azure CLI and set a test secret:
Minimal module settings:
๐จ Troubleshooting
Secret returns
null: verifyvaultUrlis resolved and the secret exists in the target Key VaultLicense errors: confirm
bx-plusis installed and licensed; for local testing, setBX_AZURE_DEV=truePermission errors: ensure the runtime identity can perform Key Vault secret reads
Wrong module settings key: use
bxazure-secretsundermodulesinboxlang.json
Last updated
Was this helpful?
