Deploy Azure Monitor Agent at Scale

There’s a new agent for Azure Monitor. Naturally, at some point you’ll need to deploy this agent. And if we’re talking cloud, you’ll probably need to do it at scale. Even doing it on 50 servers is more than I would want to touch by hand

At scale, your first thought might be PowerShell. While we have two cmdlets we can use to install the new Azure Monitor Agent as an Azure Extension on both Azure VMs and ARC Connected machines, they do not accept multiple inputs. So you’d be creating a for loop in PowerShell. This could take quite a while.

Azure Policy

Just like with the Log Analytics agent, AKA Microsoft Monitoring Agent (MMA), we can use Azure Policy. This is again my preferred and recommended way to deploy the Azure Monitor Agent. First, it will remediate any existing machines and it will also auto install on newly deployed VMs as well. It is largely a set it and forget it type of thing.

We have 3 Policy definitions at this time. One for Security Center, one for Linux and one for Windows.

For Windows we have no parameters as where the data is pointed to, is now controlled by Data Collection Rules. So we only need a remediation task to deploy the agent.

Set your scope and deploy. After some time, like a lunch break, the policy should have at least evaluated your environment and started its remediation. Policy is great, but its certainly not fast.

In the Azure portal under your Azure and ARC VMs extension blade, we’ll start seeing the Azure Monitor Agent extension show up.

You can of course also add the extension via ARM Template as well.


The new Azure Monitor Agent is really a wholesale change in the monitoring and data collection scope. I have another post here that explains further. Additionally I will be doing posts around Data Collection Rules as well.