Implement Azure Security

203 soru

Soru 141Soru

A developer is configuring a multi-tenant web application named AppRegister in Microsoft Entra ID. The application must allow users from any organizational tenant to authenticate. However, the application must prevent users with personal Microsoft accounts (MSA) from signing in. Which two configurations should the developer implement to meet these requirements?

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

Cevabı ve açıklamayı göster

Cevap: Set the signInAudience parameter in the application manifest to AzureADMultipleOrgs.; Configure the application to direct authentication requests to the /organizations endpoint.

Cevap

Setting the signInAudience parameter in the application manifest to AzureADMultipleOrgs and directing authentication requests to the /organizations endpoint.
To configure a multi-tenant application that supports only work or school accounts from any organization and excludes personal Microsoft accounts, the signInAudience parameter in the application manifest must be set to AzureADMultipleOrgs. Additionally, the application must send authorization requests to the /organizations endpoint. The /common endpoint and the AzureADandPersonalMicrosoftAccount audience value would allow personal Microsoft accounts to authenticate, which violates the requirement.

Adım Adım Çözüm

1
Identify the audience requirement for the application registration.
The application must allow any organization's tenant but exclude personal Microsoft accounts.
This filters out single-tenant settings and configurations that permit personal accounts.
2
Select the correct signInAudience value in the manifest.
AzureADMultipleOrgs must be selected.
AzureADMultipleOrgs supports multiple organizational tenants and explicitly excludes personal accounts, unlike AzureADandPersonalMicrosoftAccount.
3
Select the correct Microsoft Entra ID authorization endpoint.
The /organizations endpoint must be chosen.
The /organizations endpoint restricts login to work or school accounts, whereas the /common endpoint permits personal accounts.

Anahtar Kavram

Multi-tenant Applications Configuration
Soru 142Soru

An organization is deploying an ASP.NET Core web application to an Azure App Service. The application must retrieve a database password from an Azure Key Vault named `kv-finance-prod`. The Key Vault's permission model is configured to use Azure role-based access control (Azure RBAC). The App Service has a system-assigned managed identity enabled.

During testing, the application's C# code throws a `RequestFailedException` with an HTTP `403 Forbidden` error when calling `SecretClient.GetSecretAsync`.

You need to resolve this authorization issue using the principle of least privilege.

Which of the following actions should you perform?

Cevabı ve açıklamayı göster

Cevap: Assign the Key Vault Secrets User role to the App Service's system-assigned managed identity at the Key Vault scope.

Cevap

Assign the Key Vault Secrets User role to the App Service's system-assigned managed identity at the Key Vault scope.
Assigning the Key Vault Secrets User role to the App Service's system-assigned managed identity at the Key Vault scope is the correct solution because it grants the identity the necessary data-plane permissions to read secret values, and it adheres to the principle of least privilege. Because the Key Vault is configured with the Azure RBAC permission model, Azure RBAC roles must be used instead of classic access policies.

Adım Adım Çözüm

1
Identify the Key Vault permission model.
The Key Vault uses the Azure RBAC model, meaning vault access policies cannot be used to grant data-plane access.
Determines the correct authorization mechanism to configure.
2
Determine the required permission level.
The application needs to read secret values using `SecretClient.GetSecretAsync`.
Allows selecting a role that matches the required data action.
3
Select the least-privilege role and target identity.
Select the Key Vault Secrets User role and assign it to the App Service's system-assigned managed identity at the Key Vault scope.
Ensures the application has read-only access to secrets without administrative or metadata-only access.

Anahtar Kavram

Assigning appropriate Azure RBAC roles to managed identities for Key Vault secrets retrieval
Tahmini Süre:1m 30s
Soru 143Soru

You are deploying a Java Spring Boot application to an Azure App Service (Linux). The application loads its configuration settings from an Azure App Configuration store using the Spring Cloud Azure App Configuration library. The App Configuration store contains a key named `/application/payment-gateway-key` configured as a Key Vault reference that points to a secret in an Azure Key Vault named `kv-payment-prod`. A system-assigned managed identity is enabled on the App Service. When the application starts, it throws an authorization exception while trying to resolve the Key Vault reference.

Which of the following configurations is required to successfully resolve the secret value at runtime?

Cevabı ve açıklamayı göster

Cevap: Grant the App Service's system-assigned managed identity the App Configuration Data Reader role on the Azure App Configuration store, and grant the same identity the Key Vault Secrets User role on the Azure Key Vault.

Cevap

The correct configuration requires granting the App Service's system-assigned managed identity the App Configuration Data Reader role on the App Configuration store and the Key Vault Secrets User role on the Key Vault.
The correct answer is the configuration where the App Service's system-assigned managed identity is granted App Configuration Data Reader on the App Configuration store and Key Vault Secrets User on the Key Vault. The client application provider library loads the Key Vault reference metadata (specifically the URI) from the App Configuration store and then connects directly to the Key Vault to resolve the secret value using its own managed identity. Thus, the App Service identity needs read access to both resources.

Adım Adım Çözüm

