0

I am trying to create a new management group in Azure through New-AzManagementGroup command but getting errors always. I have tried many different ways but none is working.

PS /home/divyansh> $parent = Get-AzManagementGroup -GroupId "MI-Test"

$parent

Id                : /providers/Microsoft.Management/managementGroups/MI-Test
Type              : /providers/Microsoft.Management/managementGroups
Name              : MI-Test
TenantId          : xxxxxxxxxxxxxxxxxxxxx
DisplayName       : MI-Test
UpdatedTime       : 6/15/2021 12:34:00 PM
UpdatedBy         : xxxxxxxxxxxxxxxxxxxxx
ParentId          : /providers/Microsoft.Management/managementGroups/601SubGroup
ParentName        : 601SubGroup
ParentDisplayName : Cloud Customers


PS /home/divyansh> New-AzManagementGroup -GroupId "MI-Test-testing00" -ParentId $parent.Id
New-AzManagementGroup: Unable to cast object of type 'Microsoft.Azure.Management.ManagementGroups.Models.ManagementGroup' to type 'Newtonsoft.Json.Linq.JObject'.

I also tried the below command but still getting the same errors.

 New-AzManagementGroup -GroupId "MI-Test-testing00" -ParentObject $parent

New-AzManagementGroup: Unable to cast object of type 'Microsoft.Azure.Management.ManagementGroups.Models.ManagementGroup' to type 'Newtonsoft.Json.Linq.JObject'.

Looking for help.

Thanks, Div

1 Answers1

0

Looks like we cannot have a numeric value in the GroupID. The error message was not very clear.