(AZ-204 topic) Monitor, Troubleshoot, and Optimize Azure Solutions Flashcards

Test takers will be expected to be able to set up Monitoring through services like Azure Monitor & Application Insights to identify and troubleshoot issues with their Azure solutions. They will also be expected to understand how to optimize solutions using services like Content Delivery Networks, Azure Front Door, and Azure Cache for Redis. Questions for this domain comprise 15% of the total questions for this exam.

1
Q

You’ve recently built a static website that leverages a Content Delivery Network (CDN) to help your site load quicker for users in farther regions. You want to ensure all connections enforce HTTPS. What is the most cost-effective and efficient method of ensuring all connections use HTTPS?

  • Generate and assign a certificate for the Static Web App to use.
  • Create a certificate in Azure Key Vault, and assign it to your Static Website and CDN Profile.
  • Convert your Static Web App to an Azure Web App Service and utilize the Standard tier to enforce HTTPS.
  • Create a custom domain and enforce HTTPS on your CDN Profile.
A

-Create a custom domain and enforce HTTPS on your CDN Profile.

You can set your CDN to utilize an SSL certificate from Microsoft as long as you assign your custom domain to your profile. Additionally, Microsoft will always use a secure connection for its custom URLs, but it’s unlikely you’d want to use that URL for your company’s web traffic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

You are developing a solution using Azure Web Apps and are designing an autoscaling rule. What property of the rule should you set to specify the amount of time to look back in metrics when determining if rules should be run (to avoid reacting to transient spikes)?

  • ScaleActionCooldown
  • ScaleActionDirection
  • Threshold
  • TimeGrain
A

-ScaleActionCooldown

ScaleActionCooldown is the amount of time to wait after a scaling operation, before scaling again.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

You are developing a solution using a Web App and Application Insights. You would like to configure an Application Insights Usage Analysis feature in your Web App to compare the numbers of users who return to your Web App after purchasing a product with the number who return after no purchasing. Which Application Insights Usage Analysis feature supports this?

  • Users, Sessions, Events
  • User Flows
  • Funnels
  • Retention
A

-Retention

Retention helps you analyze how many users return to your app and how often they perform particular tasks or achieve goals.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

You are developing a solution using a Web App and Application Insights. You would like to configure Application Insights sampling in the portal so that you can set a daily cap for usage and cost. Which sampling does NOT allow you to set a daily cap for usage and cost.

  • Fixed-Rate Sampling
  • Ingestion Sampling
  • Metric Sampling
  • Adaptive Sampling
A

-Adaptive Sampling

Adaptive sampling doesn’t allow you to set a daily cap for usage and cost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

You have a Web App that utilizes an Azure Web Application Firewall. All traffic to the Web App is routed through an Azure Application Gateway instance that is used by multiple Web Apps. The Web App address is azuredale.azurewebsites.net. All traffic has to be secured with SSL. How can you ensure traffic for azuredale.azurewebsites.net is secured via HTTPS?

  • Force HTTPS for all traffic traveling through the Web Application Firewall.
  • Configure an authentication certificate for azuredale.azurewebsites.net to the Azure Application Gateway.
  • Convert the Web App to run in an Azure App Service environment.
  • On the Azure Application Gateway HTTP setting, set the value of the override backend path option to azuredale.azurewebsites.net.
A

-On the Azure Application Gateway HTTP setting, set the value of the override backend path option to azuredale.azurewebsites.net.

This forces traffic to utilize HTTPS for all Web Apps leveraging the Gateway.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

You are developing a solution using Azure Web Apps and are configuring autoscaling. How many rules will you need to be able to increase servers when CPU load is high and to decrease servers when CPU load is low?

A

2

You need 2 rules in place — 1 to increase based on CPU load, 1 to decrease based on CPU load.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Your company has recently begun operating in additional countries, requiring changes to multiple operations throughout your enterprise to allow for international availability. As a web developer, it’s fallen on you to ensure your company’s website provides a smooth experience to potential customers in your company’s new regions and ensure things like video content can be viewed efficiently. What option should you choose for your website to deliver this experience?

  • Deploy a Content Delivery Network and place nodes in each region or the closest Azure region.
  • Increase your Web App’s service tier to account for the additional load the new regions will create.
  • Implement a new Web App in each region your company wants to be available in.
  • Utilize Azure Media Services to ensure your video content is available to multiple regions.
A

-Deploy a Content Delivery Network and place nodes in each region or the closest Azure region.

