Skip to content

Commit c10cdcf

Browse files
Replaced Remove-AzureADUser with Remove-MgUser
Replaced the Cmdlet `Remove-AzureADUser` with `Remove-MgUser` improved the script formatting added `#Requires` statement to prevent running a script unless the required PowerShell modules are met.
1 parent 09bd33f commit c10cdcf

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

articles/active-directory/external-identities/b2b-quickstart-invite-powershell.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ If you don’t have an Azure subscription, create a [free account](https://azure
2323
## Prerequisites
2424

2525
### PowerShell Module
26-
Install the [Microsoft Graph Identity Sign-ins module](/powershell/module/microsoft.graph.identity.signins/?view=graph-powershell-beta&preserve-view=true) (Microsoft.Graph.Identity.SignIns) and the [Microsoft Graph Users module](/powershell/module/microsoft.graph.users/?view=graph-powershell-beta&preserve-view=true) (Microsoft.Graph.Users).
26+
Install the [Microsoft Graph Identity Sign-ins module](/powershell/module/microsoft.graph.identity.signins/?view=graph-powershell-beta&preserve-view=true) (Microsoft.Graph.Identity.SignIns) and the [Microsoft Graph Users module](/powershell/module/microsoft.graph.users/?view=graph-powershell-beta&preserve-view=true) (Microsoft.Graph.Users). You can use the `#Requires` statement to prevent running a script unless the required PowerShell modules are met.
27+
28+
```powershell
29+
#Requires -Modules Microsoft.Graph.Identity.SignIns, Microsoft.Graph.Users
30+
```
2731

2832
### Get a test email account
2933

@@ -34,7 +38,7 @@ You need a test email account that you can send the invitation to. The account m
3438
Run the following command to connect to the tenant domain:
3539

3640
```powershell
37-
Connect-MgGraph -Scopes user.readwrite.all
41+
Connect-MgGraph -Scopes 'User.ReadWrite.All'
3842
```
3943

4044
When prompted, enter your credentials.
@@ -66,9 +70,16 @@ When prompted, enter your credentials.
6670
When no longer needed, you can delete the test user account in the directory. Run the following command to delete a user account:
6771

6872
```powershell
69-
Remove-AzureADUser -ObjectId "<UPN>"
73+
Remove-MgUser -UserId '<String>'
74+
```
75+
For example:
76+
```powershell
77+
Remove-MgUser -UserId 'john_contoso.com#EXT#@fabrikam.onmicrosoft.com'
78+
```
79+
or
80+
```powershell
81+
Remove-MgUser -UserId '3f80a75e-750b-49aa-a6b0-d9bf6df7b4c6'
7082
```
71-
For example: `Remove-AzureADUser -UserId john_contoso.com#EXT#@fabrikam.onmicrosoft.com`
7283

7384

7485
## Next steps

0 commit comments

Comments
 (0)