Jun 16 2017
07:57 AM
- last edited on
Jan 14 2022
05:31 PM
by
TechCommunityAP
Jun 16 2017
07:57 AM
- last edited on
Jan 14 2022
05:31 PM
by
TechCommunityAP
Hi
We use AD Connect to sync our own AD accounts with our Azure AD, but require a method to bulk load 'in cloud' only accounts for our external users. So I have a few quick questions if you please.
1. I've found info on using CSV files to bulk load Azure AD users for the old Azure portal but not for the new portal, is it possible? If so where can I find the technical details?
2. Where can I find a list of all the possible fields that can be currently used using the CSV method, regardless of portal?
3. Is it true that the CSV method of bulk loading users is going to be replaced by the Microsoft Graph API, if so when?
4. Where can I find the technical details about bulk loading users using the Graph API?
Thanks and take care,
Shayne
Jun 16 2017 09:39 AM
SolutionNot UI, or Graph, but I use PowerShell and it is quite simple:
$UserName = "" $Password = "" $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force $Credential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $SecurePassword Connect-MsolService -Credential $Credential $NewUser = New-MsolUser -UserPrincipalName "user@company.com" -DisplayName “Test User” -FirstName “Test” -LastName “User”
This is just for one user, just do a simple read CSV and a for loop if you want to automate a bunch
All attribute options documented here:
https://docs.microsoft.com/en-us/powershell/module/msonline/new-msoluser?view=azureadps-1.0
Jun 16 2017 09:52 AM
Here is one approach https://docs.microsoft.com/en-us/azure/active-directory/active-directory-b2b-code-samples and a more comprehensive article is at https://justidm.wordpress.com/2017/05/07/azure-ad-b2b-how-to-bulk-add-guest-users-without-invitation... and
Nov 08 2018 10:22 PM - edited Nov 08 2018 10:24 PM
Hello,
I know this comes a year late, but maybe someone else might have the same question.
I use the following script to do a bulk CSV import to AAD. This script will not assign Users to application or groups, or reset the passwords. You can use another PS Script for that.
First - you will need to update your Azure AD module for PowerShell if it is not already updated.
PS C:\>Install-Module AzureADPreview -Verbose -Force
Next run the script.
Connect-AzureRmAccount
$SecureStringPassword = ConvertTo-SecureString -String "ComplexPasswordHere" -AsPlainText -Force
$Users = Import-Csv 'C:\Path to CSV file\User_CSV_FILE.csv'
$Users | ForEach-Object {
New-AzureRmADUser -DisplayName $_.DisplayName -UserPrincipalName $_.UserPrincipalName -Password $SecureStringPassword -MailNickname $_.MailNickName -ForceChangePasswordNextLogin $True -Verbose
}
If you do a ...
Get-Help New-AzureRmADUser
You will get the parameters for it. The Required parameters are in the script. You might also be able to forgo the first $SecureStringPassword, and opt to do something like
-Password $_."Password"
I haven't tested that, but the issue you might run into is that if your passwords are complex passwords with characters used in scripting and coding, then it might not be able to convert it to a string value. The above should make it into a string value, but like I said, I have not tested it. However, with the ForceChangePasswordNextLogin, resolve this little issue nicely.
CSV Format
The CSV should absolutely contain the fields in the script as the headers.
Jun 16 2017 09:39 AM
SolutionNot UI, or Graph, but I use PowerShell and it is quite simple:
$UserName = "" $Password = "" $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force $Credential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $SecurePassword Connect-MsolService -Credential $Credential $NewUser = New-MsolUser -UserPrincipalName "user@company.com" -DisplayName “Test User” -FirstName “Test” -LastName “User”
This is just for one user, just do a simple read CSV and a for loop if you want to automate a bunch
All attribute options documented here:
https://docs.microsoft.com/en-us/powershell/module/msonline/new-msoluser?view=azureadps-1.0