Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitIt’s easy for Administrative Units (AUs) to lose their purpose —names change, departments merge, and descriptions get stale. When that happens, scoped admin boundaries become confusing and audits get harder. Instead of recreating AUs, you can update them in place with Update-MgDirectoryAdministrativeUnit, keeping least-privilege clean and current.
Update-MgDirectoryAdministrativeUnit -AdministrativeUnitId <String> [-DisplayName <String>] [-Description <String>] [-Visibility <String>] [-AdditionalProperties <Hashtable>] [-IfMatch <String>][-WhatIf] [-Confirm]
# Body parameter form (advanced)
Update-MgDirectoryAdministrativeUnit -AdministrativeUnitId <String> -BodyParameter 7lt;IMicrosoftGraphAdministrativeUnit>
Heads-up: You’ll typically identify the AU with the Id (GUID). If you only know the name, look it up first with Get-MgDirectoryAdministrativeUnit -Filter "displayName eq 'Sales AU'".
$auId = "00000000-0000-0000-0000-000000000000"
Update-MgDirectoryAdministrativeUnit -AdministrativeUnitId $auId `
-DisplayName "Sales & Marketing AU" `
-Description "Scoped admin boundary for Sales + Marketing"
Update-MgDirectoryAdministrativeUnit -AdministrativeUnitId $auId `
-Description "Regional Sales AU for APAC"
$params = @{
description = "Marketing AU"
displayName = "Marketing"
membershipRule = "(user.department -eq `"Marketing`")"
membershipRuleProcessingState = "On"
}
Update-MgDirectoryAdministrativeUnit -AdministrativeUnitId $auId -BodyParameter $params
This example updates the AU so that it behaves like a dynamic group. Membership is automatically managed based on the rule (user.department -eq "Marketing").
Get-MgDirectoryAdministrativeUnit -Filter "displayName eq 'Sales AU'" | Select-Object Id,DisplayName
Get-MgDirectoryAdministrativeUnit -AdministrativeUnitId $auId | Format-List *
Error | Cause | Solution |
---|---|---|
Authorization_RequestDenied or insufficient privileges | Missing AdministrativeUnit.ReadWrite.All | Reconnect with the correct scope or grant app permission with admin consent. |
Request_ResourceNotFound | Wrong AU Id or the AU was deleted | Re-query with Get-MgDirectoryAdministrativeUnit to confirm Id, then retry. |
PreconditionFailed (412) when using -IfMatch | ETag mismatch due to a recent change | Retrieve the AU again to get the latest ETag and re-run the update. |
Properties don’t change | Passing incorrect parameter names or only read-only fields | Verify parameter names (-DisplayName, -Description, -AdditionalProperties) and try again. |
Throttling / intermittent errors | Burst updates in large tenants | Add retry/backoff or batch updates over time. |
Update-MgDirectoryAdministrativeUnit lets you fix and refine AUs without starting over. Grab the AU Id, connect with the right permissions, change only what you need, and lean on -WhatIf (plus optional -IfMatch) for safe, collaborative edits. Keeping AU metadata tidy pays off in cleaner RBAC scopes, happier auditors, and fewer surprises for admins down the line.
© m365corner.com. All Rights Reserved. Design by HTML Codex