Very Slow PS script execution time to Azure AD

Hello folks, Hope everyone is staying safe during the pandemic.

We have a large tenant with couple thousand users and about a thousand groups. We’re trying to create some 200 new groups and adding 125 existing users to these new groups via PowerShell script. The script was tested in a Azure AD Dev environment and it works flawlessly. Running the same script in our production tenant, creating new Groups is quick, but adding users to this group takes a very long time, atleast good minute per user, is this normal or how can I decrease my execution time. I’m running WMF 5.1 on a Win10 with latest Azure and PowerShell modules.


If user assignment code is needed, let me know and I can post it.

Any help with this is really appreciated. Thanks


It will difficult to assist you without having some code to review. Adding a user to a group taking a minute does sound excessive. Would recommend posting code to review to see what you doing.