Forum Discussion
abedinthehouse
Mar 29, 2023Copper Contributor
Bulk Disable Azure AD Users
I am looking for a way to disable (not delete) 300 AzureAD users with the "AccountEnabled" field. I was able to find the script below from an older post but I keep getting an error. I'm new here and ...
- Mar 30, 2023
The command to disable Azure AD user is:
Set-AzureADUser -ObjectID "user_upn_or_id" -AccountEnabled $false
You can just change the line as like below one:
Set-AzureADUser -ObjectID $user.ObjectId -AccountEnabled $false
Refer this post to update bulk Azure AD User attributes:
https://morgantechspace.com/2022/03/update-bulk-azure-ad-user-attributes-using-powershell.html
If you're interested in updating bulk Office 365 user profile information without using PowerShell, try the Office 365 Manager from Specmasoft. This tool helps you modify bulk M365 users using CSV, update licenses, add bulk members to groups, and more.
https://specmasoft.com/office-365-manager/update-bulk-azure-ad-users-in-microsoft-365-using-a-csv-file
TheoM1285
Sep 18, 2024Copper Contributor
You can deactivate an Azure/EntraID account by setting BlockCredential to "True". The easiest way to do this in bulk is simply to run a CSV export of the OU you want to suspend all users in (e.g. "Leavers) and then run the following script:
import-csv "PATH_TO_CSV.csv" | foreach {
Set-MsolUser -UserPrincipalName $_.userPrincipalName -BlockCredential $True
}
Works a treat for me and very straight-forward.
import-csv "PATH_TO_CSV.csv" | foreach {
Set-MsolUser -UserPrincipalName $_.userPrincipalName -BlockCredential $True
}
Works a treat for me and very straight-forward.