Get Azure VM AD Domain

528 views Asked by At

Is there a way to query the AD domain of a VM on azure using the REST API? The only way I found was to use a run command and use powershell on the VM to get the domain name, this however has a significant delay and I would like to find a faster method.

Run Command documentation: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command

1

There are 1 answers

0
Casper Dijkstra On

You can check the role assignments of the VM using

GET https://management.azure.com/subscriptions/subId/resourcegroups/rgname/providers/resourceProviderNamespace/parentResourcePath/resourceType/resourceName/providers/Microsoft.Authorization/roleAssignments?api-version=2015-07-01

See: https://learn.microsoft.com/en-us/rest/api/authorization/roleassignments/listforresource#roleassignment