You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The management group structure we will use can be retrieved through Azure CLI using the following command.
# Replace this value with your environment. This id is the same as Azure Active Directory ID.
TENANT_GROUP_ID='343ddfdb-bef5-46d9-99cf-ed67d5948783'
az account management-group show --name $TENANT_GROUP_ID -e -r | jq 'recurse(.children[]?) |= del(select(.type == "/subscriptions")) | del(..|nulls) | recurse(.children[]?) |= {"id":.name, "name":.displayName, "children": (.children // [] )}'
Approach
Use Azure CLI to retrieve the management group structure recursively from Tenant Root Group. This structure will include subscriptions as well.
Use jq to
Remove all objects that are of type: /subscription
Removing the subscription objects leaves null in place in arrays so we then delete the nulls
Recurse through the final json and select name, id and children (if children is null, then mark it as empty array [])
Additional documentation covering migration scenarios from original to new hierarchical management group configuration:
The text was updated successfully, but these errors were encountered: