You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/active-directory/external-identities/b2b-quickstart-invite-powershell.md
+15-17Lines changed: 15 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,11 @@
1
1
---
2
2
title: 'Quickstart: Add a guest user with PowerShell - Azure AD'
3
-
description: In this quickstart, you learn how to use PowerShell to send an invitation to an external Azure AD B2B collaboration user.
3
+
description: In this quickstart, you learn how to use PowerShell to send an invitation to an external Azure AD B2B collaboration user. You'll use the Microsoft Graph Identity Sign-ins and the Microsoft Graph Users PowerShell modules.
There are many ways you can invite external partners to your apps and services with Azure Active Directory B2B collaboration. In the previous quickstart, you saw how to add guest users directly in the Azure Active Directory admin portal. You can also use PowerShell to add guest users, either one at a time or in bulk. In this quickstart, you’ll use the New-AzureADMSInvitation command to add one guest user to your Azure tenant.
19
+
There are many ways you can invite external partners to your apps and services with Azure Active Directory B2B collaboration. In the previous quickstart, you saw how to add guest users directly in the Azure Active Directory admin portal. You can also use PowerShell to add guest users, either one at a time or in bulk. In this quickstart, you’ll use the New-MgInvitation command to add one guest user to your Azure tenant.
21
20
22
-
If you don’t have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
21
+
If you don’t have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
23
22
24
23
## Prerequisites
25
24
26
25
### PowerShell Module
27
-
Install the [Azure AD V2 PowerShell for Graph module](/powershell/azure/active-directory/install-adv2) (AzureAD) or the [Azure AD V2 PowerShell for Graph module preview version](/powershell/azure/active-directory/install-adv2?view=azureadps-2.0-preview&preserve-view=true) (AzureADPreview).
26
+
Install the [Microsoft Graph Identity Sign-ins module](/powershell/module/microsoft.graph.identity.signins/?view=graph-powershell-beta) (Microsoft.Graph.Identity.SignIns) and the [Microsoft Graph Users module](/powershell/module/microsoft.graph.users/?view=graph-powershell-beta) (Microsoft.Graph.Users).
28
27
29
28
### Get a test email account
30
29
@@ -35,33 +34,32 @@ You need a test email account that you can send the invitation to. The account m
35
34
Run the following command to connect to the tenant domain:
For example, `Connect-AzureAD -TenantDomain "contoso.onmicrosoft.com"`.
41
39
42
40
When prompted, enter your credentials.
43
41
44
42
## Send an invitation
45
43
46
-
1. To send an invitation to your test email account, run the following PowerShell command (replace **"Sanda"** and **sanda\@fabrikam.com** with your test email account name and email address):
44
+
1. To send an invitation to your test email account, run the following PowerShell command (replace **"John Doe"** and **john\@contoso.com** with your test email account name and email address):
3. Check the output to make sure the user you invited is listed, with a user principal name (UPN) in the format *emailaddress*#EXT#\@*domain*. For example, *sanda_fabrikam.com#EXT#\@contoso.onmicrosoft.com*, where contoso.onmicrosoft.com is the organization from which you sent the invitations.
60
+
1. Check the output to make sure the user you invited is listed, with a user principal name (UPN) in the format *emailaddress*#EXT#\@*domain*. For example, *john_contoso.com#EXT#\@fabrikam.onmicrosoft.com*, where fabrikam.onmicrosoft.com is the organization from which you sent the invitations.
63
61
64
-

62
+

