Implement Azure Security

203 soru

Soru 101Soru

You are writing a C# helper method using the `Azure.Storage.Blobs` SDK (v12) to generate a temporary Shared Access Signature (SAS) URL for a specific blob. The SAS URL must meet the following security and technical requirements:
- The SAS token must be signed using Microsoft Entra ID credentials (not storage account access keys).
- The SAS token must remain valid for exactly 2 hours.
- Access to the blob must be restricted to HTTPS only.
- The client must have read-only access (least privilege).
- The code must execute successfully without throwing runtime exceptions from the Azure Storage service.

You write the following C# method:

csharp
public static async Task<Uri> GenerateSecureBlobSasUriAsync(
BlobClient blobClient,
BlobServiceClient blobServiceClient,
string ipAddressRange)
{
// Step 1: Request User Delegation Key
DateTimeOffset keyStart = DateTimeOffset.UtcNow.AddMinutes(-15);
DateTimeOffset keyEnd = DateTimeOffset.UtcNow.AddDays(10);

UserDelegationKey delegationKey = await blobServiceClient.GetUserDelegationKeyAsync(keyStart, keyEnd);

// Step 2: Configure SAS Builder
BlobSasBuilder sasBuilder = new BlobSasBuilder
{
BlobContainerName = blobClient.BlobContainerName,
BlobName = blobClient.Name,
Resource = "b",
StartsOn = DateTimeOffset.UtcNow.AddMinutes(-15),
ExpiresOn = DateTimeOffset.UtcNow.AddHours(2),
Protocol = SasProtocol.HttpsAndHttp
};

sasBuilder.SetPermissions(BlobSasPermissions.Read | BlobSasPermissions.Write);
sasBuilder.IPRange = SasIPRange.Parse(ipAddressRange);

// Step 3: Generate and append SAS token
BlobSasQueryParameters sasParams = sasBuilder.ToSasQueryParameters(delegationKey, blobServiceClient.AccountName);

UriBuilder uriBuilder = new UriBuilder(blobClient.Uri)
{
Query = sasParams.ToString()
};

return uriBuilder.Uri;
}

Which three modifications must you make to the code to ensure it executes successfully and complies with all requirements?

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Change the keyEnd variable in Step 1 to a duration of 7 days or less from keyStart to prevent a runtime exception.; Change the Protocol property of the BlobSasBuilder in Step 2 to SasProtocol.Https to restrict access to HTTPS only.; Modify the SetPermissions method call in Step 2 to pass BlobSasPermissions.Read only, removing the Write permission.

Cevap

To ensure successful execution and security compliance, you must: 1. Reduce the User Delegation Key lifetime to 7 days or less by modifying keyEnd. 2. Limit the allowed protocol to HTTPS only by setting the SasBuilder Protocol to SasProtocol.Https. 3. Adhere to least privilege by setting permissions to BlobSasPermissions.Read only.
To ensure the code runs without throwing a runtime error and meets the security requirements, three modifications are necessary: first, the User Delegation Key lifetime must be capped at 7 days; second, the SAS builder must restrict protocols to HTTPS only; third, the SAS permissions must be restricted to Read only.

Adım Adım Çözüm

1
Analyze the User Delegation Key lifetime limits.
The current code requests a key valid for 10 days. The maximum lifetime for a User Delegation Key is 7 days, so keyEnd must be adjusted to a maximum of 7 days after keyStart to prevent a runtime RequestFailedException.
Azure Storage enforces a strict 7-day limit on the validity period of the signing key used for user delegation.
2
Evaluate the protocol security requirement.
The current configuration uses SasProtocol.HttpsAndHttp, which allows unencrypted HTTP access. The Protocol property must be updated to SasProtocol.Https to meet the HTTPS-only security mandate.
Restricting the protocol at the SAS level ensures the storage service rejects any non-HTTPS traffic using this token.
3
Apply the principle of least privilege to SAS permissions.
The current code grants Read and Write permissions. Since the requirement is read-only (download) access, the BlobSasPermissions.Write flag must be removed, leaving only BlobSasPermissions.Read.
Least privilege security practices dictate that users should only receive the minimum permissions necessary to complete their task.

Anahtar Kavram

User Delegation SAS configuration, lifetime limits, and least privilege in Azure Storage.
Soru 102Soru

You are configuring permissions in Microsoft Entra ID for a Single Page Application (SPA) named TimeTrackerSPA. The application runs in the user's browser and must perform the following actions:

1. Retrieve the signed-in user's profile details from Microsoft Graph.
2. Read and write time entries using a custom backend Web API named TimeSheetAPI on behalf of the signed-in user.

The TimeSheetAPI application registration exposes a delegated scope named TimeSheet.Write.

Which permissions should you configure for the TimeTrackerSPA application registration?

Cevabı ve açıklamayı göster

Cevap: Microsoft Graph: Delegated permission User.Read; TimeSheetAPI: Delegated permission TimeSheet.Write

Cevap

The correct permission configuration is Delegated permission: User.Read (from Microsoft Graph) and Delegated permission: TimeSheet.Write (from TimeSheetAPI).
The application is a Single Page Application (SPA) that runs in the browser under the context of the signed-in user. Therefore, it must use Delegated permissions to access resources on behalf of the user. To read the signed-in user's profile, the delegated permission 'User.Read' is sufficient and does not require administrator consent, fulfilling the principle of least privilege. To call the backend Web API on behalf of the user, the application must use the delegated scope 'TimeSheet.Write' exposed by the API.

Adım Adım Çözüm

