Courseiva
Manage Azure Identities and GovernancehardMultiple ChoiceObjective-mapped

When to Use User-Assigned Managed Identity for Multiple Resources

A web app and a VM scale set both need the same Azure identity to read secrets from Key Vault. The identity must survive redeployment, and the team wants to remove it centrally without changing each resource individually. Which identity type should they use?

Quick Answer

The answer is a user-assigned managed identity. This is correct because a user-assigned managed identity is created as a standalone Azure resource, meaning it can be attached to multiple resources like a web app and a VM scale set simultaneously, and it persists independently of those resources—surviving redeployment of either one. The team can then centrally remove the identity by deleting the managed identity resource itself, without needing to modify each individual resource’s configuration. On the AZ-104 exam, this scenario tests your understanding of the difference between system-assigned and user-assigned identities; a common trap is choosing a system-assigned identity, which is tied to a single resource and cannot be shared. Remember the key distinction: system-assigned is “born with the resource and dies with it,” while user-assigned is a “standalone identity you can share across resources.”

⚠ Common exam trap

Watch out — candidates often confuse system-assigned managed identities (which are simpler but resource-bound) with user-assigned managed identities, failing to recognize that only user-assigned identities can be shared across multiple resources and survive independent redeployment.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

A user-assigned managed identity attached to both resources.

A user-assigned managed identity (B) is the correct choice because it is created as a standalone Azure resource, can be attached to multiple Azure resources (e.g., a web app and a VM scale set), and persists independently of those resources. This allows the identity to survive redeployment of either resource and enables centralized removal (by deleting the user-assigned identity) without needing to modify each resource individually.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • A system-assigned managed identity on each resource.

    Why it's wrong here

    System-assigned identities are tied to a single resource and are removed when that resource is deleted.

    When this WOULD be correct

    A question where a single resource (e.g., one VM) needs an identity that is automatically removed when the resource is deleted, and no sharing or central management is required.

  • A user-assigned managed identity attached to both resources.

    Why this is correct

    A user-assigned identity is reusable across resources and can be managed independently of any single workload.

  • A service principal with a client secret stored in application settings.

    Why it's wrong here

    This introduces secret management overhead and does not meet the goal of eliminating stored credentials.

    When this WOULD be correct

    A service principal with a client secret would be correct if the question required an identity that can be used by applications running outside Azure (e.g., on-premises) or if the identity must support client credential flows for non-Azure resources.

  • A resource lock on the Key Vault to preserve the secret access path.

    Why it's wrong here

    A lock protects resources from management changes, but it does not provide an authentication identity.

    When this WOULD be correct

    A resource lock would be correct if the question were: 'Which feature should be used to prevent accidental deletion of a Key Vault that stores critical secrets?'

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-104 exam frequently reuses these exact scenarios with slightly different constraints.

A user-assigned managed identity attached to both resources.Correct answer

Why this is correct

A user-assigned identity is reusable across resources and can be managed independently of any single workload.

A system-assigned managed identity on each resource.Wrong answer — click to see why

Why this is wrong here

System-assigned managed identities are tied to each resource's lifecycle and cannot be shared across resources; they also cannot be centrally removed without updating each resource individually.

★ When this WOULD be the correct answer

A question where a single resource (e.g., one VM) needs an identity that is automatically removed when the resource is deleted, and no sharing or central management is required.

Why candidates choose this

Candidates may think system-assigned identities are simpler to set up and assume they can be reused across resources, overlooking the requirement for a shared identity that survives redeployment and allows central removal.

A service principal with a client secret stored in application settings.Wrong answer — click to see why

Why this is wrong here

A service principal with a client secret stored in application settings does not survive redeployment because the secret must be manually rotated and stored, and it cannot be centrally removed without updating each resource's configuration.

★ When this WOULD be the correct answer

A service principal with a client secret would be correct if the question required an identity that can be used by applications running outside Azure (e.g., on-premises) or if the identity must support client credential flows for non-Azure resources.

Why candidates choose this

Candidates may confuse service principals with managed identities, thinking a service principal is the only way to assign a shared identity across resources, or they may overlook the requirement for central removal and survival of redeployment.

A resource lock on the Key Vault to preserve the secret access path.Wrong answer — click to see why

Why this is wrong here

A resource lock prevents accidental deletion or modification of the Key Vault, but it does not provide any identity for the web app and VM scale set to authenticate to Key Vault. The question asks for an identity type, not a protection mechanism.

★ When this WOULD be the correct answer

A resource lock would be correct if the question were: 'Which feature should be used to prevent accidental deletion of a Key Vault that stores critical secrets?'

Why candidates choose this

Candidates may confuse resource locks with access control, thinking that locking the Key Vault somehow preserves the identity's access path, but locks do not grant or manage identities.

Analysis generated from the official AZ-104blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

About these practice questions

This AZ-104 question is part of Courseiva's 1,049-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on AZ-104

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. An Azure CLI script runs on a utility VM every night to create and tag resources in another subscription. The script cannot store a password or client secret, and the VM is regularly redeployed from a standard image. What is the best identity design?

hard
  • A.Assign a system-assigned managed identity to the utility VM
  • B.Create a user-assigned managed identity and attach it to the utility VM
  • C.Create a service principal and store its secret in the VM configuration
  • D.Use a shared access signature to sign the Azure CLI session

Why B: A user-assigned managed identity can be created once, assigned to the utility VM, and used across redeployments without storing any credentials. The script can authenticate via Azure CLI using the managed identity's client ID, and the identity persists independently of the VM's lifecycle, satisfying the requirement of no password or client secret storage.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-104 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-104 exam.