Question 661 of 1,170
Manage Azure Identities and GovernancemediumMultiple SelectObjective-mapped

Quick Answer

The answer is to use `az login --identity` in the script after enabling a system-assigned managed identity on the source VM. This is correct because a system-assigned managed identity, when enabled on an Azure VM, creates an automatically managed service principal in Azure AD that is tied directly to the VM’s lifecycle, allowing the Azure CLI script to authenticate without any client secret or password. On the AZ-104 exam, this scenario tests your understanding of managed identities for secure, credential-free automation across subscriptions, often appearing as a multi-select question where the trap is choosing a service principal with a secret instead. The key is remembering that system-assigned identities are ideal for single-resource access, like limiting permissions to only one resource group, while user-assigned identities are better for shared scenarios. Memory tip: think “system for single, user for shared” to quickly distinguish which managed identity fits the requirement.

AZ-104 Manage Azure Identities and Governance Practice Question

This AZ-104 practice question tests your understanding of manage azure identities and governance. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A DevOps engineer must run an Azure CLI script from a Windows VM to create resources in a specific resource group in another subscription. The script must not use a client secret or password, and access should be limited to only that resource group. Which three actions should the administrator take? Select three.

Question 1mediummulti select
Full question →

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

Enable a system-assigned managed identity on the source VM so the script can authenticate without stored credentials.

Option A is correct because enabling a system-assigned managed identity on the source VM allows the Azure CLI script to authenticate to Azure without storing any client secret or password. The managed identity is automatically managed by Azure AD and tied to the VM lifecycle, eliminating the need for credential management.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • Enable a system-assigned managed identity on the source VM so the script can authenticate without stored credentials.

    Why this is correct

    A system-assigned managed identity is tied directly to the VM and removes the need to store secrets on disk. It is the simplest credential-free option when a script runs inside a single virtual machine and must access Azure resources programmatically.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Assign Contributor on the target resource group to the VM identity so the script can create the required resources.

    Why this is correct

    Contributor at the resource-group scope allows resource creation and management within that group without granting broader subscription access. This matches the least-privilege requirement and keeps the permissions scoped to only the target area.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Use az login --identity in the script before running the Azure CLI deployment commands.

    Why this is correct

    az login --identity tells Azure CLI to use the VM's managed identity instead of an interactive account or saved secret. This is the expected authentication flow for running Azure CLI commands from within an Azure VM with managed identity enabled.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Create a service principal and store its client secret in a file on the VM for the script to read.

    Why it's wrong here

    This works technically, but it violates the requirement to avoid passwords or long-lived secrets on the VM. It also creates secret-rotation and protection overhead that managed identities are designed to remove.

  • Grant Reader on the resource group because Reader permissions are sufficient for Azure CLI resource creation.

    Why it's wrong here

    Reader is a read-only role and cannot create or modify Azure resources. It would allow inspection, but it would fail when the script tries to deploy or change anything in the resource group.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates may confuse Reader with Contributor, thinking Reader is sufficient for CLI commands, or they may default to creating a service principal with a secret, missing the managed identity approach that avoids stored credentials.

Detailed technical explanation

How to think about this question

A system-assigned managed identity creates an identity in Azure AD that is automatically tied to the VM. The Azure Instance Metadata Service (IMDS) endpoint at 169.254.169.254 provides access tokens for this identity, which `az login --identity` uses to authenticate. The identity must be granted the Contributor role on the target resource group via Azure RBAC to allow resource creation, as Reader only permits read operations.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related AZ-104 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free AZ-104 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this AZ-104 question test?

Manage Azure Identities and Governance — This question tests Manage Azure Identities and Governance — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Enable a system-assigned managed identity on the source VM so the script can authenticate without stored credentials. — Option A is correct because enabling a system-assigned managed identity on the source VM allows the Azure CLI script to authenticate to Azure without storing any client secret or password. The managed identity is automatically managed by Azure AD and tied to the VM lifecycle, eliminating the need for credential management.

What should I do if I get this AZ-104 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.