Cannot find VM reservations within graph resource explorer

132 Views Asked by At

I am trying to report on what Virtual Machines are assigned to Virtual Machine reservations. In Azure, i can see the reservations in the reservations blade in azure: enter image description here

For each active reservation i can click in and view Virtual machines that are assigned.

I cannot find this information in graph explorer. It seems to do reservation groups but not Virtual Machine reservations.

Am I missing something, or overlooking it completely?

Appreciate any expertise.

1

There are 1 best solutions below

0
On

According to the Microsoft Q&A, you can try below query workaround to retrieve the count of reservations attached to the VM.

resources
| where type =~ 'microsoft.compute/virtualmachines'
| summarize  count() by tostring(properties.extended.instanceView.reservation.id)

Output:

enter image description here

Note: The above query might not work in all the scenarios, and your functionality is not exactly supported by resource graph queries.

Hence to make it work as expected in all cases, I would suggest you use an API or PowerShell command Get-AzReservation to retrieve the reservations that are attached to the specific VM.