AZ-204 Developer Associate: Troubleshooting and Monitoring Azure Solutions

Last updated Jul 22, 2024 Published Jun 20, 2022

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
  • 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

Load data on demand into a cache from a data store. This can improve performance and also helps to maintain consistency between data held in the cache and data in the underlying data store.

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

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 supportsdifferent 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.

Application Insights uses Kusto Query Language (KQL) for querying the data through custom commands. KQL is similar to SQL, however the syntax is different. 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. Is us 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

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 following example is a query from the Microsoft Learn module that fetches data from StormEvents, filters it with the where keyword and counts the total of rows.

StormEvents 
| where StartTime between (datetime(2007-11-01) .. datetime(2007-12-01))
| where State == "FLORIDA"  
| count

References

  1. [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