All practice questions

972 questions

Question 461Question

You are deploying a microservice named `order-service` to Azure Container Apps. The container image for the microservice is stored in a private Azure Container Registry (ACR) named `myregistry.azurecr.io`.

To ensure secure image retrieval, you must configure the Container App to pull the image using a user-assigned managed identity named `app-pull-identity`. The identity has already been granted the `AcrPull` role on the registry.

Which Bicep configuration block must you use to satisfy this requirement?

Show answer & explanation

Answer: identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/app-pull-identity': {}
}
}
properties: {
configuration: {
registries: [
{
server: 'myregistry.azurecr.io'
identity: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/app-pull-identity'
}
]
}
}

Answer

The configuration that sets the full resource ID of the user-assigned managed identity in both the identity block and the registries block is correct.
The correct configuration enables the user-assigned managed identity on the Container App resource by listing its resource ID under the userAssignedIdentities property and setting the type to 'UserAssigned'. It then specifies the same full resource ID in the registries configuration block under properties.configuration.registries. This instructs Azure Container Apps to use the designated user-assigned managed identity to authenticate and pull the image from the specified Azure Container Registry.

Step-by-Step Solution

1
Define the user-assigned managed identity on the Container App resource.
The identity type is set to 'UserAssigned' and the resource ID is added to the userAssignedIdentities dictionary.
Before an identity can be used to authenticate with a registry, it must be assigned to the resource.
2
Configure the registry authentication under properties.configuration.registries.
The registry server is set to 'myregistry.azurecr.io' and the identity is set to the full resource ID of the user-assigned identity.
For user-assigned identities, Azure Container Apps requires the full Azure resource ID to verify permissions and retrieve the token to pull the image.

Key Concept

Configuring registry authentication for Azure Container Apps using Bicep and user-assigned managed identities.
Question 462Question

You need to configure a local script to run nightly administrative tasks against Azure resources. The script must run non-interactively and authenticate using certificate-based authentication. Which sequence of steps must you perform to set up the authentication and test the connection?

Drag items to arrange them in the correct order

Show answer & explanation

Answer

To set up certificate-based authentication, you must first generate the self-signed certificate, register the application in Microsoft Entra ID, upload the certificate public key, assign the required RBAC role to the service principal, and finally execute the login command using the certificate details.
The correct sequence starts with generating a certificate locally to obtain a public key. Then, the application is registered in Microsoft Entra ID to establish its identity. Next, the public key is uploaded to the application registration so Microsoft Entra ID can verify credentials. After that, the service principal is assigned an RBAC role to grant the necessary resource permissions. Finally, the script executes the login command using the certificate path, verifying the configuration.

Step-by-Step Solution

1
Generate a self-signed certificate locally.
A private key (retained locally) and a public key certificate (.cer file) are created.
The public key certificate is required to configure the application registration credential.
2
Create the application registration in Microsoft Entra ID.
An application object and a corresponding service principal are created in the Microsoft Entra tenant.
This establishes the identity that will be used by the automation script.
3
Upload the public key (.cer) to the application registration's Certificates & secrets.
The public key is associated with the application registration.
This allows Microsoft Entra ID to validate authentication requests signed by the private key.
4
Assign an RBAC role to the service principal.
The service principal is authorized to perform operations on the specified Azure resources.
Establishing identity is not enough; the service principal must be explicitly authorized to access resources.
5
Run the login command with the certificate details.
The script successfully authenticates and receives an access token.
This verifies that the identity, credentials, and RBAC permissions are correctly configured.

Key Concept

Configuring certificate-based authentication for service principals to enable secure, non-interactive scripting and automation.
Question 463Question

An organization is deploying three separate Azure Function apps that all retrieve configuration secrets from a shared Azure Key Vault and query data from a shared Azure SQL Database. You need to configure managed identities for the application authentication. The solution must minimize administrative overhead for managing access control and ensure that deleting any individual Function app does not affect the permissions or credentials of the remaining apps. Which two actions should you perform? (Choose two.)

Select all that apply

Show answer & explanation

Answer: Create a single user-assigned managed identity and configure all three Azure Function apps to use this identity.; Grant the user-assigned managed identity the Key Vault Secrets User role on the Azure Key Vault and the db_datareader role on the Azure SQL Database.

Answer

