Skip to main content


Showing posts from November, 2021

GraphQL HotChocolate 12 - Updated Application Insights monitoring

It seems that with every release of HotChocolate, I can write a follow up post. With the release of HotChocolate 11, I wrote a blog post on how to integrate it with Application Insights. With the HotChocolate 12, there was again a small update in the available interfaces and API’s. Let’s check the changes we have to make… First of all, our diagnostic class should no longer inherit from DiagnosticEventListener but from ExecutionDiagnosticEventListener . The signature of the ExecuteRequest method has changed as well. Instead of returning an IActivityScope it should return an IDisposable : This also means that our RequestScope no longer needs to implement the IActivityScope interface but only needs to implement IDisposable : Here is the full example:

C# 10–Change an existing project to file scoped namespaces

C# 10 introduces file scoped namespaces . This allows you to remove the ‘{}’ when your source file only has one namespace(like most files typically have). So instead of writing: you can now write: To apply this for an existing project written in C# 9 or lower, you can do this in one go. Therefore set the language version of your project to C# 10: Now we need to update our .editorconfig file and add the following line: After doing that Visual Studio will help us out and we can use “Fix all occurences in Solution” to apply it in one go:  

Running Azure on your laptop–Part 3–Prerequisites

In the previous post in this series I talked about why Azure Arc is also interesting for developers. Today we finally move on to the more practical part and try to get it up and running on our local machine. Let’s first focus on what you need to have up and running on your local machine first: Make sure your kubeconfig file is configured properly and you are working against your k8s cluster context . Install or update Azure CLI to version 2.25.0 and above . Install and Set Up kubectl Install Helm 3 . If you are on a Windows environment, a recommended and easy way is to use the Helm 3 Chocolatey package . As we want to run Azure Arc on our local machine, we also need to have a local AKS cluster up and running. You can use Minikube , MicroK8S , KIND (Kubernetes in Docker), or any other flavor you like that can be installed locally. I tested both in MiniKube and KIND. Now we can move on to the Azure side. Let’s see what we need the

Running Azure on your laptop–Part 2 - Azure Arc for Developers

In the previous post in this series I talked about Azure Arc and it’s multiple flavors. Although one Azure managed control plane for all your resources no matter if there are on premise, on Azure or hosted at another cloud provider sounds great if you are an IT ops guy(or girl) but why should you care as a developer as well? It is important to understand that the Azure Arc story has 2 dimensions. 1. Arc enabled infrastructure The first dimension is the Arc enabled infrastructure. This is the part that I already talked about and that allows you to connect and control hybrid resources like they are native Azure resources. This allows you to use additional Azure Services like Azure Policy, Azure Monitor, and so on to govern, secure and monitor these services. 2. Arc enabled services The second dimension is Arc enabled services. Once you have an Arc enabled infrastructure, you can start to deploy and run Azure Services outside Azure while still operation them from Azure. This

Running Azure on your laptop– Part 1–What is Azure Arc?

Before I dive into the details on how to get Azure Arc up and running on your laptop, it would be a good idea to start with a short introduction. Therefore we first have to dive in how Azure works. The hearth of the Azure ecosystem is the Azure control plane. This control plane manages all the resources you can find in Azure. It helps you to inventorize, organize and govern all resources and multiple tools exist that can help you to interact with it (think ARM templates , Bicep , Terraform , Pulumi , …) You probably know this control plane better as the Azure Resource manager. It controls and manage all the Azure resources which can be as big as a Kubernetes cluster and as small as a static ip address. These resources run inside an Azure region, one of the datacenters that Microsoft has all around the world. So where does Azure Arc fits into this picture? If we bring Azure Arc into the picture, we can bring resources that are not running on Azure to the Azure control plane

Running Azure on your laptop–Introduction