1
Enable a system-assigned managed identity on the Azure App Service host.
An identity is created in Microsoft Entra ID representing the App Service instance.
This identity will be used to authenticate requests to both Azure App Configuration and Azure Key Vault.
2
Grant the App Service's managed identity the App Configuration Data Reader role on the App Configuration store.
The application can authenticate and retrieve configuration key-values, including the Key Vault reference metadata.
The application needs access to read configuration keys before it can resolve references.
3
Grant the App Service's managed identity the Key Vault Secrets User role on the Azure Key Vault.
The application can retrieve the secret payload directly from the Key Vault.
Key Vault references are resolved on the client side; the application identity, not the App Configuration store, must have permission to access the secret.

Anahtar Kavram

Azure App Configuration Key Vault Reference Resolution Process
Soru 144Soru

An organization is configuring a custom domain for a web application. You need to create an SSL/TLS certificate in Azure Key Vault by using a non-integrated Certificate Authority (CA). Which sequence of steps should you perform to complete this process? To answer, drag the appropriate actions from the list of actions to the answer area and arrange them in the correct sequence.

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

Cevabı ve açıklamayı göster

Cevap

The correct sequence of steps is: First, create a certificate in Azure Key Vault with the policy set to use a non-integrated CA (Issuer Name set to Unknown). Second, download the Certificate Signing Request (CSR) file from the pending certificate. Third, submit the CSR to your external Certificate Authority (CA) and download the signed certificate. Finally, merge the signed certificate into the pending certificate request in Azure Key Vault.
To create a certificate in Azure Key Vault using a non-integrated CA, you must first initiate the request in Key Vault by setting the issuer to Unknown. This generates a private key and a CSR within Key Vault. Next, you download the CSR to submit it to the external CA. Once the CA issues the signed certificate, you merge it back into the pending request to pair it with the private key.

Adım Adım Çözüm

1
Create the certificate with the issuer set to Unknown.
Azure Key Vault generates a key pair and a CSR, and sets the certificate status to pending.
This is the initial step required to generate the CSR within Key Vault's secure boundary.
2
Retrieve the CSR from the pending certificate.
The CSR file (.csr or PEM format) is downloaded.
The CSR contains the public key and identity information that must be signed by the external CA.
3
Submit the CSR to the CA and retrieve the signed certificate.
A signed public certificate (.cer or .crt file) is obtained from the CA.
The external CA validates ownership and issues the signed certificate.
4
Merge the signed certificate in Azure Key Vault.
The pending certificate status changes to active, associating the private key with the signed certificate.
This finalizes the certificate creation process inside the Key Vault.

Anahtar Kavram

Azure Key Vault Certificate Lifecycle Management with Non-Integrated CA
Soru 145Soru

You are designing a secure backend service that provides external audit applications with temporary access to read audit logs stored in a specific Azure Blob Storage container. You decide to generate a Shared Access Signature (SAS) token.

The solution must meet the following security requirements:
- Minimize the risk of compromising the storage account's root access keys.
- Prevent the external application from listing other blobs or deleting logs.
- Enforce secure transmission protocols.
- Restrict access to a specific external IP range: 198.51.100.0/24.

Which two of the following configuration options should you implement to meet the requirements?

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

Cevabı ve açıklamayı göster

Cevap: Generate a User Delegation SAS using a Microsoft Entra ID user principal or managed identity that has the Storage Blob Data Reader role on the container.; Set the SAS protocol constraint to HTTPS only and restrict the allowed IP range to 198.51.100.0/24.

Cevap

The correct options are generating a User Delegation SAS using a Microsoft Entra ID principal with the Storage Blob Data Reader role, and setting the protocol to HTTPS only with the specified IP range restriction.
Generating a User Delegation SAS secured by Microsoft Entra ID prevents exposure of the storage account key. Restricting the SAS to HTTPS only and scoping the IP address range ensures encrypted data transmission and boundaries to the client's network.

Adım Adım Çözüm

1
Determine the authentication mechanism that avoids exposing primary or secondary storage account keys.
Identify that User Delegation SAS, which is secured by Microsoft Entra ID credentials, meets the key protection requirement.
Using Account or Service SAS relies on access keys, which introduces security risks if exposed.
2
Select the appropriate RBAC role and scope for the identity generating the User Delegation SAS.
Assign Storage Blob Data Reader to the generating identity at the container level.
This restricts the generated SAS token to read-only permissions on a specific container, following the least privilege principle.
3
Configure the network and transport constraints on the SAS token builder.
Enforce HTTPS protocol and restrict the allowed IP range to the auditor's IP block (198.51.100.0/24).
Enforcing HTTPS secures the channel, and IP restriction limits access origin, reinforcing the perimeter defense.

Anahtar Kavram

Shared Access Signatures and Token-based Storage Security
Soru 146Soru

Your organization is migrating the permission model of an Azure Key Vault named `kv-payment-prod` to use the Azure role-based access control permission model instead of Vault access policies. An Azure App Service web application named `app-payment-prod` uses a system-assigned managed identity to retrieve database connection secrets from this Key Vault. Immediately after you change the permission model to Azure RBAC, the web application fails to retrieve secrets, returning a `403 Forbidden` error. Which action should you perform to restore the application's access to the secrets while adhering to the principle of least privilege?

Cevabı ve açıklamayı göster

Cevap: Assign the Key Vault Secrets User role to the system-assigned managed identity of the App Service at the Key Vault scope.

