Managed Identity vs Service Principal vs SAS vs Key Vault secret: which to use, and why

A practical comparison of the auth mechanisms you can give a monitoring tool, with pros, cons, and concrete setup notes for each.

When you connect Azure (or any cloud) to a third-party tool, the auth method you pick determines your blast radius if anything goes wrong on either side. Here is how we think about the four big options on Azure, with notes on their AWS / GCP equivalents.

1. Managed Identity (MI) — the gold standard

A Managed Identity is an Azure-native identity that has no secret at all. The platform issues short-lived tokens to whichever Azure resource the identity is bound to. There is nothing to rotate, nothing to leak, nothing to copy-paste.

Pros

Cons

Use it when: always, if you can.

AWS equivalent: IAM Role for the EC2 instance / ECS task / Lambda the scanner runs in, plus a cross-account role you assume into the target account. GCP equivalent: Workload Identity Federation, or service-account impersonation from a service-account-bound workload.

2. Service Principal (SP) — the legacy default

A Service Principal is an Entra app registration with a client secret or certificate. It works anywhere — from inside Azure, from a laptop, from a competitor's cloud — because the credential travels with the caller.

Pros

Cons

Use it when: the scanner can't run inside Azure, or your tenant policy forbids MI for third parties. Prefer certificate auth over client-secret.

AWS equivalent: IAM user with access keys. GCP equivalent: service-account key file. In fairness to this comparison: these two are what CloudMonitor's own AWS and GCP connectors use today. A cross-account role with an external ID, and Workload Identity Federation, are the better patterns and are not built yet.

3. SAS token — resource-scoped, time-bounded

A Shared Access Signature is a URL-embedded credential for a specific Azure storage object or queue. It's narrower than an SP and rarely the right answer for a monitoring tool, but it shows up in this conversation often enough to address.

Pros

Cons

Use it when: you have one specific resource you want a tool to watch and nothing else — e.g. forwarding a single container's logs.

4. Key Vault secret — the indirection

This is a pattern, not an auth method: store the credential in Key Vault and grant the consumer access to read it. People reach for this when they want central rotation.

Pros

Cons

Use it when: you have a credential that fundamentally must exist as a string (a third-party API key, an on-prem service password) and you want central rotation/audit. Don't use it as a wrapper around a credential you could have skipped entirely by using MI.

Cheat sheet

MethodLong-lived secret?Scope granularityRotation burdenWhen to pick
Managed IdentityNoRBAC, any scopeNoneDefault, when caller runs in Azure
Service PrincipalYes (cert or secret)RBAC, any scopeYou own itCaller is outside Azure
SAS tokenYes (the SAS itself)One resource, one verb setCan't revoke without rotating account keyOne-off resource access
Key Vault secretIndirectAs tight as the wrapped credentialOne placeWrapping unavoidable string credentials

CloudMonitor's default

CloudMonitor offers two Azure paths. The secretless path is the managed-identity pattern carried across tenants: you add our multi-tenant application to your directory, its only credential is a federated one trusting our scanner's managed identity, and no secret is created, stored or rotated. It is in Beta and has not yet been validated against a live customer tenant. The path known to work today is a service principal with a client secret, which we encrypt before storing; certificate credentials are not supported yet, so the certificate advice above is about other tools, not this one. Microsoft limits a client secret to 24 months and recommends federated or certificate credentials over secrets in production, which is why the secretless path is where we are heading; meanwhile, note your secret's expiry. The onboarding wizard labels which option you're picking, and the exact role assignments and minimum scopes are on the Connectors page.

← Back to all posts