The Wayback Machine - https://web.archive.org/web/20241128000701/https://www.geeksforgeeks.org/microsoft-azure-check-status-of-azure-vm-using-azure-powershell/
Open In App

Microsoft Azure – Check Status of Azure VM using Azure PowerShell

Last Updated : 30 Mar, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The following Azure PowerShell command helps you to find the Azure VM Config and properties details of Os Name, Os Version, Hyper V Generation, Disks properties, Extensions properties of Type Handler Version, Status and Message, VM Agents properties of Type Handler Version, Status and Message and also VM Power Status Codes, Messages, Plugins, Time Generated,…etc.

Azure PowerShell Command:

Get-AzVM -Name "vm_name" -ResourceGroup "resource_group_name"  -status

Example: 

Get-AzVM -Name "CloudOpsVM" -ResourceGroup "Cloud-Operations"  -status

It returns the properties of the complete in-depth status of an Azure VM. The properties consist of Resource Group Name, VM Computer Name, VM Host Name, OS Name, Os Version, Hyper V Generation, VM Disks Properties, VM Extensions Properties,…etc.

Note: To get the Azure VM properties VM should be in the running state,

Example 1: When the VM is in Running State the Status looks like the following (refer to sample output data and sample output image).

Sample Output Data:

ResourceGroupName       : Cloud-Operations
Name                    : CloudOpsVM
ComputerName            : CloudOpsVM
OsName                  : Windows Server 2019 Datacenter
OsVersion               : 10.0.17763.2183
HyperVGeneration        : V2
BootDiagnostics         :
Disks[0]                :
  Name                  : CloudOpsVM_OsDisk_1_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
  Statuses[0]           :
    Code                : ProvisioningState/succeeded
    Level               : Info
    DisplayStatus       : Provisioning succeeded
    Time                : 1/3/2022 6:21:20 PM
Extensions[0]           :
  Name                  : AzureNetworkWatcherExtension
  Type                  : Microsoft.Azure.NetworkWatcher.NetworkWatcherAgentWindows
  TypeHandlerVersion    : 1.4.2059.1
  Statuses[0]           :
    Code                : ProvisioningState/succeeded
    Level               : Info
    DisplayStatus       : Provisioning succeeded
    Message             : Default configuration is in effect.
Extensions[1]           :
  Name                  : DependencyAgentWindows
  Type                  : Microsoft.Azure.Monitoring.DependencyAgent.DependencyAgentWindows
  TypeHandlerVersion    : 9.10.12.18430
  Statuses[0]           :
    Code                : ProvisioningState/succeeded
    Level               : Info
    DisplayStatus       : Provisioning succeeded
    Message             : Plugin enabled (handler name: Microsoft.Azure.Monitoring.DependencyAgent.DependencyAgentWindows, extension name: , version: 9.10.12.18430).
Extensions[2]           :
  Name                  : MicrosoftMonitoringAgent
  Type                  : Microsoft.EnterpriseCloud.Monitoring.MicrosoftMonitoringAgent
  TypeHandlerVersion    : 1.0.18064.0
  Statuses[0]           :
    Code                : ProvisioningState/succeeded
    Level               : Info
    DisplayStatus       : Provisioning succeeded
    Message             : Latest configuration has been applied to the Microsoft Monitoring Agent.