Cevap

Assign the Key Vault Secrets User role to the system-assigned managed identity of the App Service at the Key Vault scope.
Assigning the Key Vault Secrets User role to the system-assigned managed identity at the Key Vault scope is correct because the Key Vault has been transitioned to the Azure RBAC permission model, where access policies are ignored. The Key Vault Secrets User role grants the necessary data-plane permissions (GET and LIST) to retrieve secrets, following the principle of least privilege.

Adım Adım Çözüm

1
Identify the active authentication identity of the App Service.
The application uses its system-assigned managed identity to authenticate against Azure Active Directory (Microsoft Entra ID).
We must grant permissions to the exact identity that requests token generation for accessing the Key Vault.
2
Determine the required permission scope and role.
The application needs to read secret values. Under Azure RBAC, the built-in role that allows reading secrets is the Key Vault Secrets User role.
Adhering to the principle of least privilege means avoiding broader roles like Key Vault Administrator or Key Vault Secrets Officer.
3
Assign the role using the Azure portal, CLI, or PowerShell.
The Key Vault Secrets User role is assigned to the system-assigned managed identity at the Key Vault resource scope.
This links the managed identity to the data-plane permission required to perform Key Vault GET operations on secrets.

Anahtar Kavram

Azure Key Vault RBAC permission model and data-plane role assignment
Tahmini Süre:1m 30s
Soru 147Soru

You are configuring an Azure App Service web application to retrieve a third-party payment provider API key stored as a secret in Azure Key Vault. The Key Vault, named kv-payment-prod, is configured to use the Azure role-based access control (Azure RBAC) permission model. The web application uses a system-assigned managed identity for authentication. You must reference the Key Vault secret directly within the App Service application settings under a setting named PaymentApiKey. You must follow the principle of least privilege. Which action should you perform to configure the application setting and permissions?

Cevabı ve açıklamayı göster

Cevap: Assign the Key Vault Secrets User role to the web application's system-assigned managed identity at the Key Vault scope, and set the value of the PaymentApiKey application setting to @Microsoft.KeyVault(SecretUri=https://kv-payment-prod.vault.azure.net/secrets/ApiKey/).

Cevap

Assign the Key Vault Secrets User role to the web application's system-assigned managed identity at the Key Vault scope, and set the value of the PaymentApiKey application setting to @Microsoft.KeyVault(SecretUri=https://kv-payment-prod.vault.azure.net/secrets/ApiKey/).
To allow the App Service to retrieve a secret from an Azure Key Vault configured with the Azure RBAC permission model, the application's system-assigned managed identity must be granted the Key Vault Secrets User role, which provides read access to the secret values. The App Service configuration reference must use the correct prefix @Microsoft.KeyVault(SecretUri=...) pointing to the secret's URI.

Adım Adım Çözüm

1
Determine the correct authorization role under the Azure RBAC model.
The Key Vault Secrets User role is selected as it grants the necessary data-plane permissions to read secret values, satisfying the principle of least privilege.
Other roles like Key Vault Reader do not grant access to the secret contents.
2
Formulate the App Service Key Vault reference syntax.
The syntax must follow the pattern @Microsoft.KeyVault(SecretUri=...) containing the full URI of the secret.
Incorrect prefixes such as @KeyVault(...) will prevent the App Service from resolving the reference.
3
Apply the configurations to the App Service setting.
Configure the system-assigned managed identity of the App Service with the Key Vault Secrets User role, and assign the valid Key Vault reference string to the PaymentApiKey setting.
This completes the authorization and reference mapping without requiring legacy access policies.

Anahtar Kavram

Azure Key Vault references in App Service configuration combined with Azure RBAC authorization.
Soru 148Soru

You are configuring security for an Azure Blob Storage container named `partner-imports` that multiple external clients use to upload diagnostic data. Each client requires write-only permissions. You must ensure that you can immediately revoke access for any individual client if their credentials are leaked, without affecting other clients and without rotating the storage account access keys. Which configuration should you use?

Cevabı ve açıklamayı göster

Cevap: A Service SAS associated with a unique Stored Access Policy for each client.

Cevap

A Service SAS associated with a unique Stored Access Policy for each client.
A Stored Access Policy (SAP) defines constraints on the container level. When a Service SAS is associated with an SAP, Azure Storage validates the SAS against the policy. Modifying or deleting the SAP immediately invalidates all Service SAS tokens associated with it. By using a unique SAP for each client, you can revoke access for an individual client by deleting or modifying their specific policy without affecting others.

Adım Adım Çözüm

1
Analyze the revocation and isolation requirements for external client access to Azure Blob Storage.
Identified that rotating the storage account access keys is not permitted, and revoking one client must not impact other clients.
This eliminates solutions that rely on account-level key rotation or shared credentials.
2
Evaluate the capability of ad-hoc Shared Access Signatures (SAS) to meet the revocation requirement.
Ad-hoc SAS tokens (whether Service or Account level) cannot be individually revoked before their expiration time without rotating the storage account key used to sign them.
Ad-hoc tokens do not have an external control mechanism once issued.
3
Select a mechanism that supports individual token invalidation without key rotation.
Stored Access Policies (SAPs) allow changing permissions or expiration times, or deleting the policy entirely, which instantly invalidates any associated Service SAS tokens.
Using a unique Stored Access Policy for each client provides the required isolation and instant revocation capability.