A Content Delivery Network would allow you to cache popular content in nodes around the world to allow for a better user experience.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

You need to investigate an HTTP 502 error happening with one of your web services. You need to investigate what is happening to your service and take appropriate steps to resolve the issue. Which command should you use first to collect data on the issue?

  • az monitor activity-log
  • az webapp log
  • az container attach
  • az ams live-output
A

-az monitor activity-log

This command will allow you to review events on your web service and track down potential culprits to your issue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

You are developing a solution using a Web App and Application Insights. You would like to configure Application Insights sampling in your Web App via the Python SDK. Which of the following Application Insights sampling types will NOT support this?

  • Ingestion Sampling
  • Adaptive Sampling
  • Fixed-Rate Sampling
A

-Adaptive Sampling

Python SDKs do NOT support Adaptive Sampling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

You are working as a developer for the Nutex Corporation. You are responsible for an online e-store system using PHP 7.4. You are preparing for the Black Friday and Cyber Monday period. Your CEO is afraid that during these periods, MySQL DB will be overloaded and will not respond fast enough.

Which cloud design pattern do you propose to mitigate MySQL potential problems?

  • Implement Sharding pattern
  • Implement Cache-Aside pattern
  • Implement Retry pattern
  • Implement Competing Consumers pattern
A

-Implement Cache-Aside pattern

You would implement the Cache-Aside pattern. The Cache-Aside pattern is used to improve performance when loading data. This pattern is for storing data in memory to speed up MySQL queries. It also keeps consistency between data in the underlying data store and data held in the cache.

You would not implement the Competing Consumers pattern. This type of pattern is used for queue implementation and can be a part of a solution, but it does not resolve database problems.

You would not implement the Retry pattern. The Retry pattern improves the stability of an application by allowing an application to retry a failed operation when intermittent failures of connecting to a network resource or a service occur. However, this pattern will not resolve database problems, although it could resolve connection problems.

You would not implement the Sharding pattern. This pattern is used for splitting data across databases, disks, files, or partitions. This pattern can resolve database issues for SQL and NoSQL, but not MySQL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

You are the administrator of the Nutex Corporation. You have created an ASP.NET MVC web application in Visual Studio. You have added Application Insights Telemetry to your project.

Which of the following code lines tracks exceptions to an automatically applied code change to your FileConfig.cs file?

  • filters.Add(new HandleErrorAttribute());

-“ProviderId”:
“Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider”

  • instrumentationKey:”7812zdg”
  • filters.Add(new ErrorHandler.AiHandleErrorAttribute());
A
  • filters.Add(new ErrorHandler.AiHandleErrorAttribute());

You would use filters.Add(new ErrorHandler.AiHandleErrorAttribute());. The AiHandleErrorAttribute class is in the ErrorHandler folder. Everytime an exception is made, this class attribute will log the exception. You can also use the AiHandleErrorAttribute class as an exception filter.

You would not use “ProviderId”: “Microsoft.ApplicationInsights.ConnectedService. ConnectedServiceProvider”, because this change is in the ConnectedService.json file.

You would not use filters.Add(new HandleErrorAttribute()); because this is the line of code used to put the HandleError attribute in its basic state. It is used before adding Application Insights telemetry to the project.

You would not use instrumentationKey:”7812zdg” because the instrumentation key and its value are added to
the _Layout.cshtml file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

You want to create a Node.js console application which will use CDN. You have created a resource group. You have configured Azure Active Directory to provide authentication for the application. You have applied permissions to the resource group so that only authorized users from your Azure AD tenant can interact with the CDN profile. You have created a folder to store your application. The project will be initialized with a packages.json file.

You use ms-rest-azure and azure-arm-cd. In the app.js file, you add the necessary “requires” for your NPM
packages. You define the constants.

What is the next step?

  • Assign the Reader role to the application.
  • Create a CDN profile.
  • Instantiate the CDN management client.
  • Create CDN endpoints.
A
  • Instantiate the CDN management client.

You would instantiate the CDN management client. With the code “var cdnClient = new cdnManagementClient(credentials, subscriptionId);”, you instantiate the CDN client variable.

Once you have added the “requires” for your NPM packages at the top of the app.js file and you have defined some contants for the method, you would instantiate the CDN management client by supplying credentials similar to the following:

var credentials = new msRestAzure.ApplicationTokenCredentials(clientId, tenantId, clientSecret);

var cdnClient = new cdnManagementClient(credentials, subscriptionId);

