Azure Resource Graph Explorer :: list all VMs with number of cores
音乐剧《歌剧魅影》中的著名桥段'All I Ask of You',是一首深情又浪漫的歌曲。 #生活乐趣# #日常生活趣事# #音乐欣赏的乐趣# #音乐趣闻#
I tried to reproduce the same in my environment.
Tried with the following query:
vmCore=tostring(properties.hardwareProfile.vmSizeProperties.NumberOfCores)
But not able to get number of cores .
As i do not have them enabled in my portal to display in Json of my Virtual machine template too.
As i also Tried with properties.hardwareProfile.vmSizeProperties
Graph query:
Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project name, properties.vmId, properties.storageProfile.osDisk.osType,properties.hardwareProfile.vmSize,properties.hardwareProfile.vmSizeProperties | order by ['name'] asc
Everything like hardware profile is resulting in output except vm size properties are empty which includes number of cores property for vmsize properties where it has to have number of cores.
Try Initially check the properties and then call the number of cores for each VM. Below command gives VM size particularly.
Command:
$Myvm= Get-AzureRmVM -ResourceGroupName myrg -Name myacctvm
Command:
$MyVmZizeProperties = Get-AzureRmVMSize -ResourceGroupName myrg -VMName myacctVM
$NumberOfCores = $MyVmZizeProperties.NumberOfCores
$MyVmZizeProperties = Get-AzureRmVMSize -ResourceGroupName myrg -VMName myacctVM | Export-Csv -Path C:\vmproperties.csv -NoTypeInformation
Reference: https://learn.microsoft.com/en-us/azure/virtual-machines/resource-graph-samples?tabs=azure-cli
网址:Azure Resource Graph Explorer :: list all VMs with number of cores https://klqsh.com/news/view/147861
相关内容
Azure Resource Graph ExplorerHow Azure Resource Graph uses alerts to monitor resources
How to use the Azure Resource Graph Explorer to inventory resources in MS Azure – Victor Villar's Blog
Quickstart: Run Resource Graph query using Azure CLI
Microsoft Azure Get Storage Account Information using Resource Graph
Azure Graph Query for Expiring certificates or secrets in App Registration
Starter query samples
Get Help with File Explorer in Windows 11
How to Get Help with File Explorer in Windows 11/10
Full List of Colleges with the largest endowment in 2024