azuresalesforceazure-active-directory

How to bulk create/import users in Azure AD so that all of them can have single sign on to my SF sandbox?


I am working on Using Single Sign on for my Salesforce sandbox. I am using Azure AD as the authentication provider. I was able to add a few users in Azure AD and actually got the Single sign on working for my SF sandbox (for those users). The problem is my sandbox has 500 users and I would like to add them all to my Azure AD. Here is the document I followed to get the single sign on working for my test users. So my next step/question is how do I bulk uloa all my user information in Azure AD so that all of them can have single sign on to my SF sandbox? Thank you


Solution

  • Once you have all user information available in a CSV file, you can make use of PowerShell and Import-csv to import all userinformation.

    Then use New-AzureADUser command to create these users. Skeleton like this..

    foreach($user in import-csv "E:\userinfo.csv") 
    { 
       Write-Host "Processing item with.. UserName="$user.DisplayName
    
       # Make use of variables like $user.DisplayName and so on in your commands here..
       # New-AzureADUser -DisplayName $user.DisplayName ... and so on..
    }
    

    A very detailed script with similar strategy is availble here: Creating Bulk users in Azure AD with PowerShell