You would not create a CDN profile. You need to instantiate the CDN client before you can create a CDN profile.

You would not create CDN endpoints. You need to create the CDN profile before you can create CDN endpoints.

You would not assign the Reader role to the application. You would assign the CDN Profile Contributor role to the
service principal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

You are the administrator of the Nutex Corporation. You have a web application hosted in Azure. You have configured application insights to support exception reporting. To get diagnostic data specific to your app, you can insert code to send your own telemetry data. This data is displayed in a diagnostic search alongside the request, page view, and other automatically collected data. For that, you have several options.

Describe the following Trace Option.

TrackEvent()

A

TrackEvent() is used to count various events and is commonly used for monitoring usage patterns. The data it sends appears under Custom Events in a diagnostic search. You can use these events to filter your diagnostic searches because events are named and can carry string properties and numeric metrics.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

You are the administrator of the Nutex Corporation. You have a web application hosted in Azure. You have configured application insights to support exception reporting. To get diagnostic data specific to your app, you can insert code to send your own telemetry data. This data is displayed in a diagnostic search alongside the request, page view, and other automatically collected data. For that, you have several options.

Describe the following Trace Option.

TrackTrace()

A

TrackTrace() allows you to send a “breadcrumb trail” to help diagnose problems. You can use this option to send longer data, such as POST information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

You are the administrator of the Nutex Corporation. You have a web application hosted in Azure. You have configured application insights to support exception reporting. To get diagnostic data specific to your app, you can insert code to send your own telemetry data. This data is displayed in a diagnostic search alongside the request, page view, and other automatically collected data. For that, you have several options.

Describe the following Trace Option.

TrackException()

A

TrackException() allows you to send stack traces. You can capture exceptions automatically or log exceptions explicitly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

You are the administrator of the Nutex Corporation. You have a web application hosted in Azure. You have configured application insights to support exception reporting. To get diagnostic data specific to your app, you can insert code to send your own telemetry data. This data is displayed in a diagnostic search alongside the request, page view, and other automatically collected data. For that, you have several options.

Describe the following Trace Option.

Diagnostic Search

A

Diagnostic Search captures logs from frameworks such as Log4Net or NLog. You can view these logs in a diagnostic search alongside request and exception data.

17
Q

Leslie has been asked to enable Application Insights on the Nutex Sales Web Application that is already deployed and running on an Azure VM.

When deployed, the Nutex Sales App management team wants to know what metrics and benefits they should expect to see from runtime Application Insights activation.

What should Leslie tell them? (Choose all that apply.)

  • Detailed SQL command text
  • System performance counters
  • Code rebuild and redeploy required
  • Trace log integration
  • Page view and user data
  • More detailed exceptions
A
  • Detailed SQL command text
  • System performance counters
  • More detailed exceptions

By enabling Application Insights at runtime, Leslie will be able to get more detailed exceptions than when enabled during build-time.

Application Insights enabled at runtime can report on System Performance Counters.

Dependency diagnostics collection for runtime Application Insights can collect SQL commands being executed from the app in question.

Page view and user data is not a benefit of runtime Application Insights activation. When implemented at runtime, Application Insights cannot capture Page view and user data.

Trace log integration is not a benefit of runtime Application Insights activation. Application Insights implemented during the app build process can integrate with trace logging, but runtime activation cannot.

Code rebuild and redeploy required is not a benefit of runtime Application Insights activation. When Application Insights is activated at runtime, there is no required code rebuild or redeploy for the app in question.

18
Q

You are the administrator of the Nutex Corporation. You want to use Azure Application Insights alerts to send an email when the server’s response to HTTP requests average over 5 minutes and is slower than 1 second. Your application is named NutexApp and it is in the resource group NutexRG. You are the owner of the Azure subscription. You need to apply the correct values to the following PowerShell command:

Add-AzMetricAlertRule -Name “slow responses”

  • Description _____________
  • ResourceGroup _____________
  • ResourceId “/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/NutexRG/providers/microsoft.insights/components/IceCreamWebApp”
  • MetricName _____________
  • Operator _____________
  • Threshold 1
  • WindowSize _____________
  • SendEmailToServiceOwners
  • Location “East US”
  • RuleType _____________

Paramteres or Values:

  • 00:05:00
  • Metric
  • ‘NutexRG’
  • GreaterThan
  • ‘request duration’
  • ‘email me if the server responds slowly’
A

