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