As mentioned yesterday I promised to write a series of follow up posts about my ‘Running Azure on your laptop’ session. I’ll use this post as a placeholder to point to the different parts. Microsoft is more and more embracing a hybrid cloud approach. As part of this evolution, an increasing amount of ‘Azure only’ services become available outside Azure. This idea is not new, people who work long enough in the Microsoft ecosystem maybe remember Azure Pack ,  which was a way to install Azure software on your own hardware.It gave you the Azure portal and some of it’s services. I never tried it myself and I don’t know any customer who used it in the wild. A couple of years later, Microsoft announced the Azure Pack’s successor, Azure Stack. This was a hardware appliance, that you could install in your own datacenter. Over time, the name evolved to Azure Stack Portfolio as multiple flavors of Azure Stack became available. Azure Stack is still available today and keeps evolving. At Ign

VisugXL - Running Azure on your laptop using Azure Arc

Last weekend I gave a presentation at VisugXL about Azure Arc . I’ll write a few follow-up posts explaining the steps I took to get it all up and running(and where I got into trouble). If you can’t wait until then, here is already the presentation:

.NET 6–Breaking changes

Although Microsoft takes a lot of effort to maximize backwards compatibility , migrating to .NET 6 can result in breaking changes that might affect you. So before you start to upgrade have a look at the list of breaking changes maintained here:

Azure DevOps–Run a tool installed as npm package

As part of our build pipeline we wanted to use GraphQL Inspector to check if our updated GraphQL schema contained any breaking changes. GraphQL Inspector is available as a commandline tool and can be installed through NPM. So the first step was to use the NPM task to install the tool: But now the question is how can we invoke the installed tool? This is possible thanks to NPX. NPX stands for Node Package Execute and it comes with NPM. It is an npm package runner that can execute any package that you want from the npm registry. I added a command line task to invoke npx: Remark: When using NPX you even don’t need to install the package first. This means that the NPM task I created first is not necessary.

ASP.NET Core - Build a query string

What is wrong with the following code? Nothing you would say? What if I passed ‘Bert & Ernie’ as the searchterm parameter? The problem is that I’m using string interpolation to build up the query. This could be OK if you have full control on the passed parameters but in this case it is input coming from a user. The example above would lead to an incorrect query string. Writing the correct logic to handle ampersands, question marks and so on would be a challenge. Luckily ASP.NET Core offers a QueryHelpers clas with an AddQueryString function: public static string AddQueryString( string uri, string name, string value); public static string AddQueryString( string uri, IDictionary< string , string > queryString); Let’s update our code example to use this: That's better!

Azure DevOps Pipelines–A local file header is corrupt

A colleague contacted me with the following question; he tried to run a specific Azure Pipelines build but before even one build task could be executed, the build failed. I asked him to send me the logs and he shared the following screenshot: As you can see the build fails in the ‘Job initialization’ phase while downloading a specifc task ‘VersionAssemblies’. The strange this was than when I searched for this build task I couldn’t find it between the list of installed extensions on the Azure DevOps server. I took a look at the Azure DevOps marketplace and even there this specific build task was non-existent. Strange! At least this explained the error message I got, as the build pipeline probably couldn’t find the task either. In the end I fixed it by introducing an alternative build task that achieved the same goal(updating the AssemblyInfo with a build number).

Azure DevOps–SonarQube error

As part of our build pipelines, we run a code analysis through SonarQube. After moving SonarQube to a different server, our Azure DevOps pipelines started to fail. When I opened the build logs, I noticed the following error message: ERROR: JAVA_HOME exists but does not point to a valid Java home folder. No “bin\java.exe” file can be found there. I logged in on our SonarQube server and checked the value of the JAVA_HOME environment variable: JAVA_HOME = c:\program files\Zulu\zulu-11\bin\ Based on the error message above, it seems that the SonarScanner expects that we don’t include the ‘bin’ folder. So I updated the environment variable to: JAVA_HOME = c:\program files\Zulu\zulu-11 After rescheduling the build, the SonarQube analysis task completed succesfully.

GraphQL Crash Course

If you want to get started with GraphQL, you can have a look at the following video: Remark: This is part of a bigger course that is available on Udemy .