Question 363 of 997
Develop for Azure storagehardMultiple ChoiceObjective-mapped

Quick Answer

The correct approach is to use the managed identity credentials to create a BlobServiceClient, then call GetUserDelegationKeyAsync to obtain a user delegation key, and finally use BlobSasBuilder.GenerateSas with that key to produce the token. This method is correct because a user delegation SAS token is signed with a key derived from your Microsoft Entra ID credentials rather than the storage account key, directly satisfying the security requirement to avoid exposing account keys. On the AZ-204 exam, this scenario tests your understanding of the three-step pattern for generating a user delegation SAS: authenticate via managed identity, fetch the delegation key, and build the SAS with scoped permissions and a one-hour expiry. A common trap is confusing this with generating a SAS using the storage account key via StorageSharedKeyCredential, which would fail the security audit. Memory tip: think "Delegate, then Generate"—first get the user delegation key, then build the SAS.

AZ-204 Develop for Azure storage Practice Question

This AZ-204 practice question tests your understanding of develop for azure storage. 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.

Your company develops a REST API for a global e-commerce platform that stores product images in Azure Blob Storage. The API uses shared access signatures (SAS) to grant temporary read access to the images. The security team requires that SAS tokens be generated using a user delegation key derived from the application's Microsoft Entra ID credentials, not from the storage account key. Additionally, the SAS must be scoped to a specific container and have a maximum validity of 1 hour. You need to implement the SAS generation in the API using the Azure Storage SDK for .NET. The application authenticates with Microsoft Entra ID using a managed identity assigned to the Azure App Service hosting the API. Which approach should you use?

Question 1hardmultiple choice
Read the full NAT/PAT explanation →

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

Use the managed identity credentials to create a BlobServiceClient, then call GetUserDelegationKeyAsync to get a key, and then call BlobSasBuilder.GenerateSas using the key.

Option A is correct because it follows the required pattern for generating a user delegation SAS: authenticate with managed identity via a BlobServiceClient, call GetUserDelegationKeyAsync to obtain a key derived from Microsoft Entra ID (not the storage account key), then use BlobSasBuilder with that key to call GenerateSas, which produces a SAS token scoped to a specific container with a 1-hour validity. This meets the security team's requirement of using Entra ID credentials and avoids exposing the storage account key.

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 managed identity credentials to create a BlobServiceClient, then call GetUserDelegationKeyAsync to get a key, and then call BlobSasBuilder.GenerateSas using the key.

    Why this is correct

    This correctly obtains the user delegation key and generates a SAS with it.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Use the StorageSharedKeyCredential with the storage account key to create a BlobSasBuilder and generate a SAS token.

    Why it's wrong here

    This uses the storage account key, not a user delegation key.

  • Use DefaultAzureCredential to authenticate, then call GenerateUserDelegationSas on the BlobContainerClient.

    Why it's wrong here

    DefaultAzureCredential does not directly provide a user delegation key; you must get the key first.

  • Use the managed identity credentials to create a BlobServiceClient, then call GetUserDelegationKeyAsync, then create a BlobSasBuilder with the key and call ToSasQueryParameters.

    Why it's wrong here

    This is similar but ToSasQueryParameters is not the correct method; the correct method is GenerateSas.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates confuse the user delegation SAS workflow with the simpler account-key-based SAS, or mistakenly think that GenerateUserDelegationSas is a direct method on a container client, when in fact the key must be obtained first from the service client and then used with BlobSasBuilder.

Trap categories for this question

  • Similar concept trap

    This is similar but ToSasQueryParameters is not the correct method; the correct method is GenerateSas.

Detailed technical explanation

How to think about this question

A user delegation key is a time-limited key signed with the application's Microsoft Entra ID credentials, not the storage account key. The GetUserDelegationKeyAsync method returns a UserDelegationKey object that must be passed to BlobSasBuilder via the SharedKeyCredential property (or as a parameter in newer SDK versions) before calling GenerateSas. The SAS token is then appended to the blob URL as a query string; the 1-hour maximum validity is enforced by setting the ExpiresOn property on the BlobSasBuilder relative to the key's start time.

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 media company stores terabytes of video archives that are accessed once a year for audit purposes. Moving these objects to a cold storage tier (Azure Archive, S3 Glacier, or Google Nearline) costs a fraction of hot storage. Questions like this test whether you understand storage tiers, access frequency tradeoffs, and retrieval latency requirements.

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?

Develop for Azure storage — This question tests Develop for Azure storage — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Use the managed identity credentials to create a BlobServiceClient, then call GetUserDelegationKeyAsync to get a key, and then call BlobSasBuilder.GenerateSas using the key. — Option A is correct because it follows the required pattern for generating a user delegation SAS: authenticate with managed identity via a BlobServiceClient, call GetUserDelegationKeyAsync to obtain a key derived from Microsoft Entra ID (not the storage account key), then use BlobSasBuilder with that key to call GenerateSas, which produces a SAS token scoped to a specific container with a 1-hour validity. This meets the security team's requirement of using Entra ID credentials and avoids exposing the storage account key.

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

Last reviewed: Jun 24, 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.