New-AzManagementGroup

Creates a Management Group

Syntax

New-AzManagementGroup
   [-GroupName] <String>
   [-DisplayName <String>]
   [-ParentId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzManagementGroup
   [-GroupName] <String>
   [-DisplayName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   -ParentObject <PSManagementGroup>
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzManagementGroup cmdlet creates a management group with name GroupName. The DisplayName and ParentId can also be set when creating a new Management Group.

Examples

Example 1: Create a Management Group

New-AzManagementGroup -GroupName "TestGroup"

Id                : /providers/Microsoft.Management/managementGroups/TestGroup
Type              : /providers/Microsoft.Management/managementGroups
Name              : TestGroup
TenantId          : aaaabbbb-0000-cccc-1111-dddd2222eeee
DisplayName       : TestGroup
UpdatedTime       : 2/1/2018 11:06:27 AM
UpdatedBy         : 00001111-aaaa-2222-bbbb-3333cccc4444
ParentId          : /providers/Microsoft.Management/managementGroups/00001111-aaaa-2222-bbbb-3333cccc4444
ParentName        : 00001111-aaaa-2222-bbbb-3333cccc4444
ParentDisplayName : 00001111-aaaa-2222-bbbb-3333cccc4444

Creation of a new group with DisplayName and ParentId set to null. The DisplayName will be same as the GroupName and the parent of the group will be the tenant.

Example 2: Create a Management Group with a display name

New-AzManagementGroup -GroupName "TestGroup" -DisplayName "TestGroupDisplayName"

Id                : /providers/Microsoft.Management/managementGroups/TestGroup
Type              : /providers/Microsoft.Management/managementGroups
Name              : TestGroup
TenantId          : aaaabbbb-0000-cccc-1111-dddd2222eeee
DisplayName       : TestGroup
UpdatedTime       : 2/1/2018 11:06:27 AM
UpdatedBy         : 00001111-aaaa-2222-bbbb-3333cccc4444
ParentId          : /providers/Microsoft.Management/managementGroups/00001111-aaaa-2222-bbbb-3333cccc4444
ParentName        : 00001111-aaaa-2222-bbbb-3333cccc4444
ParentDisplayName : 00001111-aaaa-2222-bbbb-3333cccc4444

In this case, the parent of the group will be the tenant and the DisplayName will be set to the value given.

Example 3: Create a Management Group with a parent and a display name

New-AzManagementGroup -GroupName "TestGroup" -DisplayName "TestGroupDisplayName" -ParentId "/providers/Microsoft.Management/managementGroups/TestGroupParent"

Id                : /providers/Microsoft.Management/managementGroups/TestGroup
Type              : /providers/Microsoft.Management/managementGroups
Name              : TestGroup
TenantId          : aaaabbbb-0000-cccc-1111-dddd2222eeee
DisplayName       : TestGroupDisplayName
UpdatedTime       : 2/1/2018 11:16:12 AM
UpdatedBy         : 00001111-aaaa-2222-bbbb-3333cccc4444
ParentId          : /providers/Microsoft.Management/managementGroups/TestGroupParent
ParentName        : TestGroupParent
ParentDisplayName : TestGroupParent

Example 4: Create a Management Group with a parent (using a parent object)

$parentObject = Get-AzManagementGroup -GroupName "TestGroupParent"
New-AzManagementGroup -GroupName "TestGroup" -ParentObject $parentObject

Id                : /providers/Microsoft.Management/managementGroups/TestGroup
Type              : /providers/Microsoft.Management/managementGroups
Name              : TestGroup
TenantId          : aaaabbbb-0000-cccc-1111-dddd2222eeee
DisplayName       : TestGroupDisplayName
UpdatedTime       : 2/1/2018 11:16:12 AM
UpdatedBy         : 00001111-aaaa-2222-bbbb-3333cccc4444
ParentId          : /providers/Microsoft.Management/managementGroups/TestGroupParent
ParentName        : TestGroupParent
ParentDisplayName : TestGroupParent

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisplayName

Display Name of the management group

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-GroupName

Management Group Id

Type:String
Aliases:GroupId
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ParentId

Parent Id of the management group

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ParentObject

Parent Object

Type:PSManagementGroup
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

PSManagementGroup