Bitzu

AZ-400 ยท Identity, access and permissions

Service principal vs managed identity

Microsoft Entra service principals, system-assigned and user-assigned managed identities, secret/certificate lifecycle, which to use for a given workload and hosting location.

Key points

  • Both are workload identities in Microsoft Entra ID.
  • Managed identity: attached to Azure compute; you never see or rotate its credential.
  • System-assigned: one per resource, deleted with it.
  • User-assigned: standalone resource, shareable, deleted explicitly.
  • Service principal (app registration): works anywhere; you own its secret or certificate, or use a federated credential to avoid secrets.

Source: https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview

Practice questions

Single choice

Which type of managed identity is deleted automatically when its parent Azure resource is deleted?

  1. System-assigned managed identity
  2. User-assigned managed identity
  3. Service principal with a client secret
  4. Service principal with a certificate
Show answer

Answer: A. System-assigned managed identity

A system-assigned identity shares the lifecycle of its resource. A user-assigned identity is a separate resource and must be deleted explicitly.

Select all that apply

Which statements about user-assigned managed identities are true?

  1. They are created as a standalone Azure resource
  2. The same identity can be associated with more than one resource
  3. They are deleted automatically when a VM using them is deleted
  4. They have an independent lifecycle and must be deleted explicitly
  5. You must rotate their client secret every year
Show answer

Answer: A. They are created as a standalone Azure resource, B. The same identity can be associated with more than one resource, D. They have an independent lifecycle and must be deleted explicitly

They are standalone resources with their own lifecycle and can be attached to many resources. Being tied to a single resource and deletion with the VM describe the system-assigned type; and you never handle the credential of either type.

True or false

An application that uses a managed identity on an Azure VM must still keep a client secret in its configuration to obtain tokens.

Show answer

Answer: False

False. The code asks Microsoft Entra ID for a token through MSAL or Azure.Identity and is authenticated by the environment it runs in. No secret is stored.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More AZ-400 topics in this module