1
Identify the application type and its execution context.
The application is a Single Page Application (SPA) running in a web browser.
Determines whether to use Delegated permissions (user context) or Application permissions (daemon/background service context).
2
Determine the permission type based on the application context.
Since the SPA operates on behalf of a signed-in user and cannot securely store client secrets, Delegated permissions must be used for both Microsoft Graph and TimeSheetAPI.
Ensures secure token acquisition and proper user-context propagation.
3
Select the least-privileged scopes that satisfy the functional requirements.
Microsoft Graph 'User.Read' is selected instead of 'Directory.Read.All' because reading the signed-in user's own profile does not require administrative consent or directory-wide access. The custom API scope 'TimeSheet.Write' is added as a delegated permission.
Applies security best practices by minimizing access and avoiding unnecessary admin consent requirements.

Anahtar Kavram

Configuring Delegated permissions versus Application permissions and applying the principle of least privilege for Microsoft Entra ID app registrations.
Soru 103Soru

An organization deploys a Node.js REST API inside Azure Container Apps (ACA). The container app uses a user-assigned managed identity named `id-api-prod` to authenticate.

The API loads its configuration from an Azure App Configuration instance named `config-payment-prod`. The App Configuration store contains a key named `PaymentGateway:ApiKey` which is configured as a Key Vault reference pointing to a secret named `gateway-api-key` in a Key Vault named `kv-payment-prod`.

The managed identity `id-api-prod` is assigned the App Configuration Data Reader role on the App Configuration store. However, at runtime, the API fails to start because it cannot retrieve the resolved value of the `PaymentGateway:ApiKey` setting, instead receiving an access denied authorization error.

Which of the following actions should you perform to resolve the error?

Cevabı ve açıklamayı göster

Cevap: Assign the Key Vault Secrets User role to the user-assigned managed identity `id-api-prod` on the Key Vault `kv-payment-prod`.

Cevap

Assign the Key Vault Secrets User role to the user-assigned managed identity `id-api-prod` on the Key Vault `kv-payment-prod`.
The correct answer is to assign the Key Vault Secrets User role to the user-assigned managed identity `id-api-prod` on the Key Vault `kv-payment-prod`. This is because Key Vault references stored in Azure App Configuration are resolved at runtime by the client SDK running within the application. The application uses its own credentials (in this case, the user-assigned managed identity) to connect directly to the Key Vault and retrieve the secret values. Therefore, the application's identity must have authorization (such as the Key Vault Secrets User role) to read secrets from the Key Vault.

Adım Adım Çözüm

1
Analyze how Azure App Configuration Key Vault references are resolved.
Identify that the client application (Node.js API inside Azure Container Apps) is responsible for fetching the secret from Azure Key Vault using its own credential at runtime.
Azure App Configuration does not fetch the secret value itself; it only returns a JSON metadata reference that tells the client SDK where the secret is stored.
2
Identify the authentication credential used by the client application.
The application uses the user-assigned managed identity `id-api-prod` for authentication.
This identity is configured on the Container App and holds the necessary roles to read configuration.
3
Determine the minimum required permission on the Key Vault to resolve the reference.
The identity `id-api-prod` needs read access to Key Vault secrets. This is granted by assigning the Key Vault Secrets User role on the Key Vault.
Granting Key Vault Secrets User role on the Key Vault allows the application to call the GET secret API, resolving the access denied error.

Anahtar Kavram

Key Vault references in Azure App Configuration are resolved at runtime by the client application using its own identity and credentials, requiring the client identity to have read permissions (like Key Vault Secrets User) on the Key Vault.
Soru 104Soru

You are deploying a C# ASP.NET Core web application to Azure App Service. The application is configured to use a system-assigned managed identity. The application must retrieve a database password from an Azure Key Vault named kv-finance-prod. The Key Vault is configured with the Vault access policy permission model.

The application contains the following C# code to retrieve the secret:

csharp
using System;
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;

// ...
var client = new SecretClient(new Uri("https://kv-finance-prod.vault.azure.net/"), new DefaultAzureCredential());
KeyVaultSecret secret = await client.GetSecretAsync("DbPassword");

During testing, the call to GetSecretAsync fails with a RequestFailedException showing a 403 (Forbidden) error.

Which action should you perform to resolve the authorization issue using the minimum level of privileges?

Cevabı ve açıklamayı göster

Cevap: Add a Key Vault access policy for the application's system-assigned managed identity and grant it the Get secret permission.

Cevap

Add a Key Vault access policy for the application's system-assigned managed identity and grant it the Get secret permission.
The Azure Key Vault uses the Vault access policy permission model. Under this model, data plane authorization must be configured via Key Vault access policies rather than Azure RBAC. Since the application retrieves a specific secret using GetSecretAsync, granting only the 'Get' secret permission in the access policy satisfies the minimum privilege requirements.

Adım Adım Çözüm

1
Identify the active authorization model of the Azure Key Vault.
The Key Vault is configured to use the Vault access policy model rather than Azure role-based access control (Azure RBAC).
This determines whether to configure access policies or assign RBAC roles to authorize the application's identity.
2
Analyze the C# SDK code to determine the required permission.
The application calls GetSecretAsync to retrieve a single secret by its exact name.
This operation requires only the 'Get' secret permission. The 'List' permission is not required to read a specific secret.
3
Apply the permission under the legacy Vault access policy model.
Create a new Key Vault access policy targeting the application's system-assigned managed identity, selecting only the 'Get' permission for secrets.
This grants the minimum level of privileges required to resolve the 403 Forbidden error without introducing unnecessary access rights like List.

Anahtar Kavram

Key Vault Data Plane Access Policies
Soru 105Soru

A company is deploying an automated synchronization service named DeptSync that runs as a daily background task on an Azure virtual machine. The service must connect to Microsoft Graph to update the department and job title properties of all user accounts in Microsoft Entra ID. The service runs without any user interaction.

