Skip to content

feat: Azure Key Vault vault provider #420

@pirminf

Description

@pirminf

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 secrets

Authentication

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 azure vault in this repo currently uses local_encryption as a temporary workaround. Once this provider ships, the plan is to migrate existing secrets and switch type: azure.

Post-ship migration checklist

  1. Create a new vault definition with type: azure
  2. swamp vault put azure-kv MY_SECRET <value> → secret stored in Azure Key Vault
  3. Reference in a model: ${{ vault.get(azure-kv, MY_SECRET) }} → resolves correctly
  4. Migrate existing local_encryption/azure vault secrets to the new Azure KV vault

Metadata

Metadata

Assignees

Labels

externalAn issue raised by an external contributor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions