I am trying to find the resource group allocated to a VM in azure using nodejs.
I am using the below link as my reference https://learn.microsoft.com/en-us/samples/azure-samples/resource-manager-node-resources-and-groups/resource-manager-node-resources-and-groups/#list-groups
The below gets resource group details If I provide resourceGroupName and subscription_Id
https://learn.microsoft.com/en-us/rest/api/resources/resource-groups/get
But I only have VM name and subsciption_Id
Any help appreciated. Thanks in advance
Take a look here: https://learn.microsoft.com/en-us/samples/azure-samples/compute-node-manage-vm/compute-node-manage-vm/
This shows an example where you can list all VMs in a subsription.
The will result in the VM ID which will have the RG name in it (TESTRG9397 in this example).
You will have to parse the ID to get it but then you will have RG and SUB so you can call