I've been trying to move subscriptions under one management group to other management groups using Azure REST API and, according to documentation it seems possible using PATCH on this endpoint:
https://management.azure.com/providers/Microsoft.Management/managementGroups/{groupId}?api-version=2020-05-01
with a corresponding JSON body:
{
"properties":{
"tenantId": "${tenantId}",
"displayName": "${displayName}",
"name": "/providers/Microsoft.Management/managementGroups/${displayName}",
"children": [
{
"type": "/subscriptions",
"displayName": "${displayName}",
"id": "/subscriptions/${subscriptionId}",
"name": "${subscriptionId}"
}
]
}
}
service principal has these custom 'action' permissions:
"Microsoft.Management/managementGroups/write",
"Microsoft.Management/managementGroups/subscriptions/write",
"Microsoft.Authorization/roleAssignments/write",
"Microsoft.Authorization/roleAssignments/delete",
"Microsoft.Management/register/action",
"Microsoft.Management/managementGroups/read",
"Microsoft.Management/managementGroups/subscriptions/read"
Posting the above JSON body, with supplied bearer token to the above endpoint returns responses '200 OK.' Yet, no actions are taken in the portal, and the subscription remains in the original management group.
Is there anything that I'm doing incorrectly here / should check?