Share via

How to retrieve the number of running applications/processes inside an Azure Virtual Machine

Sree Aravind M 40 Reputation points
2026-04-07T07:54:08.91+00:00

We need to identify how to get the number of running applications/processes inside an Azure Virtual Machine. Looking for supported approaches to retrieve this information from within the VM environment. This can include APIs, monitoring tools, agents, or any Azure-native solutions. The requirement is to programmatically or operationally determine active processes. Kindly provide the recommended and supported method to achieve this.

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.


2 answers

Sort by: Most helpful
  1. Alex Burlachenko 20,425 Reputation points MVP Volunteer Moderator
    2026-04-08T10:00:30.04+00:00

    Sree Aravind M hi and thx for stay with us at Q&A platform,

    yeah Azure itself doesnt know whats running inside ur VM. It only sees CPU, RAM, disk etc process list = inside guest OS only, so u got 3 real options, simplest run command inside VM

    linux

    ps -e --no-headers | wc -l
    

    windows

    (Get-Process).Count
    

    trigger via

    Azure Run Command

    SSH / RDP

    proper way (at scale) Azure Monitor Agent + Log Analytics, enable VM insights, then u can query processes

    example KQL

    InsightsMetrics

    | where Name == "Processes"

    or use process tables depending on config, this is the only “Azure-native” way to do it centrally

    third option custom script / agent. Deploy something that collects process count and pushes to

    Log Analytics

    App Insights

    or your API

    important there is no Azure API like: “give me process count for VM”

    bc Azure does not inspect inside OS unless agent is installed

    rgds,

    Alex


  2. Jilakara Hemalatha 12,105 Reputation points Microsoft External Staff Moderator
    2026-04-07T09:00:07.6866667+00:00

    Hello Aravind,

    Thank you for reaching out Q/A.

    I understand that you are looking for a supported and programmatic way to retrieve the count and details of running applications/processes inside an Azure Virtual Machine.

    To set the right expectation, Azure does not expose process-level information at the platform (fabric) level, since all running processes exist within the guest operating system. As a result, retrieving this information always requires either executing commands inside the VM or using a supported monitoring agent.

    Below are the recommended and supported approaches:

    1.VM Insights with Processes & Dependencies:

    This is the primary Azure-native and fully supported approach for continuously monitoring running processes inside a VM.

    How it works:

    • Enable VM Insights from the Azure Portal (VM → Monitoring → Insights)
    • During setup, ensure “Enable processes and dependencies” is selected
    • This deploys the Azure Monitor Agent (AMA) along with the Dependency Agent
    • Process data is collected into the VMProcess table in the Log Analytics workspace
    • You can use KQL queries to retrieve process details and process counts

    Reference: https://learn.microsoft.com/en-us/azure/azure-monitor/vm/tutorial-enable-monitoring

    2.Performance Counter for Process Count:

    For near real-time monitoring of process count metrics, you can configure custom performance counters using a Data Collection Rule (DCR) with the Azure Monitor Agent.

    • Works for both Windows and Linux VMs
    • Useful for alerting scenarios (for example, when process count exceeds a threshold)
    • Best suited for numeric monitoring rather than detailed process inspection

    Reference: https://learn.microsoft.com/en-us/azure/azure-monitor/vm/data-collection-performance

    1. Azure VM Run Command (On-Demand / Ad-hoc)

    For one-time or ad-hoc retrieval without relying on continuous monitoring:

    Windows:

    az vm run-command invoke --resource-group <ResourceGroupName> --name <VMName> --command-id RunPowerShellScript --scripts "(Get-Process).Count"
    

    Note: This approach is recommended for on-demand checks only and is not suitable for continuous monitoring or alerting scenarios.

    Please refer below documentations also:

    https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/vmprocess

    Monitor Azure Virtual Machines

    Query map data from VM Insights

    Hope this helps! Please let me know if you have any queries.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.