Azure – You can now deploy Azure Monitor Application Insights Agent on Azure Virtual machine and Azure Virtual Machine Scale Sets

You may already know Azure Monitor Application Insights, which is an application performance management service for web developers, helping you gain insights about your application performance and reliability.

Well, good news, you can now deploy Azure Monitor Application Insights as an agent (aka extension) on Azure Virtual Machines or Azure Virtual Machines Scale Sets when these VM/Scale Sets host web application running on .Net with IIS (if you are using another language you still need to use the SDK to embedded Application Insights into your application).

This can be quite useful when you do not have access to the source code of the application and want to leverage and take advantage of Application Insights.

You have 2 ways to deploy the Application Insights agent on your VM/Scale Sets:

  • From the Azure portal (https://portal.azure.com/) by accessing the Extension blade of your virtual machine/scale sets and add the Application Insights Agent extension

For Virtual Machine

image_thumb  image_thumb[1]  image_thumb[2]

For Virtual Machine Scale Sets

image_thumb[3]  image_thumb[4]  image_thumb[5]

  • Of using PowerShell by using the following command

For a virtual machine

$publicCfgJsonString = ‘
{
   “redfieldConfiguration”: {
     “instrumentationKeyMap”: {
       “filters”: [
         {
           “appFilter”: “.*”,
           “machineFilter”: “.*”,
           “instrumentationSettings” : {
             “instrumentationKey”: “<instrumentation key from your Application Insights”
           }
         }
       ]
     }
   }
}
‘;
$privateCfgJsonString = ‘{}’;

Set-AzVMExtension -ResourceGroupName “<your resource group>” -VMName “<your virtual machine>” -Location “<location of the virtual machine>” -Name “ApplicationMonitoring” -Publisher “Microsoft.Azure.Diagnostics” -Type “ApplicationMonitoringWindows” -Version “2.8” -SettingString $publicCfgJsonString -ProtectedSettingString $privateCfgJsonString

For a virtual machine scale sets

$publicCfgHashtable =
@{
   “redfieldConfiguration”= @{
     “instrumentationKeyMap”= @{
       “filters”= @(
         @{
           “appFilter”= “.*”;
           “machineFilter”= “.*”;
           “instrumentationSettings”= @{
            “instrumentationKey”= “<instrumentation key from your Application Insights”
           }
         }
       )
     }
   }
};
$privateCfgHashtable = @{};

$vmss = Get-AzVmss -ResourceGroupName “<your resource group>” -VMScaleSetName “<your VM Scale Sets name>”

Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name “ApplicationMonitoring” -Publisher “Microsoft.Azure.Diagnostics” -Type “ApplicationMonitoringWindows” -TypeHandlerVersion “2.8” -Setting $publicCfgHashtable -ProtectedSetting $privateCfgHashtable

Update-AzVmss -ResourceGroupName $vmss.ResourceGroupName -Name $vmss.Name -VirtualMachineScaleSet $vmss

Benoit Hamet
Benoit Hamet
Benoit is working on Microsoft collaborative technologies He has been awarded as MVP for more than 12 years Currently MVP on Office 365 after being awarded on SharePoint (2011-2012) and Windows client & server (2002-2007) Speaker at various Microsoft events (TechDays, TechNet seminars) and Quest Software He works on on-premises (Active Directory, RADIUS/NPS, Exchange, Skype for Business, SharePoint, SQL, Terminal Server, Windows client and Windows Server) or online (Azure, Intune, Office 365, Exchange Online, SharePoint Online, Skype for Business Online, Teams) technologies

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Get in touch

Your Name (required)

Your Email (required)

Subject

Your Message

Book a Demo

Your Name (required)

Your Email (required)

Phone Number(Optional)

Ask a Question

Your Name (required)

Your Email (required)

Phone Number(Optional)

Your Message

Book Assessment

Evaluate your modern workplace security posture and validate it against current best practices with a Microsoft Secure Score Assessment, from cubesys

Your Name (required)

Your Email (required)

Phone Number(Optional)

Book your Windows Analytics Deployment

Your Name (required)

Your Email (required)

Phone Number(Optional)