Interview Prep/Azure/Storage, Key Vault, Monitoring and Pipeline Errors

`az keyvault secret set` fails with `(Forbidden) ... Caller is not authorized ... ForbiddenByRbac` for the engineer who just created the vault with Terraform.

BeginnerTroubleshootingStorage, Key Vault, Monitoring and Pipeline Errors
Answer

Likely causes → Creating the vault (control plane) gives no data-plane rights on an RBAC vault; the engineer needs a Key Vault data role.

Diagnose → az role assignment list --assignee $(az ad signed-in-user show --query id -o tsv) --scope <kvId>

Fix →

az role assignment create --role "Key Vault Secrets Officer" \
  --assignee $(az ad signed-in-user show --query id -o tsv) --scope <kvId>

Wait a few minutes, then retry.

Prevent → Terraform grants Key Vault Secrets Officer to data.azurerm_client_config.current.object_id when it creates the vault.

Azure All Azure questions Roadmap: Azure core services

More on Storage, Key Vault, Monitoring and Pipeline Errors