Forum Discussion
AdamAtTheMuseum
May 23, 2023Copper Contributor
MS Microsoft Graph PowerShell SDK to assign licenses in bulk from a csv file
Hello I have a .csv file with over 400 users in it in the form of the email address of each user. I need to assign a Microsoft 365 license to each user as a one-off process. They currently have thr...
- May 23, 2023
Figure Out your SKUID's here
Connect-MgGraph -Scopes User.ReadWrite.All, Directory.ReadWrite.All
$CSV = Import-CSV -Path C:\Test\users.csv #-Delimiter ";"
ForEach ($User in $CSV)
{
$UPN = $User.Email
Set-MgUserLicense -UserId $UPN -AddLicenses @{SkuId = 'cb10e6cd-9da4-4992-867b-67546b1db821'} -RemoveLicenses @()
}
Regards
Andres
May 23, 2023
You will need to build the script but using Graph SDK PowerShell, I recommend this resource to start getting use to it to have the confidence to create it and use it
https://practical365.com/microsoft-365-license-graph-sdk/
https://practical365.com/microsoft-365-license-graph-sdk/