You can use the following Azure Resource Graph Explorer query to display a list of all virtual machines along with their corresponding core counts:
Resources | where type == 'Microsoft.Compute/virtualMachines' | join kind=leftouter (resourcecontainers | where type =~ 'microsoft.resources/subscriptions' | project subscriptionId, subscriptionName) on subscriptionId | extend coresCount = toint(tostring(properties.hardwareProfile.vmSize)[4:]) | project vmName = name, coresCount, subscriptionName
This query starts by selecting all resources of the type 'Microsoft.Compute/virtualMachines'. It then performs a left-outer join with the resourcecontainers table on the subscriptionId field to get the subscriptionName for each virtual machine.
Finally, it uses the extend operator to add a new column called coresCount, which extracts the number of CPU cores from the virtual machine's vmSize property. The resulting table is then projected to include only the virtual machine name, coresCount, and subscriptionName columns.
When you run this query in the Azure Resource Graph Explorer, you will see a list of all virtual machines in your Azure subscriptions, along with their corresponding core counts and the name of the subscription they belong to.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-07 15:48:50 +0000
Seen: 9 times
Last updated: Jun 07 '23
What is the shortest time required to complete the processing of all the plants?
How can nested resources within a RESTful framework be organized in a relevant contextual module?
What is the process of including tags in Terraform?
What is the process for including an icon resource with a numerical name into a TImageCollection?
How can I locate a resource using its Id in Xamarin and subsequently search for it by its name?
How can Azure RBAC be assigned to a security group in Azure AD at the level of a resource group?
What is the most efficient service for storing and loading resources in C#?