Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitAdministrative Units (AUs) let you scope admin permissions to a subset of your tenant (e.g., a department or region). With Microsoft Graph PowerShell, you can create them quickly—individually or in bulk from a CSV.
# Core cmdlet (expanded)
New-MgDirectoryAdministrativeUnit [-DisplayName <String>] [-Description <String>] [-AdditionalProperties <Hashtable>] [-WhatIf] [-Confirm]
# Core cmdlet (BodyParameter pattern)
New-MgDirectoryAdministrativeUnit -BodyParameter <IMicrosoftGraphAdministrativeUnit>
The cmdlet accepts direct parameters (e.g., -DisplayName, -Description) or a hashtable via -BodyParameter. It lives in the Microsoft.Graph.Identity.DirectoryManagement module.
What is an Administrative Unit? An AU is a container for users, groups, and devices that lets you delegate RBAC at a smaller scope than the whole tenant. Some AU features (like dynamic membership) have license requirements.
Connect-MgGraph -Scopes "AdministrativeUnit.ReadWrite.All"
New-MgDirectoryAdministrativeUnit `
-DisplayName "Sales Team AU" `
-Description "AU for Sales Department"
This creates a standard (non-dynamic) AU with the given display name and description.
CSV file (sample content)
Save as administrative-units.csv:
DisplayName,Description
Sales Team AU,AU for Sales Department
HR Team AU,AU for Human Resources
Marketing AU,AU for Marketing Department
Bulk creation script (based on Example 1)
Connect-MgGraph -Scopes "AdministrativeUnit.ReadWrite.All"
$path = "C:\temp\administrative-units.csv"
if (-not (Test-Path $path)) { throw "CSV not found at $path" }
$rows = Import-Csv -Path $path
foreach ($row in $rows) {
$name = $row.DisplayName.Trim()
$desc = $row.Description
if ([string]::IsNullOrWhiteSpace($name)) {
Write-Warning "Skipped a row with empty DisplayName."
continue
}
try {
# Optional: check if an AU with same DisplayName already exists
$existing = Get-MgDirectoryAdministrativeUnit -All `
| Where-Object { $_.DisplayName -eq $name }
if ($existing) {
Write-Host "Already exists: $name — skipping."
continue
}
New-MgDirectoryAdministrativeUnit `
-DisplayName $name `
-Description $desc
Write-Host "Created AU: $name"
}
catch {
Write-Warning "Failed to create AU '$name'. Error: $($_.Exception.Message)"
}
}
Notes:
Error | Cause | Solution |
---|---|---|
Authorization_RequestDenied or insufficient privileges | Missing or insufficient Graph scopes/permissions | Re-connect with Connect-MgGraph -Scopes "AdministrativeUnit.ReadWrite.All" (user delegated) or grant app permissions and consent. |
BadRequest when using -MembershipRule | Invalid rule syntax or unsupported property | Validate the rule format and properties allowed for AU dynamic membership; check Entra AU docs and adjust. |
Module/cmdlet not found | Graph module not installed/loaded | Install/Update and import the Microsoft Graph PowerShell modules, then retry. |
Members can’t be managed via app permissions in a restricted AU | Restricted management AU blocks app modification | Assign a Microsoft Entra role to the application at the AU scope to allow programmatic changes. |
Throttling or intermittent failures at scale | Service throttling | Add retry logic with backoff in your bulk script; batch runs or pause between creates (not shown above). (General Graph practice.) |
New-MgDirectoryAdministrativeUnit is the fastest way to stand up least-privilege boundaries in Microsoft Entra ID. Start with a single AU (your Sales example), then scale using the CSV-based bulk script. As your needs mature, layer in dynamic membership (with the right licenses), add members, and assign roles scoped to each AU for clean, auditable RBAC.
© m365corner.com. All Rights Reserved. Design by HTML Codex