Anahtar Kavram

Stored Access Policies for Service SAS Revocation
Soru 149Soru

You are authoring a Bicep template to deploy a new Azure Key Vault. The Key Vault must meet the following security requirements:

* Use Azure Role-Based Access Control (RBAC) for authorization instead of vault access policies.
* Prevent the permanent deletion of the Key Vault, its secrets, keys, and certificates by any user, including administrators.

Which two properties must you configure within the `properties` block of the Key Vault resource definition?

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

Cevabı ve açıklamayı göster

Cevap: `enableRbacAuthorization` set to `true`; `enablePurgeProtection` set to `true`

Cevap

Configure `enableRbacAuthorization` set to `true` and `enablePurgeProtection` set to `true`.
To configure Azure Key Vault via a Bicep/ARM template for Azure RBAC authorization and prevent permanent deletion, you must configure two key properties within the vault's properties block: setting `enableRbacAuthorization` to `true` ensures that Azure RBAC is used for data-plane authorization, and setting `enablePurgeProtection` to `true` prevents the immediate purging of deleted items. This enforces the soft-delete retention policy and secures key vault content against accidental or malicious permanent deletion.

Adım Adım Çözüm

1
Enable Azure RBAC for key vault authorization by setting the `enableRbacAuthorization` property to `true` in the Bicep template's properties block.
This ensures that authorization is controlled via Azure Role-Based Access Control rather than traditional inline key vault access policies.
This directly satisfies the requirement to use Azure RBAC instead of vault access policies.
2
Enable purge protection by setting the `enablePurgeProtection` property to `true` in the properties block.
This prevents anyone, including administrators, from immediately and permanently deleting (purging) the Key Vault or any deleted secrets/keys/certificates before the soft-delete retention period expires.
This satisfies the security requirement to prevent permanent deletion of the vault and its objects.

Anahtar Kavram

Configuring Azure Key Vault properties in infrastructure-as-code templates to enforce RBAC authorization and purge protection.
Soru 150Soru

You are implementing a method in a C# application using the `Azure.Storage.Blobs` SDK (v12) to generate a temporary upload URI for a client. The client must be allowed to upload a single blob named `report.pdf` to a container named `documents`.

The implementation must meet the following security requirements:
- Limit permissions strictly to uploading the specified blob.
- Enforce the HTTPS protocol for the upload request.
- Sign the SAS using Microsoft Entra ID credentials rather than the storage account's shared access key.
- Prevent authentication failures due to clock skew between the client and Azure Storage.

You have the following code segment:

csharp
var credential = new DefaultAzureCredential();
var blobServiceClient = new BlobServiceClient(
new Uri("https://mystorage.blob.core.windows.net"),
credential
);

// [Block 1]

var sasBuilder = new BlobSasBuilder()
{
BlobContainerName = "documents",
BlobName = "report.pdf",
Resource = "b",
// [Block 2]
};
sasBuilder.SetPermissions(BlobSasPermissions.Write);

Which of the following code segments should you use to complete the implementation? (Select two.)

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

Cevabı ve açıklamayı göster

Cevap: For [Block 1]:
csharp
var userDelegationKey = await blobServiceClient.GetUserDelegationKeyAsync(
DateTimeOffset.UtcNow.AddMinutes(-15),
DateTimeOffset.UtcNow.AddHours(2)
);
; For [Block 2]:
csharp
StartsOn = DateTimeOffset.UtcNow.AddMinutes(-15),
ExpiresOn = DateTimeOffset.UtcNow.AddHours(2),
Protocol = SasProtocol.Https

Cevap

To generate a secure SAS using Microsoft Entra ID with clock skew allowance and HTTPS enforcement, you should obtain a User Delegation Key with a 15-minute start buffer and a 2-hour duration, and configure the BlobSasBuilder with corresponding start/expiration bounds and the HTTPS-only protocol option.
The correct implementation requires obtaining a User Delegation Key and setting up a BlobSasBuilder. To sign with Microsoft Entra ID, the application must use `GetUserDelegationKeyAsync` with a start time that accounts for clock skew (e.g., subtracting 15 minutes) and a duration matching the lifetime requirements. Similarly, the SAS builder must be configured to start 15 minutes prior to the current time, expire in 2 hours, and enforce HTTPS-only connections using `SasProtocol.Https`.

Adım Adım Çözüm

1
Obtain a User Delegation Key using Microsoft Entra ID credentials
The application calls GetUserDelegationKeyAsync on the BlobServiceClient.
Signing a SAS with Microsoft Entra ID (User Delegation SAS) is more secure than using the storage account key, as it respects Azure RBAC permissions and avoids exposing account access keys.
2
Account for potential clock skew during key generation
Set the start time of the User Delegation Key to 15 minutes in the past.
If the client's system clock is slightly ahead of the Azure Storage server clock, a token starting exactly at UtcNow will be rejected as not yet valid. A clock skew buffer prevents this.
3
Configure the BlobSasBuilder properties to restrict protocol and set correct lifetime limits
Assign StartsOn, ExpiresOn, and set Protocol to SasProtocol.Https.
This enforces HTTPS-only communication and ensures the token lifetime matches the 2-hour constraint while preserving the clock skew buffer.