You need to configure the Microsoft Entra ID application registration for DeptSync to allow the service to authenticate and perform these updates securely using the principle of least privilege.

Which two actions should you perform? (Choose two.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Configure the application registration with the User.ReadWrite.All Application permission for the Microsoft Graph API.; Grant tenant-wide admin consent for the configured Microsoft Graph API permissions.

Cevap

To configure the daemon service, you must add the User.ReadWrite.All Application permission to the Microsoft Graph API and grant tenant-wide administrator consent.
The background synchronization service runs as a scheduled task without a signed-in user, meaning it must authenticate as its own identity using the client credentials flow. Therefore, it requires Application permissions rather than Delegated permissions. Updating user profile details (such as department and job title) across all accounts in the tenant requires the User.ReadWrite.All permission. Because Application permissions grant broad access to directory data, Microsoft Entra ID requires tenant-wide administrator consent to be granted before the application can successfully call the Microsoft Graph API.

Adım Adım Çözüm

1
Determine the application type and authentication context.
The service runs in the background without user interaction, requiring the client credentials flow and Application permissions.
Delegated permissions require a signed-in user, whereas daemon services run under their own identity.
2
Select the appropriate Microsoft Graph permission scope.
Choose the User.ReadWrite.All permission.
The service needs to read and write department and job title properties for all user accounts in the directory, and User.ReadWrite.All covers these operations.
3
Grant the necessary consent for the permissions.
Grant tenant-wide administrator consent.
All Microsoft Graph Application permissions require administrator approval before they can be used.

Anahtar Kavram

Microsoft Entra ID Application permissions and administrator consent requirements for daemon applications.
Soru 106Soru

You are deploying a web application to Azure App Service. The application must retrieve database credentials from an Azure Key Vault. To follow organizational security policies, you decide to use a user-assigned managed identity to authenticate the application.

Which of the following actions are required to configure this security solution? (Select TWO.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Associate the user-assigned managed identity with the App Service instance.; Configure an Azure Key Vault access policy or Azure RBAC role assignment that grants Secret Get permissions to the user-assigned managed identity.

Cevap

The correct actions are to associate the user-assigned managed identity with the App Service instance, and to configure an Azure Key Vault access policy or Azure RBAC role assignment that grants Secret Get permissions to the user-assigned managed identity.
To authenticate using a user-assigned managed identity, you must first associate the identity with the App Service. Then, you must grant the identity permissions to the Key Vault using access policies or role assignments.

Adım Adım Çözüm

1
Assign the identity to the compute resource.
The App Service is associated with the user-assigned managed identity, enabling it to request Microsoft Entra ID tokens using this identity.
Before an Azure resource can use a user-assigned managed identity, the identity must be linked to the resource configuration.
2
Grant access to the target resource.
The user-assigned managed identity is authorized to perform get operations on Key Vault secrets.
By default, identities have no permissions. You must explicitly configure access policies or RBAC roles to grant access to the Key Vault.

Anahtar Kavram

Configuring a user-assigned managed identity to authenticate and authorize access to Azure Key Vault.
Soru 107Soru

You are developing a C# desktop application using MSAL.NET that will run on Windows 11 client machines. The application must authenticate users against Microsoft Entra ID and support Single Sign-On (SSO) using the native Windows Web Account Manager (WAM) broker. You need to configure the Microsoft Entra ID application registration and the C# initialization code. Which two configuration steps should you perform? Select two.

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: In the Microsoft Entra ID application registration, configure a Redirect URI using the format ms-appx-web://microsoft.aad.brokerplugin/{ClientId}.; Initialize the client application using PublicClientApplicationBuilder and call the WithBroker method with Windows broker options enabled.

Cevap

Configure a Redirect URI in Microsoft Entra ID using the format ms-appx-web://microsoft.aad.brokerplugin/{ClientId}, and initialize the application using PublicClientApplicationBuilder while calling WithBroker with Windows broker options enabled.
To configure Windows Web Account Manager (WAM) broker authentication, you must register a Redirect URI matching the 'ms-appx-web://microsoft.aad.brokerplugin/{ClientId}' pattern in Entra ID and call the 'WithBroker' method with Windows options on the 'PublicClientApplicationBuilder'. This allows the application to utilize WAM for native Single Sign-On.

Adım Adım Çözüm

1
Register the correct redirect URI pattern in Microsoft Entra ID for the public client application.
The application registration now contains the ms-appx-web://microsoft.aad.brokerplugin/{ClientId} redirect URI, allowing the Entra ID authorization endpoint to redirect tokens back to the native WAM broker.
Windows broker authentication requires a specific callback scheme to identify the broker handler.
2
Use the MSAL.NET PublicClientApplicationBuilder in your C# application code.
The application is initialized as a public client (desktop) application, which is suitable for client-side execution.
A public client application is required for interactive token acquisition and integration with OS brokers.
3
Call the WithBroker extension method passing Windows operating system broker options.
MSAL.NET enables interaction with the local Windows WAM broker for SSO authentication.
Enabling the broker runtime bypasses the browser flow and uses the OS native broker for a seamless user experience.

Anahtar Kavram

Configuring Single Sign-On (SSO) with Web Account Manager (WAM) broker authentication in MSAL.NET and Microsoft Entra ID.
Tahmini Süre:2m 0s
Soru 108Soru

You are developing a secure web application that runs on an Azure Virtual Machine. The application must generate a temporary URI to allow external clients to download PDF reports from a private Azure Blob Storage container named reports. To meet security requirements, you must not use storage account keys. Instead, you configure a User-Assigned Managed Identity for the Virtual Machine. In the application code, you successfully request a User Delegation Key and build a Shared Access Signature (SAS) token using the Azure.Storage.Blobs SDK. The SAS token is configured with read permissions and a lifetime of 11 hour. However, when external clients attempt to download a report using the generated SAS URI, they receive an HTTP 403403 (Forbidden) error. You verify that the Virtual Machine's managed identity has been assigned the Storage Blob Delegator role at the storage account level. Which action should you perform to resolve the HTTP 403403 error?

Cevabı ve açıklamayı göster

Cevap: Assign the Storage Blob Data Reader role to the managed identity at the storage account or container level.

Cevap

Assign the Storage Blob Data Reader role to the managed identity at the storage account or container level.
Assigning the Storage Blob Data Reader role to the managed identity is correct because a User Delegation SAS is authorized in two steps: first, the SAS token constraints are verified, and second, the Azure RBAC permissions of the Microsoft Entra ID principal that created the SAS are evaluated. The Storage Blob Delegator role only allows the managed identity to request a User Delegation Key; it does not grant permissions to read the container data. Assigning the Storage Blob Data Reader role resolves the HTTP 403 error by granting the identity the underlying data-plane permissions required to serve the read requests.

Adım Adım Çözüm

1
Analyze the authorization flow of a User Delegation SAS.
A User Delegation SAS requires both the SAS token permissions to be valid and the Microsoft Entra ID security principal (managed identity) that requested the User Delegation Key to have the appropriate Azure RBAC permissions to perform the action.
Unlike Service SAS or Account SAS (which only check the token's validity and permissions because they are signed by the root account key), a User Delegation SAS is constrained by the security principal's active roles.
2
Evaluate the current role assignments of the managed identity.
The managed identity is assigned the Storage Blob Delegator role, which only allows it to run the generateUserDelegationKey action. It has no data-plane roles (like Storage Blob Data Reader).
To identify why the SAS token results in an HTTP 403 Forbidden error, we must verify if the identity itself has read access to the blobs.
3
Select the minimum privilege role that allows reading blob data.
Assign the Storage Blob Data Reader role to the managed identity for the storage account or container containing the reports.
This grants the managed identity the necessary RBAC permissions to read the blobs, completing the second stage of the User Delegation SAS authorization check.

Anahtar Kavram

User Delegation SAS Authorization and RBAC Constraints
Tahmini Süre:2m 0s
Soru 109Soru

You are deploying an ASP.NET Core web application to an Azure App Service. The application must retrieve secrets from an Azure Key Vault using a user-assigned managed identity. The application code uses DefaultAzureCredential from the Azure.Identity SDK to authenticate. Which sequence of steps should you perform to configure the environment and enable secure access?

Öğeleri doğru sıraya koymak için sürükleyin

Cevabı ve açıklamayı göster

Cevap

First, create the user-assigned managed identity. Second, associate the identity with the App Service. Third, assign the Key Vault Secrets User RBAC role to the identity on the Key Vault. Finally, configure the AZURE_CLIENT_ID application setting on the App Service with the identity's client ID.
Configuring a user-assigned managed identity requires a specific sequence: you must create the standalone identity resource, associate it with the App Service resource, grant the identity permission to access the Key Vault, and configure the AZURE_CLIENT_ID app setting. Setting the AZURE_CLIENT_ID environment variable is necessary because DefaultAzureCredential will not automatically know which user-assigned identity to use without it.

Adım Adım Çözüm

1
Create the user-assigned managed identity resource.
A standalone identity resource is created with a unique Client ID and Principal ID.
The identity must exist in Microsoft Entra ID before it can be assigned to resources or granted RBAC roles.
2
Associate the identity with the App Service.
The App Service's identity configuration includes the resource ID of the user-assigned managed identity.
This configuration allows the App Service infrastructure to obtain Entra ID tokens on behalf of the user-assigned managed identity.
3
Assign the Key Vault Secrets User RBAC role to the identity's service principal.
The identity is authorized to access secrets within the Key Vault.
Azure Key Vault requires explicit data-plane permissions for identities to retrieve secrets.
4
Set the AZURE_CLIENT_ID environment variable in the App Service app settings.
The application's runtime environment includes the AZURE_CLIENT_ID setting.
DefaultAzureCredential requires this environment variable to distinguish between multiple potential identities when acquiring tokens for a user-assigned managed identity.

Anahtar Kavram

Configuration workflow for user-assigned managed identities with DefaultAzureCredential
Soru 110Soru

You are deploying a web application to multiple Azure App Services in different regions. The applications need to retrieve a database connection string stored in an Azure Key Vault named `kv-checkout-prod`.

The Azure Key Vault is configured to use the Azure role-based access control (Azure RBAC) permission model for authorization. To simplify permission management across all regions and avoid recreating role assignments when App Services are redeployed, you decide to use a single user-assigned managed identity named `id-checkout-prod`.

You need to configure the App Services to retrieve the secret value using this identity while adhering to the principle of least privilege.

Which configuration should you apply?

Cevabı ve açıklamayı göster

Cevap: Assign the Key Vault Secrets User role to the `id-checkout-prod` identity on the Key Vault, associate the identity with each App Service, set the `keyVaultReferenceIdentity` property of each App Service to the resource ID of the identity, and configure the application setting to `@Microsoft.KeyVault(SecretUri=https://kv-checkout-prod.vault.azure.net/secrets/DbConnectionString/)`.

Cevap

To resolve the secret value using a user-assigned identity, you must assign the Key Vault Secrets User role to the user-assigned identity, link it to the App Services, configure each App Service to use that identity for Key Vault references via the keyVaultReferenceIdentity property, and use the correct @Microsoft.KeyVault(SecretUri=...) reference syntax.
Assigning the Key Vault Secrets User role to the user-assigned identity, linking it to the App Services, setting the keyVaultReferenceIdentity property to the identity's resource ID, and using the correct @Microsoft.KeyVault(SecretUri=...) syntax is the correct configuration. This ensures that the App Service uses the user-assigned identity to resolve the Key Vault reference, that the identity has the necessary RBAC permissions to read the secret, and that the reference syntax is valid.

Adım Adım Çözüm

1
Identify the authentication and authorization requirements for the Key Vault.
Since the vault uses the Azure RBAC permission model, permissions must be managed using RBAC roles rather than access policies. The minimum privilege role for reading secrets is Key Vault Secrets User.
Access policies are ignored when Azure RBAC is enabled, and Key Vault Secrets User is the least-privileged role for retrieving secret values.
2
Determine how the user-assigned managed identity is configured for the App Service.
The user-assigned identity must be associated with the App Service, and the App Service's keyVaultReferenceIdentity property must be set to the identity's resource ID.
By default, App Service attempts to resolve Key Vault references using its system-assigned identity. To use a user-assigned identity instead, it must be explicitly configured as the keyVaultReferenceIdentity.
3
Verify the correct Key Vault reference syntax.
The correct format is @Microsoft.KeyVault(SecretUri=https://kv-checkout-prod.vault.azure.net/secrets/DbConnectionString/).
The reference syntax is strict and does not support inline identity parameters like Identity=id-checkout-prod.

Anahtar Kavram

Azure App Service Key Vault references with user-assigned managed identities and Azure RBAC authorization.
Soru 111Soru

An organization has a web application deployed to Azure App Service named app-payment-prod. The application needs to retrieve a database connection string stored as a secret in an Azure Key Vault named kv-payment-prod. The Key Vault is configured to use the Azure Role-Based Access Control (Azure RBAC) authorization model. You must implement access using the principle of least privilege. Which set of configuration steps should you perform to grant the web application access to the Key Vault secret?

Cevabı ve açıklamayı göster

Cevap: Enable a system-assigned managed identity on the App Service. Assign the 'Key Vault Secrets User' Azure RBAC role to the identity's service principal at the scope of the Key Vault. Reference the secret in the App Service settings using the syntax: @Microsoft.KeyVault(SecretUri=https://kv-payment-prod.vault.azure.net/secrets/db-conn-string/)

Cevap

Enable a system-assigned managed identity on the App Service, assign the 'Key Vault Secrets User' Azure RBAC role to the identity at the Key Vault scope, and reference the secret using the '@Microsoft.KeyVault(SecretUri=...)' syntax.
The correct configuration enables the system-assigned managed identity on the App Service, grants it the 'Key Vault Secrets User' role under the Azure RBAC model, and references the secret using the correct '@Microsoft.KeyVault(SecretUri=...)' syntax. This satisfies the requirement of using the Azure RBAC model, enforces least privilege (by avoiding administrative roles like 'Secrets Officer' or 'Administrator'), and uses valid parsing syntax.

Adım Adım Çözüm

1
Configure the web application identity
Enable a system-assigned managed identity on the App Service
This establishes a security principal in Microsoft Entra ID (Azure Active Directory) that is tied to the lifecycle of the App Service.
2
Assign authorization permissions
Assign the 'Key Vault Secrets User' Azure RBAC role to the managed identity's service principal at the scope of the Key Vault
Since the vault uses the Azure RBAC model, access policies are ignored. The 'Key Vault Secrets User' role grants read access to secret values without granting unnecessary administrative permissions, satisfying the least-privilege requirement.
3
Define Key Vault references in application settings
Set the environment variable value using the '@Microsoft.KeyVault(SecretUri=...)' syntax
This enables the App Service to automatically resolve the secret from the Key Vault at runtime and expose it as a standard environment variable to the application code.

Anahtar Kavram

Configuring App Service Key Vault references with Azure RBAC and Managed Identities
Tahmini Süre:2m 30s
Soru 112Soru

You are configuring a Java web application hosted on Azure App Service to load configuration settings from an Azure App Configuration store. The application needs to retrieve a database password stored in an Azure Key Vault named kv-prod.

In the Azure App Configuration store, you create a key-value pair where the key is DbPassword and the value is set to {"uri":"https://kv-prod.vault.azure.net/secrets/db-pass"}. During application startup, the App Configuration provider library retrieves the DbPassword configuration, but logs show the value is received as the raw JSON string {"uri":"https://kv-prod.vault.azure.net/secrets/db-pass"} instead of the resolved secret. The App Service is configured with a system-assigned managed identity that has the 'Key Vault Secrets User' role on kv-prod.

Which of the following actions should you take to ensure the secret is correctly resolved by the application?

Cevabı ve açıklamayı göster

Cevap: Update the content-type of the DbPassword key-value in Azure App Configuration to application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8.

Cevap

Update the content-type of the DbPassword key-value in Azure App Configuration to application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8.
The correct action is to set the content-type of the key-value pair to application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8. Azure App Configuration client SDKs identify Key Vault references using this metadata. If it is missing or incorrect, the SDK retrieves the value as a plain JSON string rather than resolving the secret from the Key Vault.

Adım Adım Çözüm

1
Analyze how Azure App Configuration distinguishes Key Vault references from standard string values.
Identify that the client SDK checks the key-value's content-type metadata to determine if it should resolve a secret.
If the content-type is empty or set to a standard type like text/plain, the SDK treats the value as a literal string.
2
Verify the permission model for Key Vault reference resolution.
Confirm that the application's identity (the App Service's system-assigned managed identity) is the one that needs access to Key Vault.
Because resolution is performed client-side by the client provider library, the application's credentials are used to fetch the secret from Key Vault.
3
Apply the correct configuration format in Azure App Configuration.
Update the key-value's content-type to application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8.
This content-type instructs the provider library to parse the JSON value, retrieve the URI, and fetch the secret value from Key Vault at runtime.

Anahtar Kavram

Key Vault references in Azure App Configuration require a specific content-type header and are resolved client-side by the application SDK using the application's identity.
Soru 113Soru

Your team is configuring a distributed C# application hosted on an Azure Virtual Machine Scale Set (VMSS) to access an Azure Storage account. Multiple VMSS instances will be scaled out and in dynamically. The identity used for accessing the storage account must persist independently of the VMSS lifecycle.

Which two configurations are required to ensure the application can successfully authenticate and read blobs from the storage account using the Azure.Identity library? (Select two.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Assign the Storage Blob Data Reader role to the user-assigned managed identity at the storage account resource scope.; Instantiate the DefaultAzureCredential class by passing a DefaultAzureCredentialOptions instance with the ManagedIdentityClientId property set to the client ID of the user-assigned managed identity.

Cevap

To implement this solution, you must assign the Storage Blob Data Reader role to the user-assigned managed identity at the storage account scope, and instantiate the DefaultAzureCredential class by passing a DefaultAzureCredentialOptions instance with the ManagedIdentityClientId property set to the client ID of the user-assigned managed identity.
To ensure the managed identity persists independently of the Virtual Machine Scale Set lifecycle, a user-assigned managed identity must be used instead of a system-assigned one. The user-assigned identity must be granted appropriate access permissions, such as the Storage Blob Data Reader role at the storage account scope. When using DefaultAzureCredential with a user-assigned identity in code, the identity's client ID must be specified (for example, via DefaultAzureCredentialOptions) so that the credential knows which identity to use for token acquisition.

Adım Adım Çözüm

1
Select the correct identity type based on the lifecycle requirements.
A user-assigned managed identity is chosen because it exists as a standalone Azure resource and persists independently of the VMSS lifecycle.
System-assigned identities are deleted when the VMSS is deleted, which would violate the persistence requirement.
2
Assign the appropriate RBAC permissions.
The user-assigned identity is assigned the 'Storage Blob Data Reader' role at the storage account scope.
This grants the identity permission to read blob data from the storage account.
3
Configure the application credential usage in code.
The application code instantiates DefaultAzureCredential by explicitly setting the ManagedIdentityClientId property to the Client ID of the user-assigned identity.
Providing the Client ID is required so that DefaultAzureCredential can identify and use the correct user-assigned identity for token acquisition.

Anahtar Kavram

Selecting and configuring user-assigned managed identities for applications with dynamic lifecycles using the Azure SDK.
Soru 114Soru

You are developing an ASP.NET Core Web API named InventoryAPI that exposes operations to manage warehouse inventory. You register InventoryAPI in Microsoft Entra ID. You need to configure permissions and scopes to support the following client applications:

1. InventorySPA: A Single Page Application where warehouse employees sign in and manage stock. The application must perform operations on behalf of the signed-in user.
2. InventoryDaemon: A background console application that syncs stock levels from an external system overnight. The daemon runs without user interaction.

Which two configurations should you perform to support these applications using the principle of least privilege?

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Expose a delegated scope named Inventory.ReadWrite in the API registration for InventoryAPI, and grant the InventorySPA application delegated permission to access this scope.; Define an App Role named Inventory.ReadWrite.All in the API registration for InventoryAPI, and grant the InventoryDaemon application application permission to access this role.

Cevap

Expose a delegated scope named Inventory.ReadWrite for the Single Page Application, and define an App Role named Inventory.ReadWrite.All for the daemon service.
The correct options are to expose a delegated scope for the browser-based Single Page Application (where employees sign in) and to define an App Role (application permission) for the background daemon service (which runs without user interaction).

Adım Adım Çözüm

1
Analyze the identity context for the Single Page Application (InventorySPA).
Since warehouse employees sign in and perform actions, the application operates under a user session, requiring Delegated permissions.
Delegated permissions allow the application to act on behalf of the signed-in user.
2
Expose the API scope for the delegated access.
Expose a custom scope (e.g., Inventory.ReadWrite) in the API registration of InventoryAPI and configure the SPA to request delegated permissions for it.
This establishes the scope boundary for user-delegated actions.
3
Analyze the identity context for the background runner (InventoryDaemon).
Since the daemon runs on a schedule without user interaction, it cannot have a signed-in user, requiring Application permissions.
Application permissions allow applications to run non-interactively using their own identity.
4
Define and assign the App Role.
Define an App Role (e.g., Inventory.ReadWrite.All) within the API registration of InventoryAPI, and assign it to the daemon's service principal as an application permission.
This allows the daemon to authenticate using client credentials flow and obtain tokens containing the required application role.

Anahtar Kavram

Microsoft Entra ID distinguishes between Delegated permissions (used when a signed-in user is present) and Application permissions (used by background daemons or services without a signed-in user). API creators expose delegated permissions as scopes and application permissions as App Roles.
Soru 115Soru

You are developing a backend service in C# using MSAL.NET that runs on an Azure App Service. The App Service has a user-assigned managed identity configured with the Client ID `d29d3368-8f83-4a25-97a1-872f23cf9e3c`. The service must securely access an Azure Key Vault without storing any secrets or certificates in the application configuration. Which two configuration steps should you implement in the C# code? (Select two.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Initialize the managed identity application by calling `ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedClientId("d29d3368-8f83-4a25-97a1-872f23cf9e3c")).Build()`; Acquire the token by calling `app.AcquireTokenForManagedIdentity("https://vault.azure.net/.default").ExecuteAsync()` on the initialized application instance

Cevap

Initialize the managed identity application by calling ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedClientId("d29d3368-8f83-4a25-97a1-872f23cf9e3c")).Build(), and acquire the token by calling app.AcquireTokenForManagedIdentity("https://vault.azure.net/.default").ExecuteAsync() on the initialized application instance.
To authenticate using a user-assigned managed identity via MSAL.NET, you must initialize the application using ManagedIdentityApplicationBuilder with ManagedIdentityId.WithUserAssignedClientId to specify the client ID. Once configured, you must call AcquireTokenForManagedIdentity on the application instance to acquire a token for the Azure Key Vault resource scope.

Adım Adım Çözüm

1
Determine the identity type and configure the application builder
Identify that the application uses a user-assigned managed identity requiring its Client ID. Initialize the application using ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedClientId(...)).Build().
ManagedIdentityApplicationBuilder is the specific class in MSAL.NET designed to acquire tokens for managed identities without client secrets or certificates.
2
Request the access token for the target Azure service
Call the AcquireTokenForManagedIdentity method on the initialized application instance, passing the default scope for Azure Key Vault (https://vault.azure.net/.default), and execute it asynchronously.
AcquireTokenForManagedIdentity is the correct MSAL.NET method for retrieving tokens from the local managed identity endpoint for a given resource.

Anahtar Kavram

Configuring MSAL.NET to acquire tokens using a user-assigned managed identity with its Client ID.
Soru 116Soru

An organization has a web application that provides temporary write access to an Azure Blob Storage container named `uploads` for external clients. You must meet the following requirements:
- Enable the security team to revoke access tokens immediately without impacting other clients or rotating the storage account keys.
- Limit the lifetime of individual client tokens to a maximum of 30 minutes.
- Enforce the use of secure connections only.

Which two actions should you perform to meet these requirements?

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Create a stored access policy on the container and specify the policy identifier when generating a service-level SAS token.; Set the allowed protocols on the stored access policy or the generated SAS token to HTTPS only.

Cevap

Create a stored access policy on the container and specify the policy identifier when generating a service-level SAS token, and set the allowed protocols on the stored access policy or the generated SAS token to HTTPS only.
The correct actions are to create a stored access policy on the container and reference it when generating a service-level SAS, and to enforce HTTPS only on the policy or token. A stored access policy allows for immediate revocation of the associated SAS tokens by modifying or deleting the policy. Restricting the protocol to HTTPS ensures all transit is encrypted.

Adım Adım Çözüm

1
Analyze the requirement for immediate token revocation without rotating the storage account keys.
Identify that a stored access policy on the container is required because deleting or modifying the policy immediately revokes any associated service-level SAS tokens.
This satisfies the revocation requirement without impacting other clients or requiring a key rotation.
2
Analyze the requirement for secure connections.
Configure the SAS token or stored access policy to enforce HTTPS only.
This blocks any unencrypted HTTP requests from clients.
3
Evaluate the options against account-level and user-delegated SAS tokens.
Recognize that account-level SAS tokens and SAS tokens signed with Microsoft Entra ID (user delegation) do not support stored access policies.
This rules out the incorrect configurations.

Anahtar Kavram

Implementing container-level stored access policies to manage and revoke Service Shared Access Signatures (SAS) with protocol constraints.
Soru 117Soru

You are developing a C# web application that runs on an Azure App Service. The application must retrieve database connection secrets from an Azure Key Vault. You have already enabled a system-assigned managed identity for the App Service.

You write the following code to access the Key Vault:

csharp
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;

// ...
var client = new SecretClient(new Uri("https://myvault.vault.azure.net/"), new DefaultAzureCredential());
var secret = await client.GetSecretAsync("DbConnectionString");

When you deploy and run the application in Azure, it fails to retrieve the secret and throws an exception indicating that access is forbidden.

Which of the following actions should you perform to resolve this error?

Cevabı ve açıklamayı göster

Cevap: Create an access policy in Azure Key Vault that grants the Get secret permission to the system-assigned managed identity of the App Service.

Cevap

Create an access policy in Azure Key Vault that grants the Get secret permission to the system-assigned managed identity of the App Service.
The correct answer is to create an access policy in Azure Key Vault that grants the Get secret permission to the system-assigned managed identity of the App Service. When the system-assigned managed identity is enabled, Azure automatically creates an enterprise application principal representing the App Service instance. DefaultAzureCredential automatically detects this identity when deployed to Azure and uses it to acquire tokens. However, the identity must be authorized to perform data plane operations on the Key Vault by defining an access policy or an RBAC role assignment.

Adım Adım Çözüm

1
Analyze the error context
The application successfully attempts to authenticate using the system-assigned managed identity, but receives a forbidden response.
This indicates that authentication succeeded, but authorization to access the Key Vault secrets is missing.
2
Configure the Key Vault access policy
Create a new Key Vault access policy matching the system-assigned managed identity's object principal ID, assigning the 'Get' permission under Secret Permissions.
The system-assigned managed identity is a service principal in Microsoft Entra ID and must be granted explicit permissions on the Key Vault data plane.
3
Verify DefaultAzureCredential behavior
No code changes are required because DefaultAzureCredential automatically searches for and utilizes the system-assigned managed identity in the App Service environment.
Ensuring code changes are minimized simplifies deployment and maintenance.

Anahtar Kavram

Azure Managed Identities and Azure Key Vault Authorization
Tahmini Süre:1m 30s
Soru 118Soru

You are developing a Single Page Application (SPA) named SalesPortal and a backend Web API named SalesAPI. You register both applications in Microsoft Entra ID. SalesPortal runs in the user's web browser and must call SalesAPI to retrieve the signed-in user's sales data. You need to configure the applications to ensure SalesPortal can access SalesAPI on behalf of the signed-in user while adhering to the principle of least privilege. Which action should you perform to configure the required permissions?

Cevabı ve açıklamayı göster

Cevap: In the SalesAPI registration, expose an API scope named Sales.Read. In the SalesPortal registration, request a Delegated permission for the SalesAPI Sales.Read scope.

Cevap

In the SalesAPI registration, expose an API scope named Sales.Read. In the SalesPortal registration, request a Delegated permission for the SalesAPI Sales.Read scope.
To allow a Single Page Application (SPA) to access a custom Web API on behalf of a signed-in user, you must expose an API scope on the API's app registration (such as Sales.Read) and request it as a delegated permission on the client application registration. This ensures the app operates under the user's security context and permissions.

Adım Adım Çözüm

1
Identify the application architecture and authentication flow requirements.
The application is a browser-based SPA calling a backend API, which requires the OAuth 2.0 authorization code flow with PKCE and delegated permissions (acting on behalf of the user).
Understanding the flow dictates that delegated permissions rather than application permissions or managed identities are required.
2
Expose a custom scope on the API application registration.
The SalesAPI registration exposes a scope such as Sales.Read, defining what permissions the client application can request.
Before a client application can request a delegated permission, the API must declare the available scopes in Entra ID.
3
Request the exposed scope as a delegated permission on the client application registration.
The SalesPortal registration requests the SalesAPI's Sales.Read delegated scope, allowing users to consent to this permission.
This links the client's request to the API's exposed capability, fulfilling the security configuration.

Anahtar Kavram

Delegated permissions and scopes in Microsoft Entra ID are used when an application needs to access resources on behalf of a signed-in user.
Soru 119Soru

You are developing a Single Page Application (SPA) using React and MSAL.js 2.x2.\text{x}. The application must authenticate users using the Microsoft Identity Platform and call a downstream secured Microsoft Graph API. You register the application in the Microsoft Entra admin center. Under the Authentication blade, you add a redirect URI of `http://localhost:3000` but configure the platform type as Web instead of Single-page application. During testing, users can successfully sign in and the application receives an authorization code. However, when the application attempts to exchange the authorization code for an access token, the token endpoint returns an error. You need to resolve the error and ensure that the application can successfully acquire access tokens. Which of the following actions should you perform?

Cevabı ve açıklamayı göster

Cevap: In the app registration, change the redirect URI platform type from Web to Single-page application.

Cevap

Change the redirect URI platform type from Web to Single-page application in the app registration.
The correct action is to change the redirect URI platform type from Web to Single-page application. Microsoft Identity Platform requires browser-based SPAs to use the Single-page application platform type, which supports the Authorization Code Flow with Proof Key for Code Exchange (PKCE). This configuration allows the token endpoint to safely exchange the authorization code for an access token without requiring a client secret, which cannot be kept secure in a browser-based environment.

Adım Adım Çözüm

1
Identify the client application type and the authentication requirements.
The application is a browser-based Single Page Application (SPA) requiring user login and token acquisition for Microsoft Graph.
Understanding the application architecture helps in selecting the correct OAuth 2.0 flow.
2
Determine why the token exchange request is failing when using the 'Web' platform registration.
The 'Web' platform registration expects a client secret for authorization code redemption, which the SPA cannot provide.
Public clients like SPAs cannot securely store credentials on the client-side.
3
Select the correct platform registration configuration in Microsoft Entra ID.
Configure the platform type as 'Single-page application' (SPA) to enable the Authorization Code Flow with PKCE.
The SPA platform registration tells Microsoft Identity Platform to allow public token exchange without a client secret.

Anahtar Kavram

Single-page application platform registration and PKCE flow requirements in Microsoft Entra ID.
Tahmini Süre:2m 0s
Soru 120Soru

You are developing a secure application in C# that interacts with an Azure Storage account. The application must generate a Shared Access Signature (SAS) token to grant an external service temporary read and write permissions to a private blob container named invoices. The solution must meet the following security requirements:

- Access must be limited to HTTPS only.
- The storage account access keys must not be exposed or used to sign the SAS.
- The SAS must be valid for exactly two hours, starting immediately, while accounting for potential clock synchronization differences between clients and Azure.

Which two actions should you perform to create the SAS token? (Select two.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Request a user delegation key from the BlobServiceClient using an Azure AD credential such as DefaultAzureCredential.; Set the StartsOn property of the BlobSasBuilder to 10 minutes prior to the current UTC time.

Cevap

To secure the SAS without exposing account keys and to handle potential clock synchronization issues, you must request a user delegation key using Azure AD credentials and set the start time of the SAS builder to 10 minutes in the past.
A User Delegation SAS uses Azure AD credentials (e.g. DefaultAzureCredential) to secure the token, which avoids exposing storage account access keys. Setting the start time 10 minutes in the past ensures the token is immediately valid even if client and server clocks are out of sync (clock skew).

Adım Adım Çözüm

1
Acquire credentials using Azure Active Directory to sign the token.
A user delegation key is requested via the BlobServiceClient.
This avoids using or exposing the storage account access keys directly.
2
Set the start time of the token builder in the past.
The StartsOn property is configured to 10 minutes prior to the current time.
This accounts for clock skew between the client machines and Azure infrastructure.
3
Configure the allowed protocol.
The Protocol property is set to Https only.
This ensures compliance with security guidelines to forbid unencrypted HTTP traffic.

Anahtar Kavram

User Delegation SAS configuration and clock skew mitigation
ÖncekiSayfa 6 / 11Sonraki