65
63
66
64
## Clean up resources
67
65
@@ -70,7 +68,7 @@ When no longer needed, you can delete the test user account in the directory. Ru
70
68
```powershell
71
69
Remove-AzureADUser -ObjectId "<UPN>"
72
70
```
73
-
For example: `Remove-AzureADUser -ObjectId "sanda_fabrikam.com#EXT#@contoso.onmicrosoft.com"`
71
+
For example: `Remove-AzureADUser -UserId john_contoso.com#EXT#@fabrikam.onmicrosoft.com`
Copy file name to clipboardExpand all lines: articles/active-directory/external-identities/tutorial-bulk-invite.md
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,17 @@
1
1
---
2
2
3
3
title: Tutorial for bulk inviting B2B collaboration users - Azure AD
4
-
description: In this tutorial, you learn how to use PowerShell and a CSV file to send bulk invitations to external Azure AD B2B collaboration users.
4
+
description: In this tutorial, you learn how to use PowerShell and a CSV file to send bulk invitations to external Azure AD B2B collaboration users. You'll use the Microsoft.Graph.Users PowerShell module.
5
5
6
6
services: active-directory
7
7
ms.service: active-directory
8
8
ms.subservice: B2B
9
9
ms.topic: tutorial
10
-
ms.date: 03/17/2021
10
+
ms.date: 02/16/2022
11
11
12
12
ms.author: mimart
13
13
author: msmimart
14
14
manager: celestedg
15
-
ms.reviewer: mal
16
15
17
16
# Customer intent: As a tenant administrator, I want to send B2B invitations to multiple external users at the same time so that I can avoid having to send individual invitations to each user.
# Tutorial: Bulk invite Azure AD B2B collaboration users
23
22
24
-
If you use Azure Active Directory (Azure AD) B2B collaboration to work with external partners, you can invite multiple guest users to your organization at the same time. In this tutorial, you learn how to use the Azure portal to send bulk invitations to external users. Specifically, you do the following:
23
+
If you use Azure Active Directory (Azure AD) B2B collaboration to work with external partners, you can invite multiple guest users to your organization at the same time. In this tutorial, you learn how to use the Azure portal to send bulk invitations to external users. Specifically, you'll follow these steps:
25
24
26
25
> [!div class="checklist"]
27
26
> * Use **Bulk invite users** to prepare a comma-separated value (.csv) file with the user information and invitation preferences
@@ -42,13 +41,13 @@ The rows in a downloaded CSV template are as follows:
42
41
43
42
-**Version number**: The first row containing the version number must be included in the upload CSV.
44
43
-**Column headings**: The format of the column headings is <*Item name*>[PropertyName]<*Required or blank*>. For example, `Email address to invite [inviteeEmail] Required`. Some older versions of the template might have slight variations.
45
-
-**Examples row**: We have included in the template a row of examples of values for each column. You must remove the examples row and replace it with your own entries.
44
+
-**Examples row**: We've included in the template a row of examples of values for each column. You must remove the examples row and replace it with your own entries.
46
45
47
46
### Additional guidance
48
47
49
48
- The first two rows of the upload template must not be removed or modified, or the upload can't be processed.
50
49
- The required columns are listed first.
51
-
- We don't recommend adding new columns to the template. Any additional columns you add are ignored and not processed.
50
+
- We don't recommend adding new columns to the template. Any columns you add are ignored and not processed.
52
51
- We recommend that you download the latest version of the CSV template as often as possible.
53
52
54
53
## Prerequisites
@@ -83,7 +82,7 @@ You need two or more test email accounts that you can send the invitations to. T
83
82
7. On the **Bulk invite users** page, under **Upload your csv file**, browse to the file. When you select the file, validation of the .csv file starts.
84
83
8. When the file contents are validated, you’ll see **File uploaded successfully**. If there are errors, you must fix them before you can submit the job.
85
84
9. When your file passes validation, select **Submit** to start the Azure bulk operation that adds the invitations.
86
-
10. To view the job status, select **Click here to view the status of each operation**. Or, you can select **Bulk operation results** in the **Activity** section. For details about each line item within the the bulk operation, select the values under the **# Success**, **# Failure**, or **Total Requests** columns. If failures occurred, the reasons for failure will be listed.
85
+
10. To view the job status, select **Click here to view the status of each operation**. Or, you can select **Bulk operation results** in the **Activity** section. For details about each line item within the bulk operation, select the values under the **# Success**, **# Failure**, or **Total Requests** columns. If failures occurred, the reasons for failure will be listed.
87
86
88
87

89
88
@@ -102,25 +101,30 @@ Check to see that the guest users you added exist in the directory either in the
102
101
103
102
### View guest users with PowerShell
104
103
104
+
To view guest users with PowerShell, you'll need the [Microsoft.Graph.Users PowerShell Module](/powershell/module/microsoft.graph.users/?view=graph-powershell-beta). Then sign in using the `Connect-MgGraph` command with an admin account to consent to the required scopes:
105
+
```powershell
106
+
Connect-MgGraph -Scopes "User.Read.All"
107
+
```
108
+
105
109
Run the following command:
106
110
107
111
```powershell
108
-
Get-AzureADUser -Filter "UserType eq 'Guest'"
112
+
Get-MgUser -Filter "UserType eq 'Guest'"
109
113
```
110
114
111
115
You should see the users that you invited listed, with a user principal name (UPN) in the format *emailaddress*#EXT#\@*domain*. For example, *lstokes_fabrikam.com#EXT#\@contoso.onmicrosoft.com*, where contoso.onmicrosoft.com is the organization from which you sent the invitations.
112
116
113
117
## Clean up resources
114
118
115
-
When no longer needed, you can delete the test user accounts in the directory in the Azure portal on the Users page by selecting the checkbox next to the guest user and then selecting **Delete**.
119
+
When no longer needed, you can delete the test user accounts in the directory in the Azure portal on the Users page by selecting the checkbox next to the guest user and then selecting **Delete**.
116
120
117
121
Or you can run the following PowerShell command to delete a user account:
118
122
119
123
```powershell
120
-
Remove-AzureADUser -ObjectId "<UPN>"
124
+
Remove-MgUser -UserId "<UPN>"
121
125
```
122
126
123
-
For example: `Remove-AzureADUser -ObjectId "lstokes_fabrikam.com#EXT#@contoso.onmicrosoft.com"`
127
+
For example: `Remove-MgUser -UserId "lstokes_fabrikam.com#EXT#@contoso.onmicrosoft.com"`
0 commit comments