VMAgent                 :
  VmAgentVersion        : 2.7.41491.1032
  ExtensionHandlers[0]  :
    Type                : Microsoft.Azure.AzureDefenderForServers.MDE.Windows
    TypeHandlerVersion  : 1.0.3.1
    Status              :
      Code              : ProvisioningState/succeeded
      Level             : Info
      DisplayStatus     : Ready
      Message           : Plugin enabled (handler name: Microsoft.Azure.AzureDefenderForServers.MDE.Windows, extension name: , version: 1.0.3.1).
  ExtensionHandlers[1]  :
    Type                : Microsoft.Azure.Monitoring.DependencyAgent.DependencyAgentWindows
    TypeHandlerVersion  : 9.10.12.18430
    Status              :
      Code              : ProvisioningState/succeeded
      Level             : Info
      DisplayStatus     : Ready
      Message           : Plugin enabled (handler name: Microsoft.Azure.Monitoring.DependencyAgent.DependencyAgentWindows, extension name: , version: 9.10.12.18430).
  ExtensionHandlers[2]  :
    Type                : Microsoft.Azure.NetworkWatcher.NetworkWatcherAgentWindows
    TypeHandlerVersion  : 1.4.2059.1
    Status              :
      Code              : ProvisioningState/succeeded
      Level             : Info
      DisplayStatus     : Ready
  ExtensionHandlers[3]  :
    Type                : Microsoft.Azure.RecoveryServices.VMSnapshot
    TypeHandlerVersion  : 1.0.71.0
    Status              :
      Code              : ProvisioningState/succeeded
      Level             : Info
      DisplayStatus     : Ready
  ExtensionHandlers[4]  :
    Type                : Microsoft.EnterpriseCloud.Monitoring.MicrosoftMonitoringAgent
    TypeHandlerVersion  : 1.0.18064.0
    Status              :
      Code              : ProvisioningState/succeeded
      Level             : Info
      DisplayStatus     : Ready
      Message           : This virtual machine has successfully connected to Azure Log Analytics.
  Statuses[0]           :
    Code                : ProvisioningState/succeeded
    Level               : Info
    DisplayStatus       : Ready
    Message             : GuestAgent is running and processing the extensions.
    Time                : 1/3/2022 6:24:34 PM
Statuses[0]             :
  Code                  : ProvisioningState/succeeded
  Level                 : Info
  DisplayStatus         : Provisioning succeeded
  Time                  : 1/3/2022 6:23:12 PM
Statuses[1]             :
  Code                  : PowerState/running
  Level                 : Info
  DisplayStatus         : VM running

Sample Output Image:

Example 2: When Azure VM is in Deallocated State the Status looks like the following (refer sample output).

Sample Output:


Previous Article
Next Article

Similar Reads

