TExcelTAD
Home › Azure & Google Cloud for AWS Users › Key Vault, Cloud KMS and Secret Manager

Key Vault, Cloud KMS and Secret Manager

AWS has two services here: KMS for encryption keys and Secrets Manager (or Parameter Store) for secrets. Google Cloud has the same split: Cloud KMS and Secret Manager. Azure puts keys, secrets and certificates in one service, Key Vault, with Managed HSM for dedicated hardware.

On AWS this is… AWS KMS (customer managed keys, key policies, envelope encryption) from KMS, Shield, WAF and GuardDuty, and AWS Secrets Manager.

Side by side

AWS Azure Google Cloud
Encryption keys KMS keys Key Vault keys (software or HSM-protected), Managed HSM Cloud KMS key rings → keys → versions (software, HSM, external via EKM)
Secrets Secrets Manager, SSM Parameter Store Key Vault secrets Secret Manager
TLS certificates ACM Key Vault certificates (with issuer integration and auto-renewal) Certificate Manager
Access control key policies + IAM Azure RBAC (Key Vault Secrets User, Key Vault Crypto User…) or legacy access policies IAM on key ring/key or on each secret (roles/secretmanager.secretAccessor, roles/cloudkms.cryptoKeyEncrypterDecrypter)
Deletion safety scheduled key deletion (7–30 days) soft delete (always on) + purge protection key versions scheduled for destruction (default 30 days); deleting a secret is immediate, with optional delayed destruction for secret versions
Customer-managed keys for services CMK on S3, EBS, RDS… customer-managed keys on Storage, Disks, SQL… CMEK on Cloud Storage, disks, Cloud SQL, BigQuery…
Unit of rotation key rotation (yearly or on demand) key rotation policy; new secret versions key rotation period; new secret versions

Key Vault notes:

  • Create vaults with the RBAC permission model (--enable-rbac-authorization true, the default in current CLI versions) rather than vault access policies, so access is managed like everything else in Azure.
  • Vault names are global DNS names (https://kv-shop-prod.vault.azure.net), 3–24 characters.
  • With purge protection on, a deleted vault or secret can be recovered during the retention period but not purged early by anyone, which also means you can't reuse the name until the period ends.

Google Cloud notes:

  • Key rings and keys can't be deleted, only key versions destroyed; plan names carefully.
  • Secret Manager secrets have replication: automatic (Google chooses) or user-managed locations, which matters for data residency.

Model: versions and rotation

Both secret stores are versioned. An app either pins a version or reads latest. A model of a rotation, where the database accepts both old and new passwords during an overlap:

python · try it yourself
versions = {1: "pw-2026-07", 2: "pw-2026-10"}
db_accepts = {"pw-2026-07", "pw-2026-10"}       # overlap: both valid during rotation

def connect(app, ref):
    value = versions[max(versions)] if ref == "latest" else versions[ref]
    status = "connected" if value in db_accepts else "AUTH FAILED"
    return f"{app:<10} reads {str(ref):<6} -> {value}  {status}"

print("-- during the overlap")
for app, ref in [("api", "latest"), ("worker", 1), ("reports", 2)]:
    print("  ", connect(app, ref))

db_accepts.discard("pw-2026-07")                  # old password revoked
versions[1] = None                                # version 1 disabled/destroyed
print("-- after revoking version 1")
for app, ref in [("api", "latest"), ("worker", 1), ("reports", 2)]:
    print("  ", connect(app, ref))
-- during the overlap
   api        reads latest -> pw-2026-10  connected
   worker     reads 1      -> pw-2026-07  connected
   reports    reads 2      -> pw-2026-10  connected
-- after revoking version 1
   api        reads latest -> pw-2026-10  connected
   worker     reads 1      -> None  AUTH FAILED
   reports    reads 2      -> pw-2026-10  connected

The worker pinned an old version and broke when it was revoked. Use latest with apps that re-read secrets (or restart on rotation), and only pin versions when you deploy them deliberately. Better still, use identities instead of passwords where the service supports it (Managed Relational Databases).

Sample sessions

bash
# Azure Key Vault with RBAC and purge protection; a secret; read access for an app identity
az keyvault create -g rg-shop-prod-sec -n kv-shop-prod -l westeurope \
    --enable-rbac-authorization true --enable-purge-protection true --retention-days 90
az keyvault secret set --vault-name kv-shop-prod -n db-password --value "$NEW_PASSWORD"
az role assignment create --assignee-object-id "$APP_PRINCIPAL_ID" --assignee-principal-type ServicePrincipal \
    --role "Key Vault Secrets User" --scope "$(az keyvault show -n kv-shop-prod --query id -o tsv)"
az keyvault secret show --vault-name kv-shop-prod -n db-password --query value -o tsv

# Google Cloud Secret Manager and Cloud KMS
printf '%s' "$NEW_PASSWORD" | gcloud secrets create db-password --replication-policy=automatic --data-file=-
gcloud secrets add-iam-policy-binding db-password \
    --member="serviceAccount:shop-api@shop-prod-4821.iam.gserviceaccount.com" \
    --role="roles/secretmanager.secretAccessor"
gcloud secrets versions access latest --secret=db-password

gcloud kms keyrings create shop --location=europe-west1
gcloud kms keys create storage-cmek --keyring=shop --location=europe-west1 \
    --purpose=encryption --rotation-period=90d --next-rotation-time=2026-12-01T00:00:00Z

printf '%s' avoids storing a trailing newline in the secret, a classic source of "the password is right but login fails".

Getting secrets into workloads

Runtime Azure Google Cloud
App Service / Functions / Container Apps Key Vault references in app settings, Container Apps secrets referencing Key Vault —
Cloud Run — --set-secrets=DB_PASSWORD=db-password:latest (env var or mounted file)
Kubernetes Secrets Store CSI Driver with the Azure Key Vault provider (AKS add-on) Secret Manager add-on for GKE (CSI), or External Secrets Operator
VMs SDK with managed identity SDK with attached service account

Go further: Encryption at Rest: KMS and Envelope Encryption builds a small KMS and shows why key policies are the real access control.

Test yourself

Which Azure service stores encryption keys, secrets and certificates together?

  1. Azure Storage
  2. Key Vault
  3. Entra ID
  4. Azure Policy

What does purge protection on a Key Vault prevent?

  1. Reading secrets
  2. Permanently deleting (purging) a deleted vault or object before the retention period ends
  3. Rotating keys
  4. Creating new versions

An app pins secret version 1. The secret is rotated to version 2 and version 1 is disabled. What happens?

  1. The app automatically uses version 2
  2. The app fails to read a valid secret
  3. Nothing changes
  4. Version 1 is re-enabled