How to retrieve managament groups in hierarchy (managment groups /subscription / resources in each group) using java

Mohamed Jbeli 0 Reputation points
2023-02-14T12:31:27.16+00:00

I'm building an application and I need to retrieve all management groups in a hierarchical style like the subscription IDs and that resource informations .

I looked up in the SDK for java :(https://github.com/Azure/azure-sdk-for-java)

but can't find anything related with my topic

Azure Resource Mover
Azure Resource Mover
An Azure service used for moving multiple resources between Azure regions.
287 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 49,331 Reputation points Microsoft Employee Moderator
    2023-03-13T17:12:12.41+00:00

    @Mohamed Jbeli You can use the Get-AzManagementGroup command in Azure PowerShell to retrieve all management groups. To retrieve information for a single management group, you can use the -GroupId parameter. To return a specific management group and all the levels of the hierarchy under it, you can use the -Expand and -Recurse parameters.

    You can also use the list command in Azure CLI to retrieve all management groups. To retrieve information for a single management group, you can use the show command. To return a specific management group and all the levels of the hierarchy under it, you can use the -e and -r parameters.

    You can also use the REST API to retrieve information about management groups. The target scope for management groups in the REST API is "/providers/Microsoft.Management/managementGroups/{yourMgID}".

    For more information, you can refer to the following links: https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/governance/management-groups/manage.md

    https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/organize-subscriptions


    If the response helped, do "Accept Answer" and up-vote it

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.