Add-AzMetricAlertRule -Name “slow responses”

  • Description “email me if the server responds slowly”
  • ResourceGroup “NutexRG”
  • ResourceId “/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/NutexRG/providers/microsoft.insights/components/IceCreamWebApp”
  • MetricName “request.duration”
  • Operator GreaterThan
  • Threshold 1
  • WindowSize 00:05:00
  • SendEmailToServiceOwners ‘
  • Location “East US”
  • RuleType Metric

The Add-AzMetricAlertRule cmdlet adds or updates a metric-based alert rule associated with a resource group. The description parameter’s value is just a text name describing the rule. The ResourceGroup parameter specifies the value for the NutexRG resource group. The MetricName parameter states the metric that is being used, in this case “request.duration”. The WindowSize parameter sets the time windows for the rule. In this scenario that is 00:05:00 or 5 minutes. The RuleType parameter specifies the type of rule. In this scenario, it is a metric type rule.

19
Q

You are the administrator of the Nutex Corporation. You have created a resource group for your CDN profile, and you have given Azure AD application permission to manage CDN profiles and endpoints within that group. Now you want to create your project. For authentication, you use ADAL to retrieve a token.

Which constant do you NOT need?

  • clientSecret
  • profileName
  • authority
  • resourceGroupName
  • subscriptionId
  • backendAddressPools
  • endpointName
  • resourceLocation
  • clientID
A
  • backendAddressPools

Constants need to be defined so that they can be used by methods. You can add constants in the Program class before the Main method. When adding constants, the values need to be in quotes. The following adds constants for the tenant app and the application:

//Tenant app constants
private const string clientID = "";
private const string clientSecret = ""; //Only for service principals
private const string authority = "https://login.microsoftonline.com//";
//Application constants
private const string subscriptionId = "";
private const string profileName = "CdnConsoleApp";
private const string endpointName = "<a>";
private const string resourceGroupName = "CdnConsoleTutorial";
private const string resourceLocation = "";

The backendAddressPools constant is part of an Azure load balancing deployment and not CDN.
</a>

20
Q

You are working as a developer for the Nutex Corporation. You are responsible for an online e-store system using PHP 7.4 with Azure CDN that uses default settings, which has been in place for more than ten months. You are preparing for Black Friday and Cyber Monday, and during this period you want some of the pictures in the store to be cached for 24 hours and the rest cached for 48 hours.

How can you achieve this? (Choose all that apply. Each answer is a complete solution.)

  • Enable Composer automation in Azure.
  • Use caching rules in CDN.
  • Add PHP_INI_SCAN_DIR to App Settings.
  • Add the PHP_EXTENSIONS key in the Application Settings section of the configuration blade.
  • Add php.ini to the wwwroot directory.
  • Use headers in your e-store system.
A
  • Use caching rules in CDN.
  • Use headers in your e-store system.

Azure Content Delivery Network (CDN) allows files from publicly accessible origin web servers to be cached for as long as their time to live (TTL) allows. The Cache-Control header determines the time of the TTL in the HTTP response from the origin server.

The expiration of web content in Azure CDN can be done in the following ways:

Setting Cache-Control headers by using CDN caching rules.
Setting Cache-Control headers by using configuration files.
Using caching rules is the recommended method for setting a web server’s Cache-Control header.

If you have static content such as images and style sheets, you can modify the applicationHost.config or Web.config configuration files of your web application to control the update frequency. You can use the // element in either the applicationHost.config or Web.config file to set the Cache-Control header for your content.

You would not add PHP_INI_SCAN_DIR to App Settings. This addition can be used for the configuration of PHP, but not for headers.

You would not add the PHP_EXTENSIONS key in the Application Settings section of the Configuration blade. This addition can be used for loading extensions for a PHP interpreter, but not for headers.

You would not enable Composer automation in Azure. Composer automation allows you to add Git add, Git commit, and Git push commands to your app. Composer automation will not add a custom .dll extension to PHP.

You would not add the php.ini file to the wwwroot directory. A php.ini file does not work in the web app.

21
Q

You are the administrator of the Nutex Corporation. You have created a resource group for your CDN profile, and you have given Azure AD application permission to manage CDN profiles and endpoints within that group. Now you want to create your project. For authentication, you use ADAL to retrieve a token.

Which directive do you NOT need?

  • Microsoft.Azure.Management.Cdn.Models
  • Microsoft.Azure.Management.Resources
  • Microsoft.Rest
  • Microsoft.IdentityModel.Clients.ActiveDirectory
  • Microsoft.Azure.Management.Redis.Fluent
  • System
  • Microsoft.Azure.Management.Cdn
  • System.Collections.Generic
  • Microsoft.Azure.Management.Resources.Models
