The Wayback Machine - https://web.archive.org/web/20241127234209/https://www.geeksforgeeks.org/microsoft-azure-get-azure-vm-properties-using-azure-powershell/
Open In App

Microsoft Azure – Get Azure VM Properties using Azure PowerShell

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

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 Virtual Machine Server

Use the below command to get all properties of an Azure VM server:

Command:

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

Example:

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

Output:

2. Expand the  properties of Azure VM Extensions

Use the below command to expand the complete properties of an Azure VM Extension:

Command:

Get-AzVM -Name "vm_name" -ResourceGroup "resource_group_name" `
| Select -ExpandProperty Extensions

Example:

Get-AzVM -Name "CloudOpsVM" -ResourceGroup "Cloud-Operations" `
| Select -ExpandProperty Extensions

Output:

3. Get the Names of Azure VM Extensions

To get the names of Azure VM extensions, use the below command:

Command:

Get-AzVM -Name "vm_name" -ResourceGroup "resource_group_name" `
| Select -ExpandProperty Extensions `
| Select Name

Example:

Get-AzVM -Name "CloudOpsVM" -ResourceGroup "Cloud-Operations" `
| Select -ExpandProperty Extensions `
| Select Name

Output:

4. Size of an Azure VM 

Use the below command to get the size of an Azure VM:

Command:

Get-AzVM -Name "vm_name" -ResourceGroup "resource_group_name" `
| Select -ExpandProperty HardwareProfile

Example:

Get-AzVM -Name "CloudOpsVM" -ResourceGroup "Cloud-Operations" `
| Select -ExpandProperty HardwareProfile

Output:


Previous Article
Next Article

Similar Reads

Microsoft Azure - Check Status of Azure VM using Azure PowerShell
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
3 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
Microsoft Azure - Graph Query to Get Properties of Azure VM Resource
The following are the Azure Resource Graph Queries where we will be used to fetch the static JSON data using azure KQL Queries. You can run the below queries in Azure Resource Graph Explorer in Azure Portal to fetch the results based on Query. Example 1: To get the complete properties of Azure VMs - resources | where type == "microsoft.compute/virt
1 min read
Microsoft Azure - Get CPU Utilization Data of a Azure VM in Azure Portal
Azure Virtual Machines (VM) is one of several types of on-demand, scalable computing resources that Azure offers. In this article, we will look into the process of getting the CPU Utilization data of an Azure VM in Azure Portal. Implementation:Follow the steps to get the CPU Utilization of an Azure VM in Azure Portal: Step 1: Log in to your Azure P
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 - 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 - Get Azure Subscription Details Using Resource Graph Query
In this article, you will learn about how you can get the azure subscriptions' complete JSON information by running the following KQL Queries in Azure Resource Graph Explorer in Azure Portal. Let's get started by checking out the different queries with examples. Syntax: ResourceContainers | where type =~ 'microsoft.resources/subscriptions'the follo
1 min read
Microsoft Azure - KQL Query to Get the VM Computer Properties
In this article, we will be using the KQL queries to fetch the data ingested logs from Azure Monitor or Azure Log Analytics Workspace to get the complete details or properties of the Azure Server across subscriptions at once using the simple KQL queries. Let's get started.VMComputer is a KQL Operator to collect Inventory data for servers by the Ser
2 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
three90RightbarBannerImg