Create a single user-assigned managed identity and configure all three Azure Function apps to use this identity, and grant the user-assigned managed identity the Key Vault Secrets User role on the Azure Key Vault and the db_datareader role on the Azure SQL Database.
The correct options are to create a single user-assigned managed identity and assign it to all three apps, and to grant it the Key Vault Secrets User and db_datareader roles. A user-assigned managed identity is a standalone Azure resource with an independent lifecycle that can be associated with multiple resources. This satisfies the requirement to minimize overhead and prevent accidental credential deletion. To read secrets and SQL database data, the identity needs explicit data plane permissions.

Step-by-Step Solution

1
Analyze the identity sharing and lifecycle requirements.
A user-assigned managed identity is selected because it is created as a standalone Azure resource and can be shared across multiple resources (minimizing permission overhead), and its lifecycle is independent of the individual Function apps.
System-assigned identities are tied to a single resource and cannot be shared, which increases management overhead.
2
Assign the correct data plane permissions to the shared identity.
The identity is granted data-plane roles: Key Vault Secrets User on the Key Vault and db_datareader in the SQL Database.
Management plane roles like Reader at the resource group level do not grant access to the actual secrets contained within the Key Vault.

Key Concept

User-assigned managed identities allow credentials and access control to be shared among multiple resources while maintaining a lifecycle independent of the resources themselves, whereas data-plane access requires specific data-plane roles rather than management-plane Reader roles.
Question 464Question

An enterprise Azure Function app is configured with a system-assigned managed identity. The application must perform envelope encryption on sensitive payloads before uploading them to Azure Blob Storage. A symmetric Data Encryption Key (DEK) is generated locally for each payload. The DEK must be wrapped (encrypted) using an HSM-backed RSA Key Encryption Key (KEK) named PayloadKEK stored in an Azure Key Vault named kv-prod. The Key Vault has Azure Role-Based Access Control (Azure RBAC) enabled as its permission model. You need to implement the solution using the latest Azure SDK for .NET. Which two of the following actions must you perform to configure permissions and wrap the DEK?

Select all that apply

Show answer & explanation

Answer: Assign the Key Vault Crypto User role for kv-prod to the system-assigned managed identity of the Function app.; In the Function app code, instantiate a CryptographyClient using DefaultAzureCredential and the URI of PayloadKEK, and call WrapKeyAsync.

Answer

Assign the Key Vault Crypto User role for the Key Vault to the system-assigned managed identity, and in the application code, use the CryptographyClient with DefaultAzureCredential to call WrapKeyAsync.
To perform envelope encryption, you must grant the system-assigned managed identity of the Function app the Key Vault Crypto User role, which enables the identity to invoke the key wrapping APIs of Key Vault. In the C# .NET SDK, you must use the CryptographyClient class from the Azure.Security.KeyVault.Keys.Cryptography namespace to handle cryptographic operations like key wrapping, using DefaultAzureCredential for token acquisition.

Step-by-Step Solution

1
Configure Key Vault Authorization
The system-assigned managed identity of the Azure Function app is assigned the Key Vault Crypto User role on the kv-prod Key Vault.
This RBAC role is required to grant the application permission to perform cryptographic wrap/unwrap operations using keys within the Key Vault.
2
Instantiate the Cryptography Client
The CryptographyClient is instantiated in the .NET code using the Key Vault key's URI and DefaultAzureCredential.
The modern Azure SDK separates management operations (KeyClient) from cryptographic operations (CryptographyClient). The CryptographyClient is specialized for wrapping and unwrapping.
3
Execute the Wrapping Operation
WrapKeyAsync is called on the CryptographyClient, passing the locally generated DEK and the desired KeyWrapAlgorithm.
This securely wraps the symmetric DEK using the KEK stored in the Key Vault, offloading the cryptographic operation to the Key Vault itself.

Key Concept

Azure Key Vault Key Cryptography and Azure RBAC Roles
Question 465Question

You are deploying a web application to Azure App Service. You want to retrieve a database connection password stored in Azure Key Vault directly through the App Service application settings without modifying the application code.

Which of the following is the correct syntax to use as the value for the application setting to reference a secret named 'db-password' in a Key Vault named 'myvault'?

Show answer & explanation

Answer: @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)

Answer

The correct syntax is @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)
The correct format for a Key Vault reference in App Service uses the prefix @Microsoft.KeyVault followed by the SecretUri parameter set to the secret's absolute URL. This allows App Service to retrieve the secret automatically at runtime using the application's managed identity.

Step-by-Step Solution

1
Identify the required prefix for Azure Key Vault references in App Service.
The prefix must be @Microsoft.KeyVault.
Azure App Service uses the @Microsoft.KeyVault keyword to detect and process settings that should be fetched from Key Vault.
2
Determine the parameter format required to specify the location of the secret.
The parameters inside the parentheses must be either SecretUri or a combination of VaultName and SecretName.
The reference resolver requires specific key names to identify the vault and secret.
3
Format the final configuration value.
@Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)
This format correctly combines the prefix and the valid SecretUri parameter.

