AZ-204 Developer Associate: Troubleshooting and Monitoring Azure Solutions
The content here is under the Attribution 4.0 International (CC BY 4.0) license
Azure offers different services to troubleshoot and monitor applications, it might vary based on the type of application you are building. Nevertheless, application insights could be of help to mitigate issues. In this section, we will go through those services to better understand their purpose and what they do as well as tips that could be helpful while studying.
Application Insights
- Concepts
- Application performance
- Monitor applications
- Diagnose issues
- Install an instrumentation package
- Monitored aspects
- Request rate
- Exceptions
- Page views
- User sessions count
- Performance of underlying machine
- Custom metrics are written in the code
- Installation
- Visual Studio
- creates a web MVC application
- From Project click on “Add Application Insights Telemetry”
- It can be installed locally or be used through Azure Portal
- Visual Studio
- Creating app insights
- telemetry is stored in a log workspace
- in .NET apps, it stores the instrumentation key under
Secrets.json
file - Insights allows dependency tracking from sql server
CLI
this section was not asked in any of the mock exams
Azure CLI offers an application insights extension (for the time being it is not official, but as this is a developer associate exam I thought it is worth mentioning it here).
az monitor app-insights query --app myapp -g mygroup --analytics-query 'traces | where message contains "bla"' --start-time 2022-07-10T09:10:00.000Z -o table
For further reference, follow this issue created in the official GitHub repository.
Tracking users
By default insights adds a random id from the user that, to corelate that with a actual user from an app, a custom metrics is needed. In c# (dotnet core) it is done extending the class TelemetryInitializeBase
Tracking page views
Can be done via javascript embedded in the html page
Application map
Draws a diagram based on the requests tracked by insights
Insights funnel
User flows
Availability
- URL ping
- Multi-step test
Web site scale
https://docs.microsoft.com/en-us/azure/app-service/web-sites-scale
Web logic apps
Web logic app is an Azure service that allows developers to integrate different services in the cloud. Some of the examples shared in the official documentation are:
- React to an event that happened in Office 365
- Move uploaded files from an SFTP or FTP server to Azure Storage.
- Monitor tweets
Caching
Cache-Aside
CDN
The caching behaviors that are offered by Azure are something to keep in mind while preparing for the exam.
- Bypass cache
- Override
- Set if missing
CDN settings
- Ignore query string
- Bypass caching for query string
- Cache every unique URL
Azure cache for Redis
- Managed Redis
- Pricing?
- Redis package for c#: StackExchange.Redis
- Integrating Azure cache with c#
Caching rules
- Bypass cache
- Default
- Override
- Set if missing/cosmos
Front door
Azure Front Door is a CDN service that provides the delivery of large file sizes without a cap on file size. Front Door supports different mime types as well as compression. The full list is available under Microsoft’s official Front Door documentation.
Purge caching
- Single path value
- Wildcard purge
- Root domain purge
KQL
This section was based on different resources, a mix of official Microsoft documentation and books. Microsoft Learn in addition to the material provided, it creates a free environment for trying the queries in Azure Data Explorer.
-
The work done by Morowczynski et al. on “The Definitive Guide to KQL: Using Kusto Query Language for Operations, defending, and threat hunting” was used in this content [1].
- Kusto Query Language (KQL) overview
- KQL quick reference guide
- Gain insights from your data by using Kusto Query Language - In this hands-on course, the aggregation of data with KQL is explored.
Application Insights uses Kusto Query Language (KQL) for querying the data through custom commands. KQL is similar to SQL. It was developed as part of Azure Data Explorer, a big data analytics platform for near-real-time analysis of large volumes of data streamed in from multiple sources. It is used across Microsoft solutions to analyze, investigate and plot data. According to Microsoft Learn, these are the services that benefit from using KQL:
- Azure Data Explorer
- Azure Monitor
- Microsoft Sentinel
- Azure Resource Graph
- Microsoft Defender XDR
- Configuration Manager
For AZ-204 KQL is focused on the Application Insights. One of the advantages of KQL is its ability to quickly process huge amounts of highly varied data.
Features
- tabular expression statements: Input and Output consist of tabular data. This type of query is closely related to SQL. A person having a SQL background would easily recognize what the query is doing even without any KQL knowledge.
- let statements: This is used to bind a value to a query. It is closely related to prepared statements in SQL libraries for programming languages.
- built-in functions: The KQL library offers a varied range of custom functions to be used in queries. Sorting, matching and transforming are some of the functionalities available.
- user-defined functions: Users in the absence of a standard function that fulfills a requirement are allowed to create their functions. There are two types of user-defined functions: stored functions and query-defined functions. As their name suggests, the first type is stored and used across different queries, whereas the second type is used just for the current query being executed. Both approaches are a good way to reuse queries when needed.
Query
A KQL query is a read-only request to process data and return results. The simplest query executed for KQL is just the table name, it will fetch all the data available:
StormEvents
Filtering is done through different keywords, the following example is based on a query from the Microsoft Learn module that fetches data from StormEvents in Florida:
StormEvents
| where State == "FLORIDA"
Filters are composable, the next example specifies the date and time to narrow the data even more:
StormEvents
| where StartTime between (datetime(2007-11-01) .. datetime(2007-12-01))
| where State == "FLORIDA"
Query - Challenges
- Build a query that selects the first 10 rows of a table
References
- [1]M. Morowczynski, R. Trent, and M. Zorich, The Definitive Guide to KQL: Using Kusto Query Language for Operations, Defending, and Threat Hunting. Microsoft Press, 2024 [Online]. Available at: https://www.goodreads.com/book/show/200010377-the-definitive-guide-to-kql
Changelog
- Jul 22, 2024 - Added KQL section
Table of contents
Got a question?
If you have question or feedback, don't think twice and click here to leave a comment. Just want to support me? Buy me a coffee!