A
  • Microsoft.Azure.Management.Redis.Fluent

Directives are used by the Cache-Control general header field. Directives specify behavior intended to stop caches from obstructing the request or response. These directives are designed to override the default caching algorithms. You can add directives in the Program.cs tab. You replace the using directives at the top of the Program.cs tab with the following:

using System;
using System.Collections.Generic;
using Microsoft.Azure.Management.Cdn;
using Microsoft.Azure.Management.Cdn.Models;
using Microsoft.Azure.Management.Resources;
using Microsoft.Azure.Management.Resources.Models;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest;

Microsoft.Azure.Management.Redis.Fluent is not a directive which can be used for CDN.

22
Q

You are creating a web application to be deployed to Azure, and you are concerned about the cloud services’ performance. You need to improve the user experience for end users who are far from content sources. You decide to use the Azure Content Delivery Network (CDN).

From the following choices, select the option that is incorrect for a CDN.

  • CDN caches content in Azure Blobs at physical locations across the world.
  • Only use the CDN to cache static content.
  • Only publicly available Blobs are cached with CDN.
  • Provides access to content over HTTPS for a site on your custom domain.
A
  • Provides access to content over HTTPS for a site on your custom domain.

You would select the option providing access to content over HTTPS for a site on your custom domain. It is actually possible to provide access to content over HTTPS with some limitations. Currently, you cannot use HTTPS with a custom domain name. You have to use the certificate provided by the CDN. You cannot yet use your own domain/SSL certificate with Azure CDN.

You would not select the option that CDN caches content in Azure Blobs at physical locations across the world. As a matter of fact, that is exactly what a CDN does. Having the content cached will maximize the bandwidth for delivering content to users.

You would not select the option that only publicly available Blobs are cached with CDN. Blobs that are in public containers and are available for anonymous access can be cached by the CDN.

You would not select the option to only use the CDN to cache static content. This is actually one of the constraints. The CDN is used to cache static content only.

23
Q

The Nutex Application Services team has several Azure VMs and need a solution to monitor the web workloads on each. You mentioned using Azure Application Insights to track VM Performance Counters over lunch with a team member. The team wants you to lead the VM monitoring project.

How should you proceed? List the appropriate steps in order.

A

You would proceed in the following order:

Ensure the Sales App targets the full .Net Framework.
Install Application Insights Status Monitor on the VM.
Sign in with your Azure Credentials.
Restart IIS.
Add the requisite counters in ApplicationInsights.config.
Performance counters can be collected when adding Application Insights to .Net Framework targeting apps. You need to ensure the Sales App targets the full .Net Framework.

You will have to install Application Insights Status Monitor on the VM. This must be done to ensure the appropriate DLLs and application hooks are added to enable monitoring.

You will have to sign in with your Azure Credentials. During the Status Monitor install, your Azure Credentials will direct the Application Insights output to your Azure Portal.

After the Status Monitor install, you will be asked to restart IIS.

You must add the requisite counters in the ApplicationInsights.config file. If the Performance Counters you require are not already being monitored, you must add them to the config file.

You would not verify the Sales App targets, only the .Net Core. Performance counters cannot be collected when adding Application Insights to .Net Core developed apps.

24
Q

A company has a web application that has been deployed using the Azure Web App service. The current service plan being used is D1. It needs to be ensured that the application infrastructure can automatically scale when the CPU load reaches 85 percent. You also have to ensure costs are minimized. Which of the following steps would you implement to achieve the requirements? Choose 4 answers from the
options given below.

  • Enable autoscaling on the Web application
  • Configure a scale condition
  • Configure the web application to use the Standard App Service Plan
  • Configure the web application to use the Premium App Service Plan
  • Add a scale rule.
A
  • Enable autoscaling on the Web application
  • Configure a scale condition
  • Configure the web application to use the Standard App Service Plan
  • Add a scale rule.

https://docs.microsoft.com/en-us/azure/azure-monitor/autoscale/autoscale-get-started#create-your-first-autoscale-setting

25
Q

A developer needs to enable Application Insights Profiler for the Azure Web App. Which of the following feature is required to enable Application Insights Profiler for a Web App?

  • CORS configuration
  • Always On setting
  • Enable Identity
  • Enable Custom domains
A
  • Always On setting

https: //docs.microsoft.com/en-us/azure/azure-monitor/app/profiler