Key Concept

Azure Key Vault references in App Service application settings allow applications to securely access secrets without modifying application code.
Estimated Time:45s
Question 466Question

You are developing an ASP.NET Core web application that will be hosted in an Azure App Service. The application must retrieve configuration settings from an Azure App Configuration store. Several settings in the store are Key Vault references pointing to secrets in Azure Key Vault. You must secure access using a single user-assigned managed identity, adhering to the principle of least privilege.

Which of the following represents the correct sequence of steps to configure the Azure resources and the web application?

Drag items to arrange them in the correct order

Show answer & explanation

Answer

The correct sequence starts with creating the user-assigned managed identity, associating it with the App Service web app, granting the identity the App Configuration Data Reader role on the App Configuration store and the Key Vault Secrets User role on the Key Vault, configuring the AZURE_CLIENT_ID application setting on the App Service, and finally updating the application startup code to use DefaultAzureCredential to connect to App Configuration and resolve Key Vault references.
The correct sequence ensures that the identity resource is established first, associated with the host compute resource, authorized via role-based access control (RBAC) to read configuration and Key Vault secrets, mapped to the environment via the standard client ID environment variable, and finally consumed by the application code using the DefaultAzureCredential.

Step-by-Step Solution

1
Create a user-assigned managed identity in Microsoft Entra ID.
A new managed identity resource is created with a unique Client ID and Principal ID.
You cannot perform role assignments or associate the identity with other Azure resources until the identity resource itself exists.
2
Associate the user-assigned managed identity with the Azure App Service web app.
The App Service web app is configured to use the user-assigned identity.
The web app must have the identity assigned so the hosting platform can request tokens on its behalf.
3
Assign the App Configuration Data Reader role to the identity on the App Configuration store, and the Key Vault Secrets User role to the identity on the Key Vault.
The managed identity is granted the minimum required permissions to read configuration keys and resolve Key Vault secrets.
Since Key Vault references in Azure App Configuration are resolved client-side by the application itself, the application's identity requires permissions to both services.
4
Add the AZURE_CLIENT_ID application setting to the App Service web app.
An environment variable with the identity's client ID is injected into the application's runtime context.
By default, DefaultAzureCredential attempts to use the system-assigned managed identity. Specifying the AZURE_CLIENT_ID environment variable forces it to use the correct user-assigned identity.
5
Configure the web app's startup code to connect to the App Configuration store using DefaultAzureCredential and enable Key Vault options.
The application successfully fetches the configuration and decrypts Key Vault references on startup.
The application code must explicitly register the App Configuration provider and pass DefaultAzureCredential to handle authentication.

Key Concept

Configuring secure client-side resolution of Azure App Configuration Key Vault references using a user-assigned managed identity.
Estimated Time:3m 0s
Question 467Question

An organization has deployed an Azure Container App named feedback-portal. You are tasked with configuring a custom domain named feedback.contoso.com for this Container App and securing it using an Azure Container Apps managed certificate. Which sequence of steps should you perform to complete the configuration?

Drag items to arrange them in the correct order

Show answer & explanation

Answer

To configure a custom domain and secure it with a managed certificate, you must first create the DNS TXT and CNAME records at your DNS provider. Next, add the custom domain to the Container App to validate ownership. Once validated, generate the managed certificate, and finally bind the certificate to the domain to secure the connection.
The correct order begins with configuring DNS records at the registrar, which allows Azure to verify ownership. Next, adding the custom domain to the Container App validates ownership. Only after successful validation can the managed certificate be generated. Finally, the certificate is bound to the custom domain to secure the connection with HTTPS.

Step-by-Step Solution

1
Create the DNS TXT and CNAME records at the DNS registrar.
The domain registrar has active records pointing to the Container App.
Azure checks these records during the validation phase to verify that you own the domain.
2
Add the custom domain to the Container App to trigger verification.
The domain is successfully added and verified on the Container App.
The domain must be validated and added to the Container App before a managed certificate can be issued.
3
Create the Azure Container Apps managed certificate for the domain.
The managed certificate is generated by Azure and is ready for binding.
The certificate must exist within the Container Apps environment before it can be bound to the custom domain.
4
Bind the managed certificate to the custom domain.
The custom domain is bound to the certificate, securing all incoming traffic with HTTPS.
This is the final step that establishes SSL/TLS termination for the custom domain.

