Hi Pol
I'm AnnaThomas and I'd happily help you with your question. In this Forum, we are Microsoft consumers just like yourself.
Here is an example script that shows how you can use the Microsoft Graph SDK for PowerShell to bulk upload users from a CSV file:
Install the Microsoft Graph SDK for PowerShell
Install-Module -Name Microsoft.Graph
Connect to the Microsoft Graph API
Connect-MgGraph
Import the CSV file
$users = Import-Csv -Path "D:\O365\bulk2.csv"
Iterate over each user in the CSV file
foreach ($user in $users) {
# Create a new user object
$newUser = New-MgUser -DisplayName $user. DisplayName -GivenName $user. FirstName -Surname $user. LastName -UserPrincipalName $user. UserPrincipalName -PasswordProfile @{ ForceChangePasswordNextSignIn = $true; Password = $user. Password } -UsageLocation $user. UsageLocation
Assign licenses to the new user
New-MgUserLicense -UserId $newUser.Id -AddLicenses @{ SkuId = $user. AccountSkuId }
}
Learn more: https://learn.microsoft.com/graph/sdks/large-file-upload?tabs=csharp
I hope this helps ;-), let me know if this is contrary to what you need, I would still be helpful to answer more of your questions.
Best Regards,
AnnaThomas
Give back to the community. Help the next person with this problem by indicating whether this answer solved your problem. Click Yes or No at the bottom.