Anahtar Kavram

Generating a User Delegation SAS token using Azure.Storage.Blobs SDK in .NET, applying least privilege, HTTPS enforcement, and clock skew mitigation.
Soru 151Soru

You are developing a C# command-line interface (CLI) tool that will be executed by system administrators on headless Linux servers. The tool must authenticate the administrators using their individual Microsoft Entra ID credentials to access a secure downstream Web API. The administrators' accounts have multi-factor authentication (MFA) enabled. Which MSAL.NET method should you use to acquire the token?

Cevabı ve açıklamayı göster

Cevap: IPublicClientApplication.AcquireTokenWithDeviceCode

Cevap

IPublicClientApplication.AcquireTokenWithDeviceCode
The method utilizing the Device Code flow is correct because it allows user authentication on headless or input-constrained devices by prompting the user to complete the login process, including any required Multi-Factor Authentication (MFA), on a separate device with a web browser.

Adım Adım Çözüm

1
Analyze the environment and constraints.
The application runs on a headless server without a web browser or GUI, and administrators must authenticate individually with MFA-enabled accounts.
This rules out interactive browser flows and non-interactive username/password flows which cannot complete MFA.
2
Identify the required identity type.
The requirement demands individual user authentication rather than application authentication.
This rules out client credential flows (service principals) which only authenticate the application itself.
3
Select the appropriate OAuth 2.0 flow.
The Device Authorization Grant (Device Code Flow) is selected because it permits interactive authentication on a secondary device while running on a headless machine.
Using the Device Code method allows the administrator to complete MFA safely on their primary workstation or phone.

Anahtar Kavram

Selecting the correct OAuth 2.0 authentication flow in MSAL.NET for input-constrained and headless environments.
Soru 152Soru

You are developing a C# console application that will run on multiple Azure Virtual Machines. The application must authenticate to the Microsoft Identity Platform and access Microsoft Graph using a managed identity. Because the application runs on multiple virtual machines, they must all share the same managed identity. You use MSAL.NET to implement the authentication code. You write the following code:

csharp
string clientId = "00000000-0000-0000-0000-000000000000";
string resource = "https://graph.microsoft.com";

// Initialize the managed identity application
IManagedIdentityApplication app = [Snippet 1]
.Build();

// Acquire the token
AuthenticationResult result = await app.[Snippet 2]
.ExecuteAsync();

Which two code segments should you use to complete the implementation? (Select two.)

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

Cevabı ve açıklamayı göster

Cevap: ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedClientId(clientId)); AcquireTokenForManagedIdentity(resource)

Cevap

Initialize the application using a user-assigned managed identity client ID and acquire the token using the dedicated managed identity token acquisition method.
To fulfill the requirement where multiple virtual machines share the same identity, a user-assigned managed identity must be used. In MSAL.NET, you instantiate this using the builder's Create method along with `ManagedIdentityId.WithUserAssignedClientId(clientId)`. To acquire the token, you must call the dedicated `AcquireTokenForManagedIdentity` method passing the resource URI.

Adım Adım Çözüm

1
Determine the type of managed identity required based on sharing requirements.
Since multiple virtual machines must share the identity, a user-assigned managed identity is selected.
System-assigned managed identities are locked to a single resource lifecycle and cannot be shared across resources.
2
Construct the managed identity configuration using the user-assigned client ID in MSAL.NET.
Use ManagedIdentityApplicationBuilder.Create with ManagedIdentityId.WithUserAssignedClientId.
This registers the user-assigned identity's client ID with the MSAL builder.
3
Use the correct token acquisition method for managed identity applications.
Invoke the AcquireTokenForManagedIdentity method on the application object.
Managed identity token requests in MSAL.NET use AcquireTokenForManagedIdentity rather than client credentials or public client methods.

Anahtar Kavram

Acquiring tokens via MSAL.NET using a user-assigned managed identity for shared workloads.
Tahmini Süre:2m 0s
Soru 153Soru

Your company requires all storage accounts containing sensitive client data to comply with a security policy that limits the maximum validity period of Shared Access Signatures (SAS) signed with account keys to 4 hours. You have configured a SAS lifetime policy on the storage account named clientdata.

A developer generates an ad-hoc Service SAS token for a blob in this storage account with a validity period of 12 hours.

What is the result when a client attempts to read the blob using this Service SAS token 1 hour after it was generated?

Cevabı ve açıklamayı göster

Cevap: The request fails with an HTTP 403 (Forbidden) error because the validity period of the SAS token exceeds the maximum limit configured in the SAS lifetime policy.

Cevap

The request fails with an HTTP 403 (Forbidden) error because the validity period of the SAS token exceeds the maximum limit configured in the SAS lifetime policy.
The correct answer is that the request fails with a 403 (Forbidden) error. SAS lifetime policies limit the maximum expiration time allowed for SAS tokens signed with account keys. Because these tokens are generated offline, the policy is evaluated and enforced when a client presents the token for authorization. A token with an expiration exceeding the policy limit fails authorization completely.

Adım Adım Çözüm

