Skip to content

Commit 216a51b

Browse files
authored
Merge pull request #8878 from MicrosoftDocs/genlin-patch-6
AB#3949 Update troubleshoot-user-creation-deletion-issues.md
2 parents d4030d5 + 6fc7500 commit 216a51b

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

support/entra/entra-id/dir-dmns-obj/troubleshoot-user-creation-deletion-issues.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Troubleshoot user creation and deletion issues in Microsoft Entra I
44
ms.date: 12/15/2021
55
ms.reviewer: tovascon, anhorta, v-leedennis
66
ms.service: entra-id
7-
ms.custom: sap:Users, devx-track-azurecli, has-azure-ad-ps-ref
7+
ms.custom: sap:Users, devx-track-azurecli, no-azure-ad-ps-ref
88
keywords:
99
#Customer intent: As a Microsoft Entra Global Administrator or User Administrator, I want create and delete users so that I can manage the current user list and let users access Azure services.
1010
---
@@ -58,7 +58,7 @@ For more information, see [Add or delete users - Microsoft Entra ID](/azure/acti
5858

5959
## [Microsoft Graph](#tab/microsoft-graph)
6060

61-
To add a user in Microsoft Graph, use the [Create user API](/graph/api/user-post-users):
61+
To add a user in Microsoft Graph, use the [Create User API](/graph/api/user-post-users):
6262

6363
```http
6464
POST https://graph.microsoft.com/v1.0/users
@@ -74,20 +74,16 @@ Content-type: application/json {
7474
}
7575
```
7676

77-
## [Azure PowerShell](#tab/azure-powershell)
77+
## [Microsoft Graph PowerShell](#tab/microsoft-graph-powerShell)
7878

79-
To add a user in Azure PowerShell, run the [New-AzureADUser](/powershell/module/azuread/new-azureaduser) cmdlet:
79+
To add a user in Microsoft Graph PowerShell, run the [New-MgUser](/powershell/module/microsoft.graph.users/new-mguser?view=graph-powershell-1.0&preserve-view=true) cmdlet. To run this command, you must connect to Microsoft Graph with at least the `User.ReadWrite.All` permission.
8080

81-
[!INCLUDE [Azure AD PowerShell deprecation note](~/../support/reusable-content/msgraph-powershell/includes/aad-powershell-deprecation-note.md)]
82-
83-
```powershell-interactive
84-
$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
85-
$PasswordProfile.Password = "<Password>"
86-
New-AzureADUser -AccountEnabled $true `
87-
-DisplayName "<New User>" `
88-
-MailNickName "<Newuser>" `
89-
-PasswordProfile $PasswordProfile `
90-
-UserPrincipalName "<[email protected]>"
81+
```powershell
82+
$PasswordProfile = @{
83+
Password = 'xWwvJ]6NMw+bWH-d'
84+
}
85+
Connect-MgGraph -Scopes "User.ReadWrite.All"
86+
New-MgUser -DisplayName 'Rene Magi' -PasswordProfile $PasswordProfile -AccountEnabled -MailNickName 'ReneMagi' -UserPrincipalName '[email protected]'
9187
```
9288

9389
## [Azure CLI](#tab/azure-cli)
@@ -141,19 +137,20 @@ For example, if you want to delete a user who has a principal name of `NewUser@c
141137
DELETE https://graph.microsoft.com/v1.0/users/[email protected]
142138
```
143139

144-
## [Azure PowerShell](#tab/azure-powershell)
140+
## [Microsoft Graph PowerShell](#tab/microsoft-graph-powerShell)
145141

146-
To delete a user in Azure PowerShell, run the [Remove-AzureADUser](/powershell/module/azuread/remove-azureaduser) cmdlet:
142+
To delete a user in Azure PowerShell, run the [Remove-MgUser](/powershell/module/microsoft.graph.users/remove-mguser?view=graph-powershell-1.0&preserve-view=true) cmdlet. To run this command, you must connect to Microsoft Graph with at least the `User.DeleteRestore.All` permission.
147143

148-
```powershell-interactive
149-
Remove-AzureADUser -ObjectId "<[email protected]>"
144+
```powershell
145+
Remove-MgUser -UserId '5c442efb-5e66-484a-936a-91b6810bed14'
150146
```
151147

152148
## [Azure CLI](#tab/azure-cli)
153149

154150
To delete a user in Azure CLI, run the [az ad user delete](/cli/azure/ad/user#az-ad-user-delete) command:
155151

156152
```azurecli-interactive
153+
Connect-MgGraph -Scopes "User.DeleteRestore.All"
157154
az ad user delete --id "<[email protected]>"
158155
```
159156

0 commit comments

Comments
 (0)