-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Problem
In Azure-based repos, secrets are currently stored using local_encryption as a fallback. There is no native Azure vault backend, so ${{ vault.get(azure-kv, MY_SECRET) }} cannot resolve against Azure Key Vault. This blocks production use of swamp in Azure environments where secrets must live in Azure Key Vault for compliance and operational reasons.
Current workaround: The azure vault in this repo uses local_encryption as its backend (type: local_encryption), which defeats the purpose of having a named Azure vault.
Proposed Solution
Implement an azure vault provider that resolves secrets from Azure Key Vault, following the same VaultProvider interface pattern used by the existing aws provider.
Config schema
id: <uuid>
name: azure-kv
type: azure
config:
vault_url: https://<vault>.vault.azure.net/
tenant_id: <tenantId>
client_id: <clientId>
client_secret: <clientSecret>
secret_prefix: swamp/ # optional — namespace all swamp secretsAuthentication
Client credentials flow to https://vault.azure.net/.default — the same OAuth2 pattern already used in the Azure extension models in this ecosystem (@azure/workload, etc.).
API operations needed
| swamp operation | Azure Key Vault REST call |
|---|---|
get(key) |
GET https://{vault}.vault.azure.net/secrets/{prefix}{key}?api-version=7.4 |
put(key, value) |
PUT https://{vault}.vault.azure.net/secrets/{prefix}{key}?api-version=7.4 |
list() |
GET https://{vault}.vault.azure.net/secrets?api-version=7.4 (follow nextLink for pagination) |
CLI usage (once implemented)
# Store a secret
swamp vault put azure-kv MY_SECRET <value>
# Resolve in a workflow/model
${{ vault.get(azure-kv, MY_SECRET) }}Reference
The design/vaults.md doc in the swamp repo already contains an Azure provider skeleton and the exact config example above — the implementation should follow that spec. The aws provider is the reference implementation pattern to follow.
Alternatives Considered
- Use
local_encryption: Works locally but secrets are not stored in Azure Key Vault, defeating compliance requirements. - Wrap AZ CLI in a shell command: Violates the swamp model for vault integration; not reusable across repos.
Additional Context
- swamp version:
20260221.201206.0-sha.878e8dec - The
azurevault in this repo currently useslocal_encryptionas a temporary workaround. Once this provider ships, the plan is to migrate existing secrets and switchtype: azure.
Post-ship migration checklist
- Create a new vault definition with
type: azure swamp vault put azure-kv MY_SECRET <value>→ secret stored in Azure Key Vault- Reference in a model:
${{ vault.get(azure-kv, MY_SECRET) }}→ resolves correctly - Migrate existing
local_encryption/azurevault secrets to the new Azure KV vault