Key Concept

Custom domain verification and managed certificate binding in Azure Container Apps.
Estimated Time:2m 0s
Question 468Question

You are developing a C# application using the Azure.Storage.Blobs SDK (v12). The application needs to perform a concurrency-safe metadata update on an existing blob named config.json. You must acquire a lease, apply the metadata dictionary, and release the lease.

Which sequence of code actions should you perform to complete this operation? Arrange the actions in the correct order.

Drag items to arrange them in the correct order

Show answer & explanation

Answer

To perform a concurrency-safe metadata update using the Azure.Storage.Blobs SDK, you must first get the BlobClient instance, initialize the BlobLeaseClient, acquire the lease to obtain a LeaseId, set the metadata while passing the LeaseId in the BlobRequestConditions, and finally release the lease.
The correct sequence begins by locating the target blob, initializing the lease manager, locking the blob to secure a lease ID, applying the metadata change with the required request conditions, and finally freeing the resource for other tasks.

Step-by-Step Solution

1
Retrieve the BlobClient instance for config.json.
A reference to the target blob is established.
All subsequent lease and metadata operations require a valid BlobClient reference.
2
Initialize the BlobLeaseClient.
A lease client is mapped to the target BlobClient.
The Azure.Storage.Blobs.Specialized namespace uses the BlobLeaseClient class to manage locks on blobs.
3
Acquire the lease for a specified duration.
A BlobLease object is returned containing the active LeaseId.
You must establish the lease lock first to secure the resource before attempting to write changes.
4
Call SetMetadataAsync with the request conditions.
The metadata dictionary is updated on the Azure Storage blob.
Azure Storage rejects write requests on leased blobs unless the correct LeaseId is provided in the headers via BlobRequestConditions.
5
Release the lease lock.
The write lock is removed from the blob.
Releasing the lease immediately frees the resource for other operations instead of waiting for the lease duration to expire.

Key Concept

Concurrency management and metadata updates using BlobLeaseClient in Azure Storage SDK (v12).
Question 469Question

You are developing a C# .NET console application that must retrieve a connection string stored as a secret in Azure Key Vault. The application will run locally during development and as a containerized app in Azure once deployed. You want to connect to the Key Vault using the modern Azure SDK. Which two components are required to successfully authenticate the client and retrieve the secret? (Select two.)

Select all that apply

Show answer & explanation

Answer: The DefaultAzureCredential class from the Azure.Identity package to handle authentication.; The SecretClient class from the Azure.Security.KeyVault.Secrets package to perform secret operations.

Answer

To authenticate and retrieve a secret using the modern Azure SDK, you must use the DefaultAzureCredential class from the Azure.Identity namespace and the SecretClient class from the Azure.Security.KeyVault.Secrets namespace.
To authenticate and retrieve a secret from Azure Key Vault using the modern Azure SDK, the application must construct a DefaultAzureCredential object to handle identity flow and pass it into a newly initialized SecretClient object to communicate with Key Vault.

Step-by-Step Solution

1
Import the modern Azure SDK namespaces Azure.Identity and Azure.Security.KeyVault.Secrets.
The required client and credential types become available in the application scope.
Ensures the application uses the current, non-deprecated SDK packages.
2
Instantiate a DefaultAzureCredential object.
An authentication token source is initialized that resolves credentials dynamically depending on whether the app runs locally or in Azure.
Allows passwordless authentication using the environment's identity flow.
3
Instantiate a SecretClient object, passing the vault URI and the DefaultAzureCredential instance, and call the GetSecret or GetSecretAsync method.
The connection is established, and the secret containing the connection string is successfully retrieved from the Key Vault.
Initiates the API request using the modern client implementation to retrieve the secret payload.

Key Concept

Retrieving secrets from Azure Key Vault using the modern Azure SDK for .NET with token-based Azure Identity authentication.
Question 470Question

You are developing a multi-tenant SaaS application that will be registered in Microsoft Entra ID. The application must allow users from any corporate Microsoft Entra ID tenant to sign in using their work or school accounts. However, users with personal Microsoft accounts (such as Outlook.com or Xbox Live) must be prevented from signing in. Which of the following configuration actions must you perform to meet these requirements? (Select TWO.)

Select all that apply

Show answer & explanation

Answer: Configure the signInAudience property in the application manifest to AzureADMultipleOrgs.; Configure the authority endpoint in the application code to use the /organizations tenant placeholder.

Answer

