Shared Access Signatures · AZ-204: Developing Solutions for Microsoft Azure Implement Azure Security

A security-sensitive web API must issue a read-only SAS for one blob, but the API must not store or access a storage account key. The API runs under…

Practice question from Shared Access Signatures (AZ-204: Developing Solutions for Microsoft Azure Implement Azure Security), with the correct answer and a step-by-step solution.

hard · MCQ · Q-363BDF

A security-sensitive web API must issue a read-only SAS for one blob, but the API must not store or access a storage account key. The API runs under a Microsoft Entra service principal that has permission to generate user delegation keys for the storage account. Which implementation is appropriate?

  1. A.Use DefaultAzureCredential to authenticate a BlobServiceClient, call GetUserDelegationKeyAsync, create a BlobSasBuilder with Resource = "b" and read permission, and generate SAS query parameters with the user delegation key.Correct answer
  2. B.Use DefaultAzureCredential to authenticate a BlobServiceClient, then call GenerateAccountSasUri with read, write, and list permissions.
  3. C.Construct a service SAS by placing the service principal's client secret in the SAS signature field.
  4. D.Set the blob container's public access level to Blob and return the blob URL without a SAS.

Solution

A user delegation SAS is signed with a user delegation key obtained through Microsoft Entra ID rather than with a storage account key. The SAS should be scoped to the blob, use resource type "b", grant only read permission, and have a short validity period. Client secrets are not SAS signatures, and public access does not provide controlled, authenticated access.

More from Shared Access Signatures

All of Shared Access Signatures

Practise more Implement Azure Security

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed