Get-AzManagementGroup
Gets Management Group(s)
Syntax
ListOperation (Default)
Get-AzManagementGroup
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
GetOperation
Get-AzManagementGroup
[-GroupName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-Expand]
[-Recurse]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Get-AzManagementGroup cmdlet Gets all or a specific Management Group by its GroupName.
Examples
Example 1: Get all Management Groups
Get-AzManagementGroup
Id : /providers/Microsoft.Management/managementGroups/TestGroup
Type : /providers/Microsoft.Management/managementGroups
Name : TestGroup
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
DisplayName : TestGroupDisplayName
Id : /providers/Microsoft.Management/managementGroups/TestGroupChild
Type : /providers/Microsoft.Management/managementGroups
Name : TestGroupChild
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
DisplayName : TestGroupChildDisplayName
Get all Management Groups
Example 2: Get specific Management Group
Get-AzManagementGroup -GroupName TestGroup
Id : /providers/Microsoft.Management/managementGroups/TestGroup
Type : /providers/Microsoft.Management/managementGroups
Name : TestGroup
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
DisplayName : TestGroupDisplayName
UpdatedTime : 2/1/2018 11:16:12 AM
UpdatedBy : 64360beb-ffb4-43a8-9314-01aa34db95a9
ParentId : /providers/Microsoft.Management/managementGroups/TestGroupParent
ParentName : TestGroupParent
ParentDisplayName : TestGroupParent
Get specific Management Group
Example 3: Get specific Management Group and first level of hierarchy
$reponse = Get-AzManagementGroup -GroupName TestGroupParent -Expand
$response
Id : /providers/Microsoft.Management/managementGroups/TestGroupParent
Type : /providers/Microsoft.Management/managementGroups
Name : TestGroupParent
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
DisplayName : TestGroupParent
UpdatedTime : 2/1/2018 11:15:46 AM
UpdatedBy : 64360beb-ffb4-43a8-9314-01aa34db95a9
ParentId : /providers/Microsoft.Management/managementGroups/00001111-aaaa-2222-bbbb-3333cccc4444
ParentName : 00001111-aaaa-2222-bbbb-3333cccc4444
ParentDisplayName : 00001111-aaaa-2222-bbbb-3333cccc4444
Children : {TestGroup1DisplayName, TestGroup2DisplayName}
$response.Children[0]
Type : /managementGroup
Id : /providers/Microsoft.Management/managementGroups/TestGroup1
Name : TestGroup1
DisplayName : TestGroup1DisplayName
Children :
With the Expand
flag, one can navigate through the Children
array and get details for each child. For example, Children[0]
will give details for the group with display name TestGroup1DisplayName
.
Example 4: Get specific Management Group and all levels of hierarchy
$response = Get-AzManagementGroup -GroupName TestGroupParent -Expand -Recurse
$response
Id : /providers/Microsoft.Management/managementGroups/TestGroupParent
Type : /providers/Microsoft.Management/managementGroups
Name : TestGroupParent
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
DisplayName : TestGroupParent
UpdatedTime : 2/1/2018 11:15:46 AM
UpdatedBy : 64360beb-ffb4-43a8-9314-01aa34db95a9
ParentId : /providers/Microsoft.Management/managementGroups/00001111-aaaa-2222-bbbb-3333cccc4444
ParentName : 00001111-aaaa-2222-bbbb-3333cccc4444
ParentDisplayName : 00001111-aaaa-2222-bbbb-3333cccc4444
Children : {TestGroup1DisplayName, TestGroup2DisplayName}
$response.Children[0]
Type : /managementGroup
Id : /providers/Microsoft.Management/managementGroups/TestGroup1
Name : TestGroup1
DisplayName : TestGroup1DisplayName
Children : {TestRecurseChild}
$response.Children[0].Children[0]
Type : /managementGroup
Id : /providers/Microsoft.Management/managementGroups/TestRecurseChild
Name : TestRecurseChild
DisplayName : TestRecurseChild
Children :
Get specific Management Group and all levels of hierarchy
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | cf |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: | IAzureContextContainer |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Expand
Expand the output to list the children of the management group
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
GetOperation
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-GroupName
Management Group Id
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | GroupId |
Parameter sets
GetOperation
Position: | 0 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Recurse
Recursively list the children of the management group
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
GetOperation
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | wi |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.