How To Setup Windows Server Virtual Machine Monitoring in Azure

Congratulations !! You have now setup a virtual machine in Azure. The post-build configurations have been completed. The server is now accessible with a domain username and password to it’s IP address on a random RDP Port (you were smart to block the default RDP port on all the firewalls and in the Windows Firewall Advanced Settings).

Now, time to setup monitoring on the new Windows Server VM for disk space:

Step 1: Sign in to Azure Portal

  1. Navigate to Azure Portal.
  2. Log in with your credentials.

Step 2: Find Your VM

  1. In the left-hand menu, click Virtual Machines.
  2. Select the Windows Server 2025 VM you want to monitor.

Step 3: Enable Azure Monitor Agent on the VM

  1. In the VM overview, scroll down to Monitoring.
  2. Click Insights.
  3. If not already enabled, click Get started and enable Azure Monitor for this VM.(> If you haven’t configured monitoring before, follow the prompts to enable it, which involves installing the Log Analytics agent.)

Step 4: Create or Use an Existing Log Analytics Workspace

  1. Go to Log Analytics workspaces in Azure.
  2. If you don’t have one, click Create and follow the prompts:
    • Provide a name.
    • Choose the Subscription and Resource Group.
    • Select a region.
  3. Connect your VM to this workspace during the setup (or confirm it’s connected).

Step 5: Configure Data Collection for Disk Metrics

  1. In the Log Analytics workspace, click Advanced settings.
  2. Under Data tab, ensure Heartbeat and Performance Counters are enabled.
  3. To monitor disk space, ensure the Performance counters include:
    • LogicalDisk(*)\% Free Space
    • LogicalDisk(*)\Free Megabytes

(These are typically collected automatically if the agent is configured correctly. )

Step 6: Create a Log Analytics Alert Rule for Disk Space

  1. In the Azure Portal, go to Monitor in the left menu.
  2. Click Alerts > + New alert rule.
  3. Select the Scope :
    • Choose the VM or Resource Group where your VM resides.

Step 7: Define the Condition

  1. Click Add condition.
  2. Search for and choose Custom log search.
  3. Use a query similar to this to monitor free space:kusto Perf | where ObjectName == "LogicalDisk" and CounterName == "% Free Space" | summarize AvgFreePercent = avg(CounterValue) by InstanceName | where AvgFreePercent < 10 (Adjust 10 to your threshold for free space percentage. )
  4. Set the threshold (e.g., when the condition is true for 5 minutes).
  5. Click Done.

Step 8: Set the Action Group

  1. Under Actions, click Create action group (or select an existing one).
  2. Provide a name.
  3. Add notification action(s):
    • Email (enter recipients).
    • SMS.
    • Webhook or other actions as needed.
  4. Review and create the action group.

Step 9: Configure Alert Details

  1. Name your alert rule.
  2. Set the severity (e.g., 2 for Warning).
  3. Attach the created or selected action group.

Step 10: Review and Create

Click Create to activate your alert rule.