1
Determine the scope of the SAS lifetime policy.
The SAS lifetime policy configured on the storage account applies to any SAS token (Service or Account) signed with the account keys, limiting the maximum validity period to 4 hours.
This establishes how the policy affects the generated 12-hour Service SAS token.
2
Analyze how SAS lifetime policies are enforced.
Since SAS tokens signed with account keys are created client-side, Azure Storage has no visibility into their generation. Consequently, the policy is enforced when a client presents the token for authorization.
This explains why the token was successfully generated but will fail during consumption.
3
Compare the token validity period with the allowed policy limit.
The token validity period is 12 hours, which exceeds the 4-hour limit. Since it violates the policy, Azure Storage returns an HTTP 403 (Forbidden) error during request authorization, regardless of when the request is sent.
This confirms the final outcome when the client attempts to access the resource.

Anahtar Kavram

Azure Storage SAS lifetime policies restrict the maximum allowed expiration period of SAS tokens signed with account keys, and this policy is enforced during request authorization.
Soru 154Soru

You are developing an Azure Function App in C# that needs to retrieve a third-party API key stored as a secret in an Azure Key Vault. The Function App must authenticate to Key Vault securely using a system-assigned managed identity, adhering to the principle of least privilege.

Which five actions should you perform in sequence to configure the resources and write the code? To answer, arrange all the actions from the list of actions to the correct order.

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

Cevabı ve açıklamayı göster

Cevap

To retrieve the secret securely, first enable the system-assigned managed identity on the Function App. Next, assign the Key Vault Secrets User RBAC role to this identity to grant read access. In the code, instantiate a DefaultAzureCredential, pass it to initialize a SecretClient, and then call GetSecretAsync to retrieve the secret value.
The correct sequence begins by provisioning the identity, granting it read-only permissions via RBAC (Key Vault Secrets User), instantiating the credential provider (DefaultAzureCredential), initializing the Key Vault client (SecretClient), and executing the secret retrieval request.

Adım Adım Çözüm

1
Enable the system-assigned managed identity on the Function App.
A service principal is created in Microsoft Entra ID representing the Function App.
This establishes the identity context that will be authorized to access Key Vault.
2
Assign the Key Vault Secrets User RBAC role to the Function App's identity on the Key Vault.
The identity receives the minimum required permissions to read secrets.
Azure RBAC requires a security principal to grant permissions. You must use the Key Vault Secrets User role for least privilege secret reading.
3
Instantiate a DefaultAzureCredential object in the C# code.
A token credential pipeline is created.
The DefaultAzureCredential class automatically discovers the managed identity when deployed to Azure.
4
Instantiate a SecretClient passing the Key Vault URI and the DefaultAzureCredential.
A SecretClient instance is initialized.
The SecretClient from the Azure.Security.KeyVault.Secrets library handles all API operations against Key Vault.
5
Call the GetSecretAsync method on the SecretClient.
The secret containing the API key is retrieved.
This makes the actual network call to Key Vault to return the secret value.

Anahtar Kavram

Establishing a secure connection from an Azure Function App to Azure Key Vault using modern C# SDKs and a managed identity with role-based access control.
Soru 155Soru

A C# daemon application runs as a Windows Service on an on-premises server. The application must authenticate to the Microsoft Identity Platform without user interaction and query directory metadata from Microsoft Graph. You configure the application registration in Microsoft Entra ID with the Directory.Read.All Application permission, and an administrator grants tenant-wide consent. In your code, you instantiate an IConfidentialClientApplication instance. Which string array should you pass as the scopes argument to the AcquireTokenForClient method to successfully retrieve the access token?

Cevabı ve açıklamayı göster

Cevap: new string[] { "https://graph.microsoft.com/.default" }

Cevap

The string array containing 'https://graph.microsoft.com/.default'
For the Client Credentials flow (AcquireTokenForClient), the Microsoft Identity Platform requires the scopes parameter to be the resource root URL followed by '/.default' (e.g., 'https://graph.microsoft.com/.default'). This triggers the token service to inspect the application registration and issue a token containing all application permissions consented to by the administrator. Statically defining and consenting to scopes is mandatory for daemon applications.

Adım Adım Çözüm

1
Analyze the authentication flow specified in the scenario.
The application is a daemon application running as a Windows Service without user interaction, which dictates the use of the Client Credentials flow (Confidential Client Application flow).
Choosing the correct OAuth 2.0 flow is necessary to determine the token acquisition method and scope requirements.
2
Determine the scope requirement for the Client Credentials flow in the Microsoft Identity Platform.
In the Client Credentials flow, permissions are statically assigned during app registration and must be consented by an administrator. Consequently, MSAL.NET requires requesting the resource root followed by '/.default' to obtain all pre-consented permissions.
Requesting individual scopes like Directory.Read.All at runtime is not supported in the Client Credentials flow and results in a runtime error.
3
Construct the correct scope array argument for MSAL.NET.
The correct argument is a string array containing 'https://graph.microsoft.com/.default'.
This matches the required format for requesting token scopes on behalf of the application itself.

Anahtar Kavram

Microsoft Identity Platform Client Credentials flow requires the '/.default' scope pattern to request statically consented application permissions.
Tahmini Süre:1m 30s
Soru 156Soru

