Recently I was working on a project that was migrating an application from AWS to Azure, one of the outcomes of the project was to vastly simplify the setup when running on Azure so we settled on a running predominantly on Azure Durable Function orchestrating the application and all the processing being done on a Virtual Machine Scale Set in Azure.
The first thing to know about working with Virtual Machine Scale Sets in Azure is that they are a very hands off, set and forget type of resource, only have a minimal number of Virtual Machines running and then scaling out and in as the workload dictates. For instance, the initial set of Virtual Machines that the Scale Set is created with has local accounts created, the new ones added in when scaling don’t, also, installing applications to them is all done via PowerShell scripts that are run as part of a Virtual Machine Extension (more details on installing application to a Virtual Machine Scale Set can be found here). Since everything else was logging to Application Insights we thought it would be a good idea to see if we could also log the installation of the applications via the Custom Extensions to Application Insights too so we could have confidence that everything is running and setup ready to accept requests once scaled.