Microsoft Azure - Get Azure VM Properties using Azure PowerShell
The purpose of using the Azure PowerShell Commands is to quickly analyze the overall properties of VM/VMs at once the filtering the with select and where conditions. To find the properties of an Azure VM, you can perform the following commands in Azure Cloud Shell to get the details. Command: Get-AzVM Output: 1. Get all properties of an Azure Virtu
2 min read
Microsoft Azure - Manage Azure VMs using Azure PowerShell Commands
Here we are using Azure PS Commands to manage azure resources from Azure Cloud Shell or by using Windows PowerShell. By using the simple AZ PS command we can manage Azure VM Quicks without any efforts of navigating in Azure Portal and at Scale. Let's get started by using the major Azure PS commands to manage Azure Virtual Machine. 1. Start a Specif
2 min read
Microsoft Azure - Azure Managed Disk State Details using PowerShell
In this article, we will try to understand how we can fetch the VM Disk State by using the Azure PowerShell Commands. With the help of the Azure PowerShell Commands, we will be finding the Managed Disk State of Unattached, Attached, and Reserved of all the Azure VM Disks within Subscription. Implementation: Follow the below steps to get azure manag
1 min read
Microsoft Azure - Azure App Servers Routing using PowerShell
In this article, we will look into how to add logic to your testing and production sites with PowerShell. I Azure, you could split the traffic that goes between your staging slot on your production slot by defining routing rules inside the Azure portal. Now, what if you wanted to do this programmatically via maybe a PowerShell script. One of the th
2 min read
Microsoft Azure - Resizing Virtual Machine Using PowerShell Script
In this article, we will look into the process of resizing azure VMs at once using the Azure PowerShell automation script in the Azure portal by using the cloud shell. Advantages of using the method approach: Resizing Multiple VMs at once in a follow for select subscriptionSaves the time of the UserSimplifying the Actions by Automating the processR
2 min read
Microsoft Azure - Deletion of Snapshots using PowerShell Script
Snapshot is a kind of read-only copy of the existing Azure VM disk of either OS disk or data disk. This snapshot is used as a backup for VM in case of any failure to retrieve the backup of a VM in case of crashes. In this article, you will learn about the deletion of all the Snapshots within the Subscription from all the Resource Groups at once usi
2 min read
Microsoft Azure - Creating Custom Policy Initiative using PowerShell
In this article we'll see how we can create an Azure Custom Policy Initiative Definition with a JSON file using the Azure PowerShell commands in simple easy steps. What is Custom Policy Initiative Definition? Custom Policy Initiative is a collection or group of policy definitions that are grouped to apply policies together for a specific organizati
2 min read
Microsoft Azure - Delete Orphaned Disks using PowerShell Script
In this article, we will use an Azure PowerShell Module Script that finds all the unattached or orphaned azure managed disks in azure and delete them. PowerShell Script to Delete Orphaned Disks in Azure: The below Power Shell Script will find all the orphaned azure managed disks and will delete all the orphaned managed disks one after the other in
2 min read
Microsoft Azure - Built-in Policy Definitions and It's Count using PowerShell
In this article, we will see how we can get the azure built-in policy definitions with their display names and also the count of policy definitions within the select scope in Azure using the Azure PowerShell commands. The purpose of finding to know the policy definition and count which is being applied on the select scope. So, that users can add or
1 min read
Microsoft Azure - Testing in Production Sites Feature using PowerShell
In this article, we will learn how to add logic to your testing and production sites with PowerShell. Now, if you wanted to do this programmatically via a PowerShell script follow the below-given steps. Implementation: Follow the below steps to add logic to testing production sites with PowerShell: Step 1: Head over to the Azure CLI website and we
2 min read
Microsoft Azure - Using PowerShell Core on Linux
PowerShell Core on Linux is now integrated into Azure Cloud Shell. PowerShell used to be only available on Windows. Now, with PowerShell Core, it is cross-platform and runs on macOS and lots of Linux distributions like Ubuntu and Red Hat on ARM-Based platforms and even on Windows. This allows you to use PowerShell to interact with Azure regardless
3 min read
Microsoft Azure - Create Resource Group with Tags using PowerShell
Pre-requisite: Microsoft Azure: Resource Tagging and Best Practices In this article, I am going to show you how to create resource groups with tags using PowerShell in Microsoft Azure from Azure Cloud Shell in simple easy steps. Let's get started. Prerequisite: Contributor Access on Subscription to create a resource group in Azure Subscription. Ste
1 min read
Microsoft Azure - Update Resource Group Tags using PowerShell Script
Pre-requisite: Azure, Microsoft Azure: Resource Tagging and Best Practices Here In this article, we will show you how to update tags on existing resource groups using Azure PowerShell script. For this operation will be using Azure Cloud Shell to perform this action. Most importantly to update azure resource group tags one should have an Owner or Co
2 min read
How to Configure Azure Activity "Administrative" Logs on Azure Subscription using PowerShell?
Azure Activity "Administrative" logs are a type of activity log that record events that occur in your Azure subscription. By enabling and configuring the Azure Activity "Administrative" logs will collect and store logs in your specified log analytics workspace (this is your log destination). Administrative logs help you to view and analyze the logs
3 min read
Microsoft Azure - Resize Managed Disk via PowerShell
Pre-requisite: Azure In this article, we will show you how to resize managed disks in Azure using a PowerShell script. Here we will be using the Azure Cloud Shell to update or resize the managed disk of an azure VM in simple easy steps. To perform this activity one should have Owner or Contributor or User Access Administrator access on the target R
2 min read
How to Update Azure Subscription Tags using PowerShell?
Pre-requisite: Azure Updating Azure subscription tags using PowerShell is a straightforward process that allows you to easily manage and organize resources in your subscription. With PowerShell, you can add, modify, or remove tags from individual resources or apply tags to multiple resources simultaneously. This can help you to better track and man
2 min read
How to Create Virtual Network in Azure using PowerShell ?
Microsoft Azure provides various resources and services to provide us with a scalable environment for development and testing processes. Azure provides a virtual machine service, which allows us to leverage the resources virtually. We may have more than one virtual machine as a resource, according to our requirements. To manage and monitor our virt
9 min read
Microsoft Azure - Patch Management Update Summary Status
Here in this article, we will be implementing the Log Analytics Log Queries to find the count of resources by Update Management Run Name and also to get details of critical updates missing count and security updates missing count with resource name and update run name. Let's dive in to start implementation using KQL Log Queries. Implementation: Ste
2 min read
Microsoft Azure - VMs Patch Update Summary by Installation Status
Here we will be using the KQL Query to find the Status of Patch Updates by Installation Status. Use Azure Log Analytics Workspace or Azure Workbook to run the queries in this article. KQL Query 1: Use the below log analytics log query to get the details of resources where Installation Status is Succeeded. UpdateRunProgress | summarize arg_max(TimeG
2 min read
Microsoft Azure - RDP to Azure Virtual Machines using Azure Bastion
In this article, we will learn how to do RDP(Remote Desktop Protocol) / SSH(Secure Shell) Connection to an Azure VM using Azure Bastion. First, let's discuss Azure Bastion. The Azure Bastion service is a fully platform-managed PaaS service that you provision inside your virtual network. It provides secure and seamless RDP/SSH connectivity to your v
3 min read
Microsoft Azure - Azure VM Disk Space in Percentage using Azure KQL
Here we'll be using the Azure Insights Metric Query to find the free disk space in percentage using KQL. The purpose of this query is to find disk drive free space of all the Azure VMs without logging into every server. You can Run the following KQL log Queries in Azure Monitor or Azure VM Logs or Log Analytics Workspace. Note: VM Insights Agent sh
1 min read
How to Create Management Groups in Azure Through GUI and PowerShell?
Pre-requisites: AZURE Azure's management groups are a hierarchical organizational structure that makes it possible to centralize the management of numerous Azure subscriptions. With management groups, you can apply policies and enforce compliance across your subscriptions and resources, making it easier to manage your resources and ensure that they
3 min read
How To Install and Update Azure PowerShell on Windows Machine?
Pre-requisite: Azure Azure PowerShell is a command-line tool that allows you to manage Azure resources from the command line. It is a powerful tool that can be used to automate tasks, provision resources, manage users and policies in Azure a,d also for troubleshooting problems. Actually, Azure PowerShell is built on top of Windows PowerShell, so if
3 min read
How to Install and Connect to Azure AD with PowerShell?
Azure Active Directory (Azure AD) is a service for managing identities and access in the cloud. This solution facilitates access to thousands of additional SaaS applications, the Azure portal, and external resources like Microsoft 365 for your staff members. What is Azure Active Directory (AD)?Azure Active Directory is simply known or called Azure
4 min read
Microsoft Azure- Backing Up, Restoring, and Cloning Microsoft Azure App Services
Microsoft is well known for developing relevant software which are using in today's time of technology to conquer the demand of users and developers to build up applications. In sequence of it Microsoft introduces Azure well known as Microsoft Azure to make quality applications. In this article, we will discuss Backing up, restoring and cloning Mic
8 min read
Microsoft Azure -Create a User in Microsoft Entra ID from Azure Portal
A user in Microsoft Entra ID is an individual who can get access to Azure identity. This Microsoft Entra ID identity can be used to access applications and resources that are protected within the organization or project. Users can be created manually or automatically, and they can be assigned to groups and roles to control their access permissions.
3 min read
Microsoft Azure- Disk Storage in Microsoft Azure
Azure Disk Storage is the only shared cloud block storage that supports both Windows and Linux-based clustered or high-availability applications via Azure shared disks. There are two types of Disks in Azure : Managed Disks Unmanaged Disks.Managed DisksSimplest optionLower management overhead as Azure manages the storage accounts.Only LRS replicatio
6 min read
Microsoft Azure - Configure Azure SQL with Azure CLI
In this article, we're going to take a closer look at how you can configure something like connectivity using the Azure CLI. What we have here is we are in Azure Data Studio and similar to the SQL notebook we are actually using a PowerShell notebook. That just means all our code cells are going to run PowerShell and we are just connecting to localh
4 min read
Microsoft Azure - Archive Azure VM to Azure Storage Account
In this article, we will be implementing a solution to archive a select azure VM snapshot to a select storage account for archiving using azure cloud shell. For implementation, we will be using Azure CLI commands. Prerequisite:VM SnapshotA storage account is neededUser needs "Storage Blob Contributor Data" IAM Role Access on Archiving Storage Accou
2 min read
Microsoft Azure - Enable Azure Monitor VM Insights Agent For Azure VM
Azure Monitor VM Insights Agent enables you to get more visibility into the health and performance of your Azure VM. Here we'll see how we can enable Azure Monitor VM Insights to monitor the health, performance, and dependencies of azure virtual machines. Implementation: Follow the below steps to enable Azure Monitor VM insights agents for an Azure
2 min read
three90RightbarBannerImg