An internal audit team requires temporary, read-only access to log files stored in a private blob container named `applogs`. You are writing the C# backend code to generate a Shared Access Signature (SAS) token for their client software.

The security policy dictates the following constraints:
- The token must be signed using Microsoft Entra ID credentials, avoiding the use of storage account keys.
- Connections must be restricted to HTTPS.
- Access must be limited specifically to the client software's outbound IP address of `203.0.113.88`.

Which of the following configurations or code steps are required to generate this SAS token? (Select TWO).

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

Cevabı ve açıklamayı göster

Cevap: Generate a User Delegation SAS by retrieving a User Delegation Key using a BlobServiceClient authenticated with Microsoft Entra ID credentials.; Set the Protocols property of the BlobSasBuilder instance to SasProtocol.HttpsOnly.

Cevap

Generating a User Delegation SAS using a User Delegation Key and configuring the BlobSasBuilder's Protocols property to HttpsOnly are both required.
Generating a User Delegation SAS signed with Microsoft Entra ID credentials meets the requirement to avoid storage account keys, and setting the Protocols property to HttpsOnly enforces secure connections.

Adım Adım Çözüm

1
Select the correct SAS type based on the identity requirement.
A User Delegation SAS is chosen because it is signed using Microsoft Entra ID credentials rather than the account keys.
This aligns with security best practices and meets the specific requirement to sign using Entra ID credentials.
2
Configure connection protocol constraints on the SAS builder.
Set the Protocols property of the BlobSasBuilder to SasProtocol.HttpsOnly.
This guarantees that the generated SAS token will reject non-HTTPS requests, ensuring data in transit is encrypted.
3
Apply client IP restrictions to the SAS builder.
Assign a SasIPRange containing only the single IP address 203.0.113.88 to the IPRange property of the BlobSasBuilder.
This enforces least privilege by ensuring only the specific client IP can use the token.

Anahtar Kavram

Shared Access Signatures (SAS) security configurations including User Delegation SAS, HTTPS protocol enforcement, and client IP constraints.
Soru 157Soru

You are developing a secure backend service in C# using the Azure.Storage.Blobs SDK (v12) to grant temporary access for clients to upload diagnostic files to a private Azure Blob Storage container.

Your company enforces the following security requirements:
- Storage account access keys must not be used or loaded by the application; access must be authenticated via Microsoft Entra ID.
- Clients must only be permitted to write new files; they must not be allowed to read, list, or delete existing files.
- All client connections must be encrypted using HTTPS.
- The SAS token must be valid immediately upon generation, accounting for potential clock synchronization differences between the server and clients.

You write the following code segment:

csharp
// blobServiceClient is an authenticated BlobServiceClient using DefaultAzureCredential
var userDelegationKey = await blobServiceClient.GetUserDelegationKeyAsync(
DateTimeOffset.UtcNow.AddMinutes(-15),
DateTimeOffset.UtcNow.AddHours(2)
);

var sasBuilder = new BlobSasBuilder
{
BlobContainerName = "diagnostics",
BlobName = "log.txt",
Resource = "b"
};

Which code segment should you use to complete the SAS configuration and token generation?

Cevabı ve açıklamayı göster

Cevap: sasBuilder.StartsOn = DateTimeOffset.UtcNow.AddMinutes(-15);
sasBuilder.ExpiresOn = DateTimeOffset.UtcNow.AddMinutes(45);
sasBuilder.Protocol = SasProtocol.Https;
sasBuilder.SetPermissions(BlobSasPermissions.Write);

string sasToken = sasBuilder.ToSasQueryParameters(userDelegationKey, blobServiceClient.AccountName).ToString();

Cevap

The correct code segment configures the SAS token for HTTPS only, grants Write permission, adjusts the start time backwards to account for clock skew, and uses the User Delegation Key signed with Microsoft Entra ID to generate the query parameters.
The correct segment sets the protocol strictly to HTTPS, restricts access to write-only permissions, applies a negative offset to the start time to mitigate clock skew, and signs the token with the User Delegation Key to satisfy the Microsoft Entra ID requirement.

Adım Adım Çözüm

1
Ensure keyless authentication using Microsoft Entra ID.
Obtained a UserDelegationKey using GetUserDelegationKeyAsync, and signed the SAS parameters using ToSasQueryParameters with the delegation key and the account name instead of StorageSharedKeyCredential.
Security policy forbids storing or utilizing storage account access keys in application code.
2
Configure the SAS permissions and protocols.
Set permissions strictly to BlobSasPermissions.Write and protocol to SasProtocol.Https.
Least-privilege policy mandates write-only access, and data in transit must be encrypted using HTTPS.
3
Adjust token lifetime constraints for clock skew.
Set StartsOn to 15 minutes in the past.
Prevents immediate authorization failures if the client clock is slightly ahead of the Azure Storage server clock.

Anahtar Kavram

Generating a User Delegation SAS token using Azure.Storage.Blobs .NET SDK with security configurations.
Tahmini Süre:1m 30s
Soru 158Soru

You are developing a C# desktop application that will run on local client workstations. The application must authenticate users using the Microsoft Identity Platform and call a secured downstream Web API. You need to write the MSAL.NET code to initialize the application and acquire the access token. Which two code segments should you use? (Select two.)

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

Cevabı ve açıklamayı göster