Configure the signInAudience property in the application manifest to AzureADMultipleOrgs, and configure the authority endpoint in the application code to use the /organizations tenant placeholder.
To limit authentication to work or school accounts from any Microsoft Entra ID directory while excluding personal Microsoft accounts, you must set the application registration's manifest signInAudience property to AzureADMultipleOrgs and route sign-ins through the /organizations endpoint. This combination guarantees that only corporate identities can authenticate.

Step-by-Step Solution

1
Determine the required audience type for the multi-tenant application based on the identity restrictions.
Since personal Microsoft accounts must be excluded while corporate accounts are allowed, the target audience configuration value is AzureADMultipleOrgs.
The AzureADMultipleOrgs setting limits sign-ins strictly to corporate tenant environments and prevents personal Microsoft account validation.
2
Select the matching endpoint routing for the client-side authentication library.
The authority URI path must use the /organizations endpoint.
The /organizations path filters incoming sign-ins to only allow organizational directories, complementing the AzureADMultipleOrgs manifest setting.

Key Concept

Configuring multi-tenant Microsoft Entra ID applications with restricted sign-in audiences and endpoints
Estimated Time:1m 30s
Question 471Question

An organization deploys a web application named `InvoiceProcessorApp` to an Azure App Service. The application is hosted on a Basic (B1B1) App Service plan. During monthly billing cycles, the application experiences brief but severe CPU utilization spikes, leading to slow response times for users. You need to implement a solution that automatically scales the application out by adding instances when CPU utilization exceeds 75%75\% and scales in when CPU utilization drops.

What should you do first?

Show answer & explanation

Answer: Scale up the App Service plan to the Standard (S1S1) tier.

Answer

Scale up the App Service plan to the Standard (S1S1) tier.
To configure automatic scaling (autoscale) rules based on metrics such as CPU Percentage, the App Service plan must be in the Standard (S1S1) tier or higher. The Basic tier only supports manual scaling (up to three instances). Therefore, you must first scale up the App Service plan to the Standard (S1S1) tier.

Step-by-Step Solution

1
Determine the scaling capabilities of the current Basic (B1B1) App Service plan.
The Basic tier only supports manual scaling up to a maximum of three instances.
Before configuring autoscale, we must check if the current tier supports the feature.
2
Identify the minimum pricing tier required for autoscale rules.
The Standard (S1S1) tier is the minimum tier that supports metric-based autoscale rules.
To automate instance scaling based on CPU metrics, the plan must support autoscale rules.
3
Select the correct first action to take.
The App Service plan must be scaled up to the Standard (S1S1) tier before any autoscale rules can be configured.
This establishes the prerequisite platform capability for automatic scaling.

Key Concept

Pricing tier requirements for configuring Azure App Service autoscale rules.
Estimated Time:1m 30s
Question 472Question

You are configuring an Azure Event Grid subscription to route customer events to a third-party HTTP webhook endpoint that you do not control. Because the third-party endpoint cannot be modified to programmatically return the validation code synchronously, you must manually validate the subscription. You create the subscription, and its provisioning state is set to Pending. What must you do to complete the endpoint validation and activate the subscription?

Show answer & explanation

Answer: Locate the validation event sent to the webhook destination, copy the validationUrl, and send an HTTP GET request to that URL.

Answer

To manually validate the subscription, you must locate the validation event sent to the webhook, extract the validationUrl, and send an HTTP GET request to that URL.
When configuring an Event Grid subscription for a webhook that cannot programmatically respond to validation handshakes (such as a third-party service), developers must perform a manual handshake. This is done by intercepting the validation event payload sent to the webhook, copying the validationUrl from the event's data object, and making an HTTP GET request to that URL to activate the subscription.

Step-by-Step Solution

1
Create the Event Grid subscription with the webhook endpoint destination.
The subscription is created in a Pending state, and Event Grid sends a subscription validation event payload containing a validationUrl and a validationCode to the endpoint.
This initiates the validation process to prevent abuse and verify endpoint ownership.
2
Access the delivery logs or request history of the third-party endpoint to retrieve the JSON validation payload.
You obtain the JSON payload which contains the validationUrl property.
Because the third-party endpoint cannot respond programmatically, you must retrieve the URL manually.
3
Perform an HTTP GET request to the retrieved validationUrl.
Event Grid processes the GET request, validates the handshake, and transitions the subscription state to Active.
Making the GET request proves that you have access to the destination's logs and therefore own or control the endpoint.

Key Concept

Azure Event Grid webhook endpoint manual validation handshake
Question 473Question

