I have previously shared the PowerShell magic where you can update the Azure AD group membership based on on-premise AD group.
Today I am sharing another PowerShell Spell which you can use to update the Azure AD group membership by using the textfile as input.
Prerequisites for this Solution:
Download the Script from GitHUB
https://github.com/VikasSukhija/Downloads/blob/master/ADD2AzureADfromText.ps1
Download it from Powershell Gallery
https://www.powershellgallery.com/packages/ADD2AzureADfromText
Install-Script -Name ADD2AzureADfromText
Once you have the script, create a users.txt file shown below in the same directory as script.
Now run the script by providing the AzureAD group object id:
Option1
à ADD users to AzureAd group from users.txt file
.\ADD2AzureADfromText.ps1 -Azgroupid 3cb45h9-f2s8-41df-986d-45vde77eert -operation ADD
Option2
à Remove users from AzureAd from users.txt file
.\ADD2AzureADfromText.ps1 -Azgroupid 3cb45h9-f2s8-41df-986d-45vde77eert -operation Remove
Note: -userlist is optional parameter in case you want to name the text file different then users.txt
It will ask you to authenticate with azure ad account that ahs rights to add/remove from group members.
Script will create a log as well as summary report in the form of csv file. (logs and reports will be saved in their respective folders that get created on first execution)
I hope this PowerShell magic will assist you in multiple situations.
Thanks for reading and downloading….
Tech Wizard