Describe the bug
$ az account management-group create --name "test123" --parent "MyTestMG"
In version 2.27.0, creating a child management group. As of 2.27.1, the same command is failing with the error message:
(AuthorizationFailed) The client '<spn id>' with object id '<spn id>' does not have authorization to perform action 'Microsoft.Management/register/action' over scope '/subscriptions/<subscription id>' or the scope is invalid. If access was recently granted, please refresh your credentials.
To Reproduce
To recreate this issue, you'll need the following:
- A management group, for example named "MyTestMG".
- A subscription (does not need to be a member of the above management group).
- A SPN with the following roles assigned:
- Reader at the subscription scope.
- Management Group Contributor at the "MyTestMG" management group scope.
- An AzureCLI (version >=2.27.1) shell logged in as your SPN.
- An Azure PowerShell instance logged in as your SPN.
Running the following will fail with an error message.
$ az account management-group create --name "test123" --parent "MyTestMG"
(AuthorizationFailed) The client '<spn id>' with object id '<spn id>' does not have authorization to perform action 'Microsoft.Management/register/action' over scope '/subscriptions/<subscription id>' or the scope is invalid. If access was recently granted, please refresh your credentials.
In Azure PowerShell (I tested with version 6.4.0.34709), the equivalent command with the same SPN and assigned roles will complete successfully and create the child management group.
$parentGroup = Get-AzManagementGroup -GroupName MyTestMG
New-AzManagementGroup -GroupName 'test123' -ParentId $parentGroup.id
Expected behavior
With both AzureCLI and Azure PowerShell, I would expect them to behave the same way and create the child management group with the same roles/permissions assigned to the SPN.
Environment summary
AzureCLI >=2.27.1
Azure PowerShell 6.4.0.34709
Azure environment:
- A management group, for example named "MyTestMG".
- A subscription (does not need to be a member of the above management group).
- A SPN with the following roles assigned:
- Reader at the subscription scope.
- Management Group Contributor at the "MyTestMG" management group scope.
Describe the bug
In version 2.27.0, creating a child management group. As of 2.27.1, the same command is failing with the error message:
To Reproduce
To recreate this issue, you'll need the following:
Running the following will fail with an error message.
In Azure PowerShell (I tested with version 6.4.0.34709), the equivalent command with the same SPN and assigned roles will complete successfully and create the child management group.
Expected behavior
With both AzureCLI and Azure PowerShell, I would expect them to behave the same way and create the child management group with the same roles/permissions assigned to the SPN.
Environment summary
AzureCLI >=2.27.1
Azure PowerShell 6.4.0.34709
Azure environment: