Skip to main content

Posts

Showing posts with the label Azure

Telemetry Correlation in Azure Application Insights

 Azure Application Insights is frequently being used by workloads running on Azure. The most simple and common example of this is a Web Application calling a RESTful API. In most enterprise-y scenario, one would find it to be a single page app commonly written in React/Angular talking to a .NET/Java Web API. However a surprising number of developers don't use or haven't heard of telemetry correlation in Application Insights. Azure SDK provides a robust mechanism of enabling telemetry correlation for various languages and frameworks. For .NET Core, this is turned on by default and you don't have to do any thing except adding  Microsoft.ApplicationInsights.AspNetCore nuget package and including the following line in your code: builder.Services.AddApplicationInsightsTelemetry(); For other frameworks, it is not as simple. Here I am going to show an example for a React app. This app is bootstrapped using Create React App (CRA) tool. Next create a file AppInsights.js and add ...

Get back to work using Azure Health Bot

For the past year and half, Covid-19 pandemic has forced most of the companies to allow their employees to work from home. However, now that vaccines are available, companies are looking for a way to get their employees back to office safely. Most of the organizations are creating some kind of app which will capture employee health information safely and allow them to get approve/deny an employee's return to office. But what if instead of rolling out your own platform, you could leverage the full power of Azure with almost no code and also ensure full compliance with health data regulations. Meet Azure Health Bot. Azure Health Bot is an Azure Marketplace offering by Microsoft built on top of Microsoft Bot Platform. It provides features like drag/drop editor, authentication with OAuth providers, generating reports and managing user information. It also integrates with existing chat apps like WhatsApp, Telegram, Facebook Messenger etc. so that users don't have to install a new ap...

Azure Application Insights Logging and EF Core in a Domain Driven Design

Logging is one of the core pillars of application development. .NET Core has fantastic support for rich contextual logging which spans across distributed system using its Activity API . Azure Application Insights SDK offers extensive logging out of the box without writing a single line of code. Just wire up the SDK and you are good to go. However there may be situations where you may want more fine grained control over the logging experience. Fortunately, its as simple as writing: Activity activity = new Activity("Test Message"); var operation = telemetryClient.StartOperation<DependencyTelemetry>(activity); This TelemetryClient is injected in your application when you wire up Application Insights. services.AddApplicationInsightsTelemetry(options => options.InstrumentationKey = "YOUR_AI_KEY"); This works seamlessly till you hit the road block of Domain Driven Design and Entity Framework Core. In DDD, entities represent a real-world business object and perf...

Use Azure App Configuration To Store Hierarchical Data

.NET Core has first class support for parsing hierarchical configuration data . If you have a JSON configuration like this,  { "rootObject": [ { "level1": "l1v1", "level2": "l1v2" }, { "level1": "l2v1", "level2": "l2v2" } ] } then you can easily target individual values with " rootObject:[0]:level1 ". However to store this JSON, you have to either use a File System or some kind of database. The problem with this approach is that you have to modify the entire document when you want to change a value of any field. If you are not careful, you may end up corrupting the JSON and thus breaking your system. This is where Azure App Configuration comes in the picture. Azure App Configuration is nothing but a key-value store. We can use that to store the hierarchical values like this: Once you inject this Azure App Configuration in your .NET Core project and call C...

Benchmarking Azure Key Vault Decryption

Azure Key Vault is used to store Keys, Certificates and Secrets and make them available to applications safely. It can create and store asymmetric (RSA and EC) keys. These keys expose their public key material but the private key remains stored within Key Vault. For decryption, the application needs to make a REST call to the Key Vault which will then return the decrypted result. There are libraries available for various languages and frameworks (including .NET) which enable developers to do this seamlessly. Integrating Azure Key Vault with .NET applications is a straight-forward process although  not documented widely . One of the frequently recommended technique for securing data is to use Envelope Encryption . This requires use Key Encryption Key (KEK) which is typically a RSA key stored in Azure Key Vault. The Data Encryption Key (DEK) is generated for each piece of data and is then used to encrypt the data using symmetric algorithms like AES. DEK is then itself encrypted using...

Integrating React with SonarQube using Azure DevOps Pipelines

In the world of automation, code quality is of paramount importance. SonarQube and Azure DevOps are two tools which solve this problem in a continuous and automated way. They play well for a majority of languages and frameworks. However, to make the integration work for React applications still remains a challenge. In this post we will explore how we can integrate a React application to SonarQube using Azure DevOps pipelines to continuously build and assess code quality. Creating the React Application Let's start at the beginning. We will use npx to create a Typescript based React app. Why Typescript? I find it easier to work and more maintainable owing to its strongly-typed behavior. You can very well follow this guide for jsx based applications too. We will use the fantastic Create-React-App (CRA) tool to create a React application called ' sonar-azuredevops-app '. > npx create-react-app sonar-azuredevops-app --template typescript Once the project creation is done, we ...