Skip to content

Commit 7c901dc

Browse files
authored
Merge pull request #225083 from rolyon/rolyon-aadroles-admin-units-manage-graph-powershell
[Azure AD roles] [Admin units] Microsoft Graph PowerShell
2 parents f9341fa + 537111d commit 7c901dc

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

articles/active-directory/roles/admin-units-manage.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.service: active-directory
99
ms.topic: how-to
1010
ms.subservice: roles
1111
ms.workload: identity
12-
ms.date: 03/22/2022
12+
ms.date: 01/25/2023
1313
ms.author: rolyon
1414
ms.reviewer: anandy
1515
ms.custom: oldportal;it-pro;
@@ -66,6 +66,20 @@ Use the [New-AzureADMSAdministrativeUnit](/powershell/module/azuread/new-azuread
6666
New-AzureADMSAdministrativeUnit -Description "West Coast region" -DisplayName "West Coast"
6767
```
6868

69+
### Microsoft Graph PowerShell
70+
71+
Use the [New-MgDirectoryAdministrativeUnit](/powershell/module/microsoft.graph.identity.directorymanagement/new-mgdirectoryadministrativeunit) command to create a new administrative unit.
72+
73+
```powershell
74+
Import-Module Microsoft.Graph.Identity.DirectoryManagement
75+
$params = @{
76+
DisplayName = "Seattle District Technical Schools"
77+
Description = "Seattle district technical schools administration"
78+
Visibility = "HiddenMembership"
79+
}
80+
New-MgDirectoryAdministrativeUnit -BodyParameter $params
81+
```
82+
6983
### Microsoft Graph API
7084

7185
Use the [Create administrativeUnit](/graph/api/administrativeunit-post-administrativeunits) API to create a new administrative unit.
@@ -109,27 +123,14 @@ In Azure AD, you can delete an administrative unit that you no longer need as a
109123

110124
1. To confirm that you want to delete the administrative unit, select **Yes**.
111125

112-
### PowerShell - AzureAD Module
126+
### PowerShell
113127

114128
Use the [Remove-AzureADMSAdministrativeUnit](/powershell/module/azuread/remove-azureadmsadministrativeunit) command to delete an administrative unit.
115129

116130
```powershell
117131
$adminUnitObj = Get-AzureADMSAdministrativeUnit -Filter "displayname eq 'DeleteMe Admin Unit'"
118132
Remove-AzureADMSAdministrativeUnit -Id $adminUnitObj.Id
119133
```
120-
### PowerShell - Microsoft Graph PowerShell SDK
121-
122-
```
123-
Import-Module Microsoft.Graph.Identity.DirectoryManagement
124-
125-
$params = @{
126-
DisplayName = "Seattle District Technical Schools"
127-
Description = "Seattle district technical schools administration"
128-
Visibility = "HiddenMembership"
129-
}
130-
131-
New-MgDirectoryAdministrativeUnit -BodyParameter $params
132-
```
133134

134135
### Microsoft Graph API
135136

0 commit comments

Comments
 (0)