You are investigating a brief spike in application errors that occurred within the last hour. You need to write a Kusto Query Language (KQL) query in Azure Application Insights to retrieve all recorded exceptions from the `exceptions` table. The query must be optimized to run quickly and avoid scanning historical data beyond the necessary timeframe.

Which KQL query should you use?

Show answer & explanation

Answer: exceptions
| where timestamp > ago(1h)

Answer

The query that filters the exceptions table where the timestamp is greater than ago(1h).
The query that filters the exceptions table where the timestamp is greater than ago(1h) is correct because it uses the timestamp field to limit the data scan to the specified one-hour window. This is highly performant and conforms to Azure Monitor best practices.

Step-by-Step Solution

1
Identify the target telemetry table containing error details.
The target table is the exceptions table.
Application Insights stores error details and stack traces in the exceptions table.
2
Determine the time constraint required for the query.
The query must target data from the last hour (within 1 hour ago to the present).
Applying a time filter prevents scanning unnecessary historical records, which keeps the query fast and cost-effective.
3
Apply the timestamp filter using the ago function.
Filter using where timestamp > ago(1h).
Using the greater-than operator with ago(1h) selects all records created from one hour ago up to the current time.

Key Concept

Optimizing KQL queries in Azure Monitor/Application Insights by filtering on the timestamp column first to restrict the data scan volume.
Question 474Question

You are developing a secure multi-tier application where the frontend web app is hosted on-premises and needs to authenticate to a backend API hosted in Azure. You register the frontend application in your Microsoft Entra ID tenant, which automatically creates an application object and a service principal in the tenant. Later, to comply with a security policy, you delete the application registration in the Azure portal. What is the immediate impact of deleting this application registration on the associated service principal in your tenant?

Show answer & explanation

Answer: The service principal is automatically deleted from the tenant.

Answer

The service principal is automatically deleted from the tenant.
In Microsoft Entra ID, an application registration creates an application object (the global representation of the app) and a service principal (the local instance of the app in the tenant). In the home tenant where the application is registered, deleting the application registration automatically deletes the associated service principal.

Step-by-Step Solution

1
Analyze the relationship between an Application registration and a Service Principal in Microsoft Entra ID.
An application registration creates a global application object and a local service principal in the home tenant.
Understanding the structural dependency between these two resources is essential for managing their lifecycle.
2
Determine the impact of deleting the application registration.
Deleting the application registration removes both the application object and its corresponding service principal in the home tenant.
Since the service principal in the home tenant is directly tied to the application registration lifecycle, removing the registration cleans up the associated security identity.

Key Concept

Application registrations and service principals share a linked lifecycle in their home tenant. Deleting the application registration automatically removes the service principal in that tenant.
Question 475Question

You are developing a client-side application that needs to upload temporary log files to a specific container named 'logs' in an Azure Blob Storage account. You need to generate a Shared Access Signature (SAS) token for the client. The solution must adhere to the principle of least privilege, allow access only from the IP address range 198.51.100.0/24, restrict communication to HTTPS, and expire in 2 hours. Which of the following configurations should you implement?

Show answer & explanation

Answer: A Service SAS scoped only to the 'logs' container with Write-only permission, protocol restricted to HTTPS-only, IP address range restricted to 198.51.100.0/24, and a 2-hour expiration time.

Answer

A Service SAS scoped only to the 'logs' container with Write-only permission, protocol restricted to HTTPS-only, IP address range restricted to 198.51.100.0/24, and a 2-hour expiration time.
The correct configuration is a Service SAS scoped to the 'logs' container with Write-only permission, HTTPS-only protocol, the specific client IP address range, and a 2-hour expiration time. This ensures that the client has only the necessary access permissions, is constrained to a secure protocol and IP range, and that the token expires as soon as possible.

Step-by-Step Solution

1
Identify the required scope for the SAS token.
The application only needs to write to a specific container ('logs'), so a Service SAS scoped to that container should be used rather than an Account SAS.
A Service SAS delegates access to a resource in a single storage service, enforcing the principle of least privilege.
2
Determine the required permissions for the scenario.
The application only needs to upload log files, which requires Write permission.
Granting Read or Delete permissions would violate the principle of least privilege.
3
Identify the security constraints required.
The protocol must be HTTPS-only, the allowed IP address range must be restricted to 198.51.100.0/24, and the token expiration must be set to 2 hours.
These constraints restrict the protocol, source networks, and temporal validity of the SAS token to minimize the risk of unauthorized access.

Key Concept

Shared Access Signatures (SAS) Principle of Least Privilege
Question 476Question

