Question 772 of 997
Implement Azure securityeasyMultiple ChoiceObjective-mapped

Quick Answer

The correct answer is to enable a system-assigned managed identity on the Function App and grant it the Key Vault Secrets User role. This approach is the recommended approach because it allows the Azure Function to authenticate to Key Vault without ever storing or handling client secrets, connection strings, or certificates in application settings or source code. Azure automatically manages the identity’s lifecycle and tokens, so the function simply requests a token from the Azure AD endpoint at runtime and presents it to Key Vault for secret retrieval. On the AZ-204 exam, this scenario tests your understanding of secure secret management and the principle of credential-free authentication, often appearing as a trap where less secure options like storing secrets in app settings or using connection strings seem tempting. A strong memory tip is to think “no secrets in code, let Azure handle the load”—if you see a question about runtime secret access without stored credentials, immediately think system-assigned managed identity.

AZ-204 Practice Question: System-assigned managed identity for Function App…

This AZ-204 practice question tests your understanding of implement azure security. 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. A key principle to apply: managed identity. 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.

The team is writing an Azure Function that needs to retrieve secrets from Azure Key Vault at runtime. The security policy prohibits storing client secrets, connection strings, or certificates in application settings or source code. What is the recommended approach?

Question 1easymultiple 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 a system-assigned managed identity on the Function App and grant it Key Vault Secrets User (or Get/List access policy) permission on the vault

Option A is correct because a system-assigned managed identity provides a secure, credential-free way for an Azure Function to authenticate to Key Vault. Azure automatically manages the identity's lifecycle and tokens, eliminating the need to store any secrets in application settings or code. The Function App uses the managed identity to obtain an Azure AD token, which it presents to Key Vault to retrieve secrets, fully complying with the security policy.

Key principle: managed identity

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 Function App and grant it Key Vault Secrets User (or Get/List access policy) permission on the vault

    Why this is correct

    The managed identity removes all credential management from the developer. DefaultAzureCredential automatically detects the managed identity context and requests tokens from the Azure Instance Metadata Service. No secret is ever stored anywhere the developer can access or accidentally expose.

    Related concept

    managed identity

  • Create an App Registration, generate a client secret, store the secret in an Application Setting, and authenticate using ClientSecretCredential

    Why it's wrong here

    This approach works but violates the security policy — the client secret lives in application settings, which is a form of stored credential. Application settings are visible to anyone with Contributor access to the Function App.

  • Generate a Key Vault SAS token and embed it in the function's connection string setting

    Why it's wrong here

    Key Vault does not use SAS tokens. SAS tokens are an Azure Storage concept. Key Vault uses OAuth 2.0 bearer tokens issued by Azure Active Directory — managed identity is the correct credential-free mechanism.

  • Use the Key Vault REST API with the vault's access key embedded in the code

    Why it's wrong here

    Key Vault does not expose access keys in the same way storage accounts do. Access is controlled by Azure AD identity and permissions. Embedding any static credential in code violates the security policy and creates secret rotation and leakage risks.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates may think a client secret or SAS token is acceptable if stored in an Application Setting, but the policy explicitly prohibits storing any secrets in settings or code, making managed identity the only compliant option.

Detailed technical explanation

How to think about this question

Under the hood, the system-assigned managed identity creates a service principal in Azure AD automatically tied to the Function App's resource. At runtime, the Azure Instance Metadata Service (IMDS) endpoint (169.254.169.254) provides an OAuth 2.0 access token for the managed identity, which the Key Vault SDK (e.g., DefaultAzureCredential) uses to authenticate. A real-world scenario is a microservices architecture where each function uses its own managed identity, enabling fine-grained access policies per function without managing any secrets.

KKey Concepts to Remember

  • managed identity
  • system-assigned
  • Key Vault access
  • credential-free authentication

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

managed identity

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.

Review managed identity, then practise related AZ-204 questions on the same topic to reinforce the concept.

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 — managed identity.

What is the correct answer to this question?

The correct answer is: Enable a system-assigned managed identity on the Function App and grant it Key Vault Secrets User (or Get/List access policy) permission on the vault — Option A is correct because a system-assigned managed identity provides a secure, credential-free way for an Azure Function to authenticate to Key Vault. Azure automatically manages the identity's lifecycle and tokens, eliminating the need to store any secrets in application settings or code. The Function App uses the managed identity to obtain an Azure AD token, which it presents to Key Vault to retrieve secrets, fully complying with the security policy.

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

Review managed identity, then practise related AZ-204 questions on the same topic to reinforce the concept.

What is the key concept behind this question?

managed identity

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