AZ-204 Practice Questions
![]() |
![]() |
![]() |
Title of test:![]() AZ-204 Practice Questions Description: AZ-204 Exam questions |




New Comment |
---|
NO RECORDS |
You need to set a duration of 10 seconds for a key stored in Azure Cache for Redis. Which code segment should you use?. using (var cache = ConnectionMultiplexer.Connect("")) { IDatabase db = cache.GetDatabase(); bool setValue = await db.StringSetAsync("test:key", "10"); }. using (var cache = ConnectionMultiplexer.Connect("")) { IDatabase db = cache.GetDatabase(); bool setValue = await db.StringSetAsync("test:key", "10", TimeSpan.FromSeconds(10)); }. using (var cache = ConnectionMultiplexer.Connect("")) { IDatabase db = cache.GetDatabase(); bool setValue = await db.StringSetAsync("test:key", "10", DateTime.UtcNow.AddSeconds(10)); }. using (var cache = ConnectionMultiplexer.Connect("")) { IDatabase db = cache.GetDatabase(); bool setValue = await db.StringSetAsync("test:key", "10", DateTime.Now.AddSeconds(10)); }. You manage Azure Cache for Redis by using classes in the .NET StackExchange.Redis namespace. You need to retrieve a reference to a Redis database by using the GetDatabase method. What do you need to do first?. Create a CdnManagementClient object. Create a ConnectionMultiplexer object. Call a StringSet method. Call a StringGet method. You plan to use Azure Cache for Redis as the caching layer for several applications. You have the following requirements: Prevent data loss if nodes are down. Minimize storage costs. Optimize performance. Which solution should you use?. Redis database (RDB) persistence with the soft-delete feature enabled on the associated storage account. Redis database (RDB) persistence with the soft-delete feature disabled on the associated storage account. Append only File (AOF) persistence with the soft-delete feature disabled on the associated storage account. Append only File (AOF) persistence with the soft-delete feature enabled on the associated storage account. A company uses Application Insights to instrument an application hosted in Azure App Service. Instrumentation data that is collected by using API calls in the code is not available in Application Insights. You need to ensure the collected data is available in Application Insights. What should you do?. Enable auto-instrumentation. Enable manual instrumentation. Verify the health of Application Insights. Verify the health of Azure App Service. You develop an Azure function that connects to a SQL database. The function is instrumented by using Application Insights. You need to view the full SQL query text when inspecting the Dependency tab in Application Insights. Which two settings in the host.json file should you use? Each correct answer presents part of the solution. "enableDependencyTracking": true. "dependencyTrackingOptions": { "enableSqlCommandTextInstrumentation": true },. "enablePerformanceCountersCollection": true. "logLevel": { "default": "Verbose" }. You need to track the availability of an Azure App Service web app by using an Application Insights multi-step availability test. Which tool should you use?. Azure portal. Azure CLI. Visual Studio. Visual Studio Code. You need to capture user actions by using the Azure Application Insights API. Which API call should you use?. TrackEvent. TrackMetric. TrackRequest. TrackTrace. You plan to use Application Insights to monitor the performance of an on-premises web application. You need to identify a configuration that satisfies the following requirements: Minimize the volume of data ingested into Application Insights. Maximize the accuracy of the collected metrics. What should you do?. Apply sampling. Apply filtering. Use log-based metrics. Use standard metrics. You manage a multiregion deployment of an Azure Cosmos DB account named account1. You need to configure the default consistency level for account1. The consistency level must maximize throughput and minimize latency for write operations. Which consistency level should you use?. bounded staleness. consistent prefix. eventual. session. You need to read an Azure Cosmos DB change feed by using a reactive model. What are two possible ways to achieve this goal? Each correct answer presents a complete solution. Azure Functions with an Azure Cosmos DB trigger. Change feed processor library. Azure Functions with an Azure Event Grid trigger. Change feed pull model. You create the following retention policy. (Line numbers are included for reference only.) 1 { 2 "rules": [ 3 { 4 "name": "agingRule", 5 "enabled": true, 6 "type": "Lifecycle", 7 "definition": { 8 "filters": { 9 "blobTypes": [ "blockBlob" ], 10 "prefixMatch": [ "sample-container/blob1" ] 11 }, 12 "actions": { 13 "baseBlob": { 14 15 } 16 } 17 } 18 } 19 ] 20 } You need to transition blobs in the Hot access tier to an online tier if the blobs have not been modified in over 90 days. Which code segment should you add to line 14?. "tierToArchive": { "daysAfterCreationGreaterThan": 90 }. "tierToCool": { "daysAfterCreationGreaterThan": 90 }. "tierToCool": { "daysAfterModificationGreaterThan": 90 }. "tierToArchive": { "daysAfterModificationGreaterThan": 90 }. A company has a blob in the Archive access tier. You need to rehydrate the blob to an online tier. What are two possible ways to achieve this goal? Each correct answer presents a complete solution. Copy the blob to a new blob in the Hot or Cool tier with the Copy Blob operation. Change the blob’s tier using the Set Blob Properties operation. Change the blob’s tier using the Set Blob Tier operation. Copy the blob to a new blob in the Hot or Cool tier with the Snapshot Blob operation. You need to implement an Azure Storage lifecycle policy for append blobs. Which rule action should you use?. delete. enableAutoTierToHotFromCool. tierToArchive. tierToCool. You need to rehydrate a blob stored in the Archive tier. Which destination blob should you use?. A blob in the Archive tier in the same region. A blob in the Archive tier in a different region. A blob in the Cool tier in a different region. A blob in the Cool tier in the same region. A company plans to host a static website that uses a custom domain and Azure Storage in multiple regions. You need to serve website content and minimize latency. What are two possible ways to achieve this goal? Each correct answer presents part of the solution. Upload static content to a storage container named $web. Use Azure Traffic Manager to route users to the closest region. Upload static content to a storage container named web. Use Azure Content Delivery Network for regional caching. You manage the deployment of an Azure Cosmos DB account. You must define custom logic by using the .NET SDK change feed processor to process changes that the change feed reads. You need to select the appropriate change feed processor component. Which component should you use?. monitored container. delegate. compute instance. lease container. A company implements an Azure Cosmos DB account named Account1 to store product details. You need to write a parameterized SQL query to get items from the Products container based on category and price as parameters. Which SQL query should you write?. SELECT * FROM Products p WHERE p.category = @Category AND p.price = @Price. SELECT * FROM Account1 a WHERE a.category = @Category AND a.price = @Price. SELECT * FROM Account1.Products p WHERE p.category = @Category AND p.price = @Price. SELECT * FROM Products p WHERE p.category = 'Category' AND p.price = 'Price'. You are planning to host a static website in an Azure Storage account. The website must be accessible only through HTTPS by using a custom domain name. You enable the static website hosting feature. You set the default page to index.html and the error page to error.html. Which two actions should you perform next? Each correct answer presents part of the solution. Set the access level of the web hosting container to public. Add the custom domain under networking in the Azure Storage account. Integrate the static website with Azure Content Delivery Network (CDN). Create a container named $web. Upload the index.html and error.html files to the web hosting container. You manage APIs in production by using Azure API Management. You need to remove X-Powered-By and X-AspNet-Version headers from a response. Which code segment should you use?. <policies> <inbound> <base /> </inbound> <backend> <base /> </backend> <outbound> <set-header name="X-Powered-By" exists-action="append" /> <set-header name="X-AspNet-Version" exists-action="append" /> <base /> </outbound> <on-error> <base /> </on-error> </policies>. <policies> <inbound> <base /> </inbound> <backend> <set-header name="X-Powered-By" exists-action="delete" /> <set-header name="X-AspNet-Version" exists-action="delete" /> <base /> </backend> <outbound> <base /> </outbound> <on-error> <base /> </on-error> </policies>. <policies> <inbound> <base /> </inbound> <backend> <base /> </backend> <outbound> <set-header name="X-Powered-By" exists-action="delete" /> <set-header name="X-AspNet-Version" exists-action="delete" /> <base /> </outbound> <on-error> <base /> </on-error> </policies>. <policies> <inbound> <base /> </inbound> <backend> <set-header name="X-Powered-By" exists-action="append" /> <set-header name="X-AspNet-Version" exists-action="append" /> <base /> </backend> <outbound> <base /> </outbound> <on-error> <base /> </on-error> </policies>. You manage an Azure API Management instance. You need to limit the maximum number of API calls allowed from a single source for a specific time interval. What should you configure?. Product. Policy. Subscription. API. You manage an instance of Azure API Management. You define policies to multiple scopes. You need to enforce a policy evaluation order. What should you use?. the <base /> element. the <when /> element. the follow-redirects attribute. the condition attribute. You plan to use Azure API Management for Hybrid and multicloud API management. You need to create a self-hosted gateway for production. Which container image tag should you use?. 2.0.1. V3. latest. V3-preview. You plan to implement event routing in your Azure subscription by using Azure Event Grid. An event is generated each time an Azure resource is deleted. A message corresponding to the event is automatically displayed in an Azure App Service web app you deployed into the same Azure subscription. You create a custom topic. You need to subscribe to the custom topic. What should you do first?. Create an endpoint. Create an event handler. Enable the Azure Event Grid resource provider. Configure filtering. You develop the following code to read all published events for the first partition in Azure Event Hubs. (Line numbers are included for reference only.) 1 var connectionString = "<< CONNECTION STRING FOR THE EVENT HUBS NAMESPACE >>"; 2 var eventHubName = "<< NAME OF THE EVENT HUB >>"; 3 string consumerGroup = EventHubConsumerClient.DefaultConsumerGroupName; 4 await using (var consumer = new EventHubConsumerClient(consumerGroup, connectionString, eventHubName)) 5 { 6 7 8 using var cancellationSource = new CancellationTokenSource(); 9 cancellationSource.CancelAfter(TimeSpan.FromSeconds(45)); 10 await foreach (PartitionEvent receivedEvent in consumer.ReadEventsFromPartitionAsync(partitionId, 11 startingPosition, cancellationSource.Token)) 12 { 13 // At this point, the loop will wait for events to be available in the partition. When an event is available, the loop will iterate with the event that was received. 15 } 16 } You need to complete the code. Which two actions should you perform? Each correct answer presents part of the solution. Insert the following code segment at line 6: EventPosition startingPosition = EventPosition.Earliest;. Insert the following code segment at line 6: EventPosition startingPosition = EventPosition.Latest;. Insert the following code segment at line 7: string partitionId = (await consumer.GetPartitionIdsAsync()).First();. Insert the following code segment at line 7: int partitionId = (await consumer.GetPartitionIdsAsync()).First();. You need to capture events streaming from Azure Event Hubs. To which three locations can you capture data? Each correct answer presents a complete solution. Azure Blob storage. Azure Data Lake Storage Gen1. Azure Functions. Azure Stream Analytics. Azure Data Lake Storage Gen2. You have an instance of Azure Event Grid. You need to ensure an application can receive events filtered by values in the data field in the advanced filtering options. Which filter should you use?. event type. subject. advanced. topics. You manage an Azure App Service web app named app1. App1 is registered as an application in Azure Active Directory (Azure AD). You need to ensure that Azure AD signed-in user information can be retrieved by app1 by using Microsoft Graph. What should you configure?. appRoles. application permissions. groupMembershipClaims. delegated permissions. You plan to use a shared access signature to protect access to services within a general-purpose v2 storage account. You need to identify the type of service that you can protect by using the user delegation shared access signature. Which service should you identify?. Blob. File. Queue. Table. You plan to use Microsoft Graph to retrieve a list of users in an Azure Active Directory (Azure AD) tenant. You need to optimize query results. Which two query options should you use? Each correct answer presents part of the solution. $filter. $count. $select. $expand. You manage an Azure Active Directory registered application named app1. App1 calls a web API, which then calls Microsoft Graph. You need to ensure the signed-in user identity is delegated through the request chain. Which authentication flow should you use?. Authorization code. On-Behalf-Of. Client credentials. Implicit. You develop a multitenant web application named App1. You plan to register App1 with multiple Azure Active Directory (Azure AD) tenants. You need to identify the relationship between the application objects and security principals associated with App1. Which relationship should you identify?. App1 will have multiple application objects and multiple service principals. App1 will have multiple application objects and a single service principal. App1 will have a single application object and multiple service principals. App1 will have a single application object and a single service principal. You plan to create a key namespace hierarchy in Azure App Configuration. You need to separate individual key names. Which character should you use?. :. *. ,. \. A company plans to use Azure App Configuration for feature flags in an application. The company has the following encryption requirements: customer-managed keys hardware security module (HSM)-protected keys You need to recommend service tiers. Which two tiers should you recommend? Each correct answer presents part of the solution. Azure App Configuration Free tier. Azure App Configuration Standard tier. Azure Key Vault Standard tier. Azure Key Vault Premium tier. You need to generate a new version of a key stored in Azure Key Vault. Which code segment should you use?. az keyvault key rotation-policy update -n mykey --vault-name mykeyvault --value path/to/policy.json. az keyvault key purge --name mykey --vault-name mykeyvault. az keyvault key rotate --vault-name mykeyvault --name mykey. az keyvault key set-attributes --vault-name mykeyvault --name mykey –policy path/to/policy.json. You have an Azure App Configuration instance named AppConfig1 and an Azure key vault named KeyVault1. You plan to encrypt data stored in AppConfig1 by using your own key stored in KeyVault1. You need to grant permissions in KeyVault1 to the identity assigned to AppConfig1. Which three key-specific permissions should you use? Each correct answer presents part of the solution. DECRYPT. ENCRYPT. GET. UNWRAP. WRAP. You have an Azure Storage account container named container1. You need to configure access to the container to meet the following requirements: The shared access signature (SAS) token should be secured with Azure Active Directory (Azure AD) credentials. Role-based access control (RBAC) should be used. The SAS token should support granting access to containers. Which type of SAS should you use?. account. user delegation. service. stored access policy. You are developing a solution that stores secrets in an Azure Key Vault named myvault. You need to retrieve the value for a secret named mysecret that is stored in myvault. Which CLI command should you use?. az keyvault secret recover --name mysecret --vault-name myvault. az keyvault secret recover --id myvault/mysecret. az keyvault secret show --id myvault/mysecret. az keyvault secret show --name mysecret --vault-name myvault. You need to create a container in a container group and mount an Azure file share as volume. Which code segment should you use?. az container create -g MyResourceGroup --name myapp --image myimage:latest --command-line "cat /mnt/azfile/myfile" --azure-file-volume-share-name myshare --azure-file-volume-account-name mystorageaccount --azure-file-volume-account-key mystoragekey --azure-file-volume-mount-path /mnt/azfile. az container create -g MyResourceGroup --name myapp --image myimage:latest --command-line "cat /mnt/azfile/myfile" --azure-file-volume-share-name myshare --azure-file-volume-account-name mystorageaccount --azure-file-volume-account-key mystoragekey --secrets-mount-path /mnt/azfile. az container create -g MyResourceGroup –name myapp –image myimage:latest --command-line “cat /mnt/azfile/myfile” --azure-file-volume-account-name mystorageaccount --azure-file-volume-account-key mystoragekey --azure-file-volume-mount-path /mnt/azfile. az container create -g MyResourceGroup --name myapp --image myimage:latest --command-line "cat /mnt/azfile/myfile" --azure-file-volume-account-name mystorageaccount --azure-file-volume-account-key mystoragekey --secrets-mount-path /mnt/azfile. A company uses Azure Container Instances for an application. You need to ensure that the containers are restarted when the process terminates with a nonzero exit code. What should you do?. Define a container restart policy of Always. Run the containers using a managed identity. Define a container restart policy of Never. Run an init container. You plan to develop an Azure App Service web app named app1 by using a Windows custom container. You need to load a TLS/SSL certificate in application code. Which app setting should you configure?. WEBSITE_LOAD_CERTIFICATES. WEBSITE_ROOT_CERTS_PATH. WEBSITE_CORS_ALLOWED_ORIGINS. WEBSITE_AUTH_TOKEN_CONTAINER_SASURL. You manage an Azure App Service web app named app1. App1 uses a service plan based on the Basic pricing tier. You need to create a deployment slot for app1. What should you do first?. Scale out app1. Scale up app1. Configure automated deployment of app1 with Azure DevOps. Configure automated deployment of app1 with GitHub. You create an Azure web app locally. The web app consists of a ZIP package. You need to deploy the web app by using the Azure CLI. The deployment must reduce the likelihood of locked files. What should you do?. Run az webapp deploy specifying –-clean true. Run az webapp deploy specifying –-restart true. Run az webapp deploy to a staging slot with auto swap on. Run az webapp deploy by using a high value for the --timeout parameter. You plan to create an Azure function app named app1. You need to ensure that app1 will satisfy the following requirements: Supports automatic scaling. Has event-based scaling behavior. Provides a serverless pricing model. Which hosting plan should you use?. App Service. App Service Environment. Consumption. Functions Premium. You have an Azure Key Vault named MyVault. You need to use a key vault reference to access a secret named MyConnection from MyVault. Which code segment should you use?. @Microsoft.KeyVault(Secret=MyConnection;VaultName=MyVault). @Microsoft.KeyVault(SecretName=MyConnection;VaultName=MyVault). @Microsoft.KeyVault(Secret=MyConnection;Vault=MyVault). @Microsoft.KeyVault(SecretName=MyConnection;Vault=MyVault). You plan to create a C# script-based Azure function app. You need to configure the trigger and bindings for the functions of the function app. What should you do?. Create a function.json file for each function. Create a host.json file for the function app. Decorate methods of each function with C# attributes. Decorate parameters of each function with C# attributes. You are developing a .NET application that includes multiple container images. The application will be deployed to Azure Container Instances (ACI). You need to ensure that an Azure file share can be mapped to each container of the application. Which configuration should you use?. pods. confidential containers. container group. virtual network deployment. A container group in Azure Container Instances has multiple containers. The containers must restart when the process executed in the container group terminates due to an error. You need to define the restart policy for the container group. Which Azure CLI command should you use?. az container restart \ --name mycontainer \ --resource-group myResourceGroup \ --no-wait. az container create \ --resource-group myResourceGroup \ --name mycontainer \ --image mycontainerimage \ --restart-policy Always. az container create \ --resource-group myResourceGroup \ --name mycontainer \ --image mycontainerimage \ --restart-policy Never. az container create \ --resource-group myResourceGroup \ --name mycontainer \ --image mycontainerimage \ --restart-policy OnFailure. You are developing a Linux web app on Azure App Service. You need to deploy the web app to the production environment based on the following requirements: App changes must be validated in an environment identical to the production environment before moving the app to the production environment. Downtime must be eliminated when the app is deployed to the production environment. What should you use?. Deployment slots. Auto-scaling. Hybrid connection. App cloning. A company has an App Service web app that requires a TLS/SSL certificate. The certificate will be used in other App Service apps. The certificate must be automatically renewed with the least management overhead. You need to add the certificate. What should you do?. Create a free App Service managed certificate. Purchase an App Service certificate. Upload a certificate from a third party. Import a certificate from a Key Vault. You are developing an Azure Function app that will be deployed to a Consumption plan. The app consumes data from a database server that has limited throughput. You need to use the functionAppScaleLimit property to control the number of instances of the app that will be created. Which value should you use for the property setting?. 0. 10. null. You have blobs in Azure Blob storage. The blobs store pictures. You need to record the location and weather condition information from when the pictures were taken. You must ensure you can use up to 2,000 characters when recording the information. What should you do?. Append a suffix to the blob name by using the location and weather. Add a delimiter between them. Use metadata headers defined with a POST request. Use metadata headers defined with a PUT request. Create one container for each location. Inside each container, define the blob name as the weather type and a random suffix. You have an Azure storage lifecycle policy for block blobs. You need to create a prefixMatch filter rule that will contain an array of strings for prefixes to be matched. What should be the first element of the prefix string?. a block blob index tag. a block blob name. a container name. a storage account name. You are planning to host a static website in an Azure Storage account. The website must be accessible only through HTTPS by using a custom domain name. You enable the static website hosting feature. You set the default page to index.html and the error page to error.html. Which two actions should you perform next? Each correct answer presents part of the solution. Set the access level of the web hosting container to public. Add the custom domain under networking in the Azure Storage account. Integrate the static website with Azure Content Delivery Network (CDN). Create a container named $web. Upload the index.html and error.html files to the web hosting container. A company uses Azure API Management to expose some of its services. Each developer consuming APIs must use a single key to obtain access to various APIs without requiring approval from the API publisher. You need to recommend a solution. Which solution should you recommend?. Define a subscription with all APIs scope. Define a subscription with product scope. Restrict access based on caller IPs. Restrict APIs based on client certificate. You have an Azure event hub. You need to add partitions to the event hub. Which code segment should you use?. az eventhubs eventhub consumer-group update --resource-group MyResourceGroupName --namespace-name MyNamespaceName --eventhub-name MyEventHubName --set partitioncount=12. az eventhubs eventhub consumer-group create --resource-group MyResourceGroupName --namespace-name MyNamespaceName --eventhub-name MyEventHubName --set partitioncount=12. az eventhubs eventhub update --resource-group MyResourceGroupName --namespace-name MyNamespaceName --name MyEventHubName --partition-count 12. az eventhubs eventhub create --resource-group MyResourceGroupName --namespace-name MyNamespaceName --name MyEventHubName --partition-count 12. You need to write a filter condition for an Azure Service Bus topic. Which three filters can you use? Each correct answer presents a complete solution. SQL. Boolean. Size. Correlation. Content. You need to generate a shared access signature token that grants the Read permission to a blob container. Which code segment should you use?. BlobSasBuilder sasBuilder = new BlobSasBuilder() { BlobContainerName = containerClient.Name, Resource = "b" }; sasBuilder.ExpiresOn = DateTimeOffset.UtcNow.AddHours(1); sasBuilder.SetPermissions(BlobContainerSasPermissions.Read); Uri sasUri = containerClient.GenerateSasUri(sasBuilder);. BlobSasBuilder sasBuilder = new BlobSasBuilder() { BlobContainerName = containerClient.Name, Resource = "c" }; sasBuilder.ExpiresOn = DateTimeOffset.UtcNow.AddHours(1); sasBuilder.SetPermissions(BlobContainerSasPermissions.Read); Uri sasUri = containerClient.GenerateSasUri(sasBuilder);. BlobSasBuilder sasBuilder = new BlobSasBuilder() { BlobContainerName = containerClient.Name, Resource = “c” }; sasBuilder.ExpiresOn = DateTimeOffset.UtcNow.AddHours(1); sasBuilder.SetPermissions(BlobContainerSasPermissions.Create); Uri sasUri = containerClient.GenerateSasUri(sasBuilder);. BlobSasBuilder sasBuilder = new BlobSasBuilder() { BlobContainerName = containerClient.Name, Resource = "b" }; sasBuilder.ExpiresOn = DateTimeOffset.UtcNow.AddHours(1); sasBuilder.SetPermissions(BlobContainerSasPermissions.Create); Uri sasUri = containerClient.GenerateSasUri(sasBuilder);. You are developing an Azure Function app that will be deployed to a Dedicated plan. When there is a resource shortage in the app, it must send a “429 Too Busy” response. You need to apply the appropriate configuration to all functions in a function app instance. Which configuration should you set?. dynamicThrottlesEnabled in the host.json file. bindings section in the function.json file. maxOutstandingRequests in the host.json file. maxConcurrentRequests in the function.json file. You manage a multi-instance deployment of an Azure App Service web app named app1. You need to ensure a client application is routed to the same instance for the life of the session. Which platform setting should you use?. WebSocket. Always on. HTTP version. ARR Affinity. You need to download blob content to a byte array after a transient fault happens. Which code statement should you use?. byte[] data; BlobClient client = new BlobClient(new Uri("https://mystorageaccount.blob.core.windows.net/containers/blob.txt"), null); Response<BlobDownloadResult> response = client.DownloadContent(data);. BlobRequestOptions optionsWithRetryPolicy = new BlobRequestOptions(); byte[]destinationArray = blob.DownloadContent( index: 0, accessCondition: null, options: optionsWithRetryPolicy);. byte[] data; BlobClient client = new BlobClient(new Uri(“https://mystorageaccount.blob.core.windows.net/containers/blob.txt”), null); Response<BlobDownloadResult> response = client.DownloadContent(); data = response.Value.Content.ToArray();. byte[] data; BlobClientOptions options = new BlobClientOptions(); options.Retry.MaxRetries = 10; options.Retry.Delay = TimeSpan.FromSeconds(20); BlobClient client = new BlobClient(new Uri("https://mystorageaccount.blob.core.windows.net/containers/blob.txt"), options); Response<BlobDownloadResult> response = client.DownloadContent(); data = response.Value.Content.ToArray();. You are developing an application. You need to set the standard HTTP properties of containers in Azure Blob Storage. Which two HTTP properties can you set? Each correct answer presents part of the solution. ETag. Last-Modified. Cache-Control. Origin. Range. |