You are designing a long-running batch data processing workflow using Azure Durable Functions in C# (.NET Isolated). The workflow must retrieve a list of database servers, execute a schema migration process on each database in parallel, wait for all migrations to complete, and then send a status update. The schema migration on each database can take up to 45 minutes, and the total execution of the workflow can take several hours.

You need to select the hosting plan and implement the execution pattern.

Which of the following actions should you perform? (Select two.)

Select all that apply

Show answer & explanation

Answer: Deploy the Azure Functions to a Premium plan or a Dedicated App Service plan.; Call the migration activity functions inside a loop to populate a list of tasks, and then await them using Task.WhenAll.

Answer

To meet the requirements, you must deploy the Azure Functions to a Premium plan or a Dedicated App Service plan to avoid the 10-minute execution duration limit of the Consumption plan. Additionally, you should call the migration activity functions inside a loop to populate a list of tasks and then await them using Task.WhenAll to achieve parallel execution (Fan-out/Fan-in pattern).
Deploying to a Premium or Dedicated App Service plan ensures that the functions can execute beyond the 10-minute limit of the Consumption plan. Implementing the Fan-out/Fan-in pattern by populating a list of tasks and using Task.WhenAll ensures the activities execute concurrently in parallel.

Step-by-Step Solution

1
Analyze the execution duration requirement for individual tasks.
Identify that the migration process takes 45 minutes, which exceeds the maximum execution timeout of 10 minutes on the Consumption plan.
This determines that either a Premium plan or a Dedicated App Service plan is required to support long-running activities.
2
Analyze the concurrency requirement for processing the databases.
Identify that migrations must execute in parallel.
This determines that a Fan-out/Fan-in pattern must be used, which requires triggering activities asynchronously and awaiting them collectively.
3
Implement the parallel execution logic in the orchestrator code.
Add activity execution tasks to a collection within a loop, and then await them using Task.WhenAll.
This executes the activities concurrently and prevents sequential blocking.

Key Concept

Selecting hosting plans and implementing parallel execution patterns (Fan-out/Fan-in) in Azure Durable Functions.
Question 477Question

You are configuring a Standard test in Azure Application Insights to monitor the public-facing endpoint of a secure retail portal (`https://portal.contoso.com`).

The requirements for the availability monitoring are:
- The test must verify that the HTTP status code returned is 200.
- The test must inspect the response body and fail if it does not contain the text `Welcome to Contoso`.
- The test must verify that the server's SSL certificate is valid and trigger a failure if the certificate is within 30 days of expiration.

Which two configuration settings must you specify in the availability test configuration? (Select two.)

Select all that apply

Show answer & explanation

Answer: Select the Content match checkbox and enter Welcome to Contoso in the content match string field.; Select the SSL certificate validity checkbox, select Proactive lifetime check, and set the value to 30.

Answer

To monitor the secure portal's availability and certificate status, you must enable Content match with the string 'Welcome to Contoso' and enable SSL certificate validity with a Proactive lifetime check threshold of 30 days.
To satisfy the requirements, the Standard test's success criteria must include Content match to validate that the payload contains the expected greeting, and SSL certificate validity with a Proactive lifetime check of 30 days to proactively warn before the server's certificate expires.

Step-by-Step Solution

1
Configure response content validation
Checking Content match and entering 'Welcome to Contoso' guarantees the test verifies the response body.
Standard tests use Content match to evaluate the return payload of the endpoint.
2
Configure server certificate verification
Enabling SSL certificate validity and entering 30 days under the Proactive lifetime check ensures the server's certificate is checked.
This setting generates an alert when the server's own SSL certificate approaches its expiration date.

Key Concept

Configuring success criteria in Application Insights Standard tests, specifically verifying response content and monitoring server SSL certificate expiration.
Question 478Question

You are developing a C# service that processes patient health telemetry using the Azure Cosmos DB .NET SDK v3. The container's partition key is `/patientId`, and the database is configured with Session consistency.

You need to write code to create a patient profile and their first telemetry entry atomically in a single transaction. Then, a separate background processing service (instantiated as a different CosmosClient) must read the newly created profile with guaranteed read-your-writes consistency.

Which two of the following code segments must you implement to achieve this?

Select all that apply

Show answer & explanation

Answer: TransactionalBatchResponse response = await container.CreateTransactionalBatch(new PartitionKey(patientId))
.CreateItem<PatientProfile>(profile)
.CreateItem<TelemetryLog>(log)
.ExecuteAsync();; string sessionToken = response.Headers.Session;
ItemRequestOptions options = new ItemRequestOptions { SessionToken = sessionToken };
ItemResponse<PatientProfile> readResponse = await backgroundContainer.ReadItemAsync<PatientProfile>(
profile.Id,
new PartitionKey(patientId),
options
);

Answer

To perform the atomic transaction and read the written data with read-your-writes guarantees across different client sessions, you must create a transactional batch using the patient's partition key and then capture and pass the session token to the reader client.
The transactional batch must be created using the partition key (patientId) on the container instance. To guarantee read-your-writes consistency across separate CosmosClient sessions, the session token must be explicitly retrieved from the write response headers and passed in the ItemRequestOptions of the read request.

Step-by-Step Solution

1
Create and execute the transactional batch using the container instance.
Both the patient profile and telemetry log are written atomically using the patientId partition key.
Transactional batching in SDK v3 is container-scoped and requires all operations in the batch to share the same partition key.
2
Extract the Session token from the transactional batch response.
The session token string is retrieved from response.Headers.Session.
The write operation generates a session token that represents the state of the database after the transaction.
3
Pass the session token in the ItemRequestOptions to the background reader client.
The background client reads the item using the session token, ensuring it sees the writes.
Since the background reader uses a different client instance, Session consistency guarantees are only maintained if the session token is explicitly shared.

Key Concept

Cosmos DB Transactional Batching and Session Consistency Sharing
Question 479Question

You are authoring an Azure Resource Manager (ARM) template to deploy an Azure App Service web app that needs to read secrets from an Azure Key Vault. During testing, developers will frequently delete and recreate the App Service web app. You must ensure that redeploying the web app does not require recreating Key Vault access policies or re-granting permissions.

Which configuration should you define in the resources section of the ARM template to enable the managed identity?

Show answer & explanation

Answer: Set the identity type to UserAssigned and define the resource ID of the existing user-assigned managed identity as a key in the userAssignedIdentities dictionary.

Answer

Set the identity type to UserAssigned and define the resource ID of the existing user-assigned managed identity as a key in the userAssignedIdentities dictionary.
The correct configuration uses a user-assigned managed identity, which exists as a standalone Azure resource independent of the App Service web app. By configuring the identity type as 'UserAssigned' and referencing the identity's resource ID in the 'userAssignedIdentities' block, the web app can be deleted and redeployed without deleting the managed identity itself or breaking the Key Vault access policies configured for it.

Step-by-Step Solution

1
Analyze the lifecycle requirements of the scenario.
Since the App Service web app is frequently deleted and recreated, a system-assigned identity would be deleted along with the app, invalidating any Key Vault access policies. A user-assigned identity must be used because its lifecycle is independent of the resources it is assigned to.
Choosing the correct identity type prevents needing to recreate access policies on each redeployment.
2
Determine the proper ARM template schema configuration for a user-assigned managed identity.
The identity configuration block in an ARM template requires setting the 'type' property to 'UserAssigned' and using the fully-qualified resource ID of the identity as a key in the 'userAssignedIdentities' dictionary.
Using client IDs or system-assigned configurations will fail to deploy or will configure the wrong identity type.

Key Concept

Selecting and configuring the correct managed identity type (System-Assigned vs User-Assigned) based on lifecycle requirements and ARM template properties.
Question 480Question

A developer is configuring a Shared Access Signature (SAS) token to allow an external application to download diagnostic reports from a specific Azure Blob Storage container. The token must be valid for 24 hours, enforce HTTPS-only access, and restrict operations to downloading blobs. Which two configurations should the developer apply to the SAS token to meet these requirements?

Select all that apply

Show answer & explanation

Answer: Set the permissions parameter to Read (r) only.; Set the allowed protocols parameter to HTTPS only.

Answer

To meet the requirements, the developer must set the permissions parameter to Read (r) only and set the allowed protocols parameter to HTTPS only.
The correct configurations restrict the SAS token permissions to Read (r) only, which is sufficient for downloading files, and enforce HTTPS-only access to prevent cleartext transmission of data, aligning with security requirements.

Step-by-Step Solution

1
Determine the minimum required permissions for downloading files.
Only Read (r) permission is needed.
Granting additional permissions like Write (w) violates the principle of least privilege.
2
Determine the allowed protocol constraint.
HTTPS-only parameter configuration.
This enforces transport-level security and prevents unencrypted HTTP connections.

Key Concept

Configuring least-privilege permissions and protocol constraints on a Shared Access Signature (SAS) token.
Estimated Time:1m 0s
PreviousPage 24 / 49Next
All practice questions — Microsoft Azure Developer (AZ-204) | Examkin