Question 819 of 997
Implement Azure securitymediumMultiple ChoiceObjective-mapped

Quick Answer

The answer is to enable the system-assigned managed identity for the App Service and configure Key Vault access policies to allow that identity. This approach is correct because a managed identity, automatically managed by Microsoft Entra ID, provides an Azure resource with an automatically generated service principal, allowing it to authenticate to Azure Key Vault without any credentials stored in code or configuration files. On the AZ-204 exam, this scenario tests your understanding of secure secret management in Azure compute environments, often appearing as a direct question about eliminating hardcoded credentials from App Service applications. A common trap is choosing a client secret or certificate-based approach, which violates the requirement to avoid stored credentials. Remember the memory tip: "Managed identity means no stored identity"—if the question demands zero credentials in code, always reach for a managed identity, not a service principal with a secret.

AZ-204 Implement Azure security Practice Question

This AZ-204 practice question tests your understanding of implement azure security. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. 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.

You are developing an ASP.NET Core web API that is hosted on Azure App Service. The API needs to read secrets from Azure Key Vault at startup. You want to avoid storing any credentials in the application code or configuration. Which approach should you use?

Question 1mediummultiple choice
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 the system-assigned managed identity for the App Service and configure Key Vault access policies to allow that identity.

Option B is correct because enabling a system-assigned managed identity for the App Service allows it to authenticate to Azure Key Vault without any credentials stored in code or configuration. The managed identity is automatically managed by Azure AD (now Microsoft Entra ID) and can be granted access to Key Vault secrets via access policies, eliminating the need for client IDs, client secrets, or connection strings.

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.

  • Use the Key Vault SDK with a client ID and client secret stored in App Service application settings.

    Why it's wrong here

    While possible, this still requires storing a secret (the client secret) in application settings, which is not fully credential-free. Managed identity eliminates the need for any secret.

  • Enable the system-assigned managed identity for the App Service and configure Key Vault access policies to allow that identity.

    Why this is correct

    Correct. Managed identity allows the App Service to authenticate to Microsoft Entra ID without any credentials. The Key Vault access policy grants the identity read access to secrets.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Use Microsoft Entra ID application roles to assign the App Service a role that allows reading secrets.

    Why it's wrong here

    Application roles are not used for Key Vault access. Key Vault uses access policies or Azure RBAC roles (for Key Vault data plane) assigned to the identity.

  • Store the Key Vault URL and a connection string with the secret in the application's app.config file.

    Why it's wrong here

    This exposes credentials in the configuration file, which is insecure and does not leverage Azure's security features.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often think storing credentials in App Service application settings is acceptable because they are 'not in code,' but the question explicitly requires avoiding any stored credentials, making managed identity the only secure, credential-free approach.

Detailed technical explanation

How to think about this question

Under the hood, a system-assigned managed identity creates a service principal in Microsoft Entra ID tied to the App Service lifecycle. At runtime, the App Service obtains an access token from the Azure Instance Metadata Service (IMDS) endpoint (169.254.169.254) using the managed identity's certificate, which is automatically rotated. This token is then used to authenticate to Key Vault via the OAuth 2.0 client credentials grant flow, allowing the app to call Key Vault's REST API (e.g., GET /secrets/{name}) without any hardcoded secrets.

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-204 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-204 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-204 question test?

Implement Azure security — This question tests Implement Azure security — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Enable the system-assigned managed identity for the App Service and configure Key Vault access policies to allow that identity. — Option B is correct because enabling a system-assigned managed identity for the App Service allows it to authenticate to Azure Key Vault without any credentials stored in code or configuration. The managed identity is automatically managed by Azure AD (now Microsoft Entra ID) and can be granted access to Key Vault secrets via access policies, eliminating the need for client IDs, client secrets, or connection strings.

What should I do if I get this AZ-204 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

Same concept, more angles

1 more ways this is tested on AZ-204

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. You have an Azure Function app that needs to retrieve a secret from Azure Key Vault at runtime. You want to avoid storing any credentials in code or configuration. Which mechanism should you use?

easy
  • A.Service principal with client secret
  • B.Managed identity
  • C.Access key
  • D.Shared access signature (SAS)

Why B: Managed identity (B) is the correct mechanism because it allows the Azure Function app to authenticate to Azure Key Vault without storing any credentials in code or configuration. Azure automatically manages the identity and provides a token from Azure AD that the function can use to access the vault, eliminating the need for secrets or keys in the application.

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-204 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-204 exam.