Cevap: var app = PublicClientApplicationBuilder.Create(clientId).WithRedirectUri("http://localhost").Build();; var result = await app.AcquireTokenInteractive(scopes).ExecuteAsync();

Cevap

To initialize the application and acquire the token, you must build a public client application using PublicClientApplicationBuilder and acquire the token interactively using AcquireTokenInteractive.
For desktop applications running on local user machines, the application is classified as a public client because it cannot securely store secrets. Therefore, it must be initialized using PublicClientApplicationBuilder. To authenticate the user and obtain an access token, the application should initiate an interactive flow using AcquireTokenInteractive, which prompts the user for credentials.

Adım Adım Çözüm

1
Determine the application type and build the client application.
Initialize a public client application using PublicClientApplicationBuilder because desktop apps running on local machines cannot securely protect secrets.
Public client applications do not use client secrets or certificates for authentication since they run on untrusted client devices.
2
Select the appropriate MSAL.NET token acquisition method.
Call AcquireTokenInteractive to prompt the user for credentials and acquire the token.
Interactive authentication is the standard method for acquiring user-delegated tokens in public client desktop applications.

Anahtar Kavram

Microsoft Identity Platform authentication for public client applications using MSAL.NET
Soru 159Soru

An Azure App Configuration store needs to retrieve a database password stored in an Azure Key Vault named kv-app-prod at runtime. The Key Vault uses the Azure Role-Based Access Control (RBAC) permission model. The App Configuration store has a system-assigned managed identity enabled. Which of the following actions should you perform to configure the App Configuration store to reference the Key Vault secret? (Select TWO.)

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

Cevabı ve açıklamayı göster

Cevap: Assign the 'Key Vault Secrets User' role to the system-assigned managed identity of the App Configuration store at the Key Vault scope.; Create a Key Vault reference in Azure App Configuration by providing the secret URI 'https://kv-app-prod.vault.azure.net/secrets/DbPassword'.

Cevap

Assign the 'Key Vault Secrets User' role to the system-assigned managed identity of the App Configuration store at the Key Vault scope, and create a Key Vault reference in Azure App Configuration by providing the secret URI.
To retrieve secrets from a Key Vault that uses Azure RBAC, the App Configuration store's managed identity must be assigned the 'Key Vault Secrets User' role. The App Configuration store references the secret using its direct URI.

Adım Adım Çözüm

1
Assign the 'Key Vault Secrets User' role to the App Configuration store's managed identity at the Key Vault scope.
The App Configuration store's identity is authorized to retrieve the secret.
The Key Vault uses Azure RBAC, making role assignment the only valid way to authorize the identity.
2
Create a Key Vault reference in App Configuration by specifying the secret URI.
App Configuration successfully resolves the secret at runtime using the authorized identity.
Key Vault references in App Configuration require the direct secret URI, not the App Service reference syntax.

Anahtar Kavram

Azure Key Vault Integration with Azure App Configuration under Azure RBAC
Soru 160Soru

You are developing a secure C# application using the `Azure.Storage.Blobs` SDK (v12) to generate a Shared Access Signature (SAS) token. The token will grant temporary access to an external partner to download a specific PDF report from a private Azure Blob Storage container.

The solution must comply with the following security constraints:
- Grant read-only access to the specific blob.
- Restrict communication to HTTPS requests only.
- Limit access to the partner's public IP address, which is `198.51.100.45`.
- Set the start time to 15 minutes before the current time to account for clock skew.
- Set the expiry time to 2 hours from the current time.

Which two of the following code segments should you use to configure the `BlobSasBuilder` instance named `sasBuilder`? (Choose two.)

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

Cevabı ve açıklamayı göster

Cevap: sasBuilder.Protocol = SasProtocol.Https;; sasBuilder.IPRange = SasIPRange.Parse("198.51.100.45");

Cevap

The correct configurations are setting the Protocol property to SasProtocol.Https and setting the IPRange property to SasIPRange.Parse("198.51.100.45").
The correct options are configuring the Protocol property of the BlobSasBuilder to Https to enforce secure-only transport, and parsing the single IP address using SasIPRange.Parse to restrict access to the partner's IP.

Adım Adım Çözüm

1
Analyze the HTTPS requirement.
The SAS token must restrict traffic to HTTPS. We use the SasProtocol.Https enumeration value.
Setting the Protocol property to Https ensures the storage service rejects any HTTP requests using this SAS.
2
Analyze the IP address restriction requirement.
The SAS token must restrict traffic to the specific IP address 198.51.100.45. We use SasIPRange.Parse("198.51.100.45") to configure the range.
Setting the IPRange property restricts requests to the specified IP address, rejecting requests from other sources.
3
Verify other requirements.
The start time, expiry, and permissions are correctly configured in the rest of the builder code, and the incorrect options are avoided.
Setting Write permissions violates read-only constraints, and using HttpsAndHttp violates the HTTPS-only restriction.

Anahtar Kavram

Configuring SAS tokens with least privilege, specific protocols, and IP restrictions using the Azure Storage SDK.
ÖncekiSayfa 8 / 11Sonraki
Implement Azure Security Alıştırma Soruları — Microsoft Azure Developer (AZ-204) — Sayfa 8 | Examkin