Additional Microsoft Entra services and features related to identity, access, and network security
Hi @Joshua Sam ,
Based on the script you shared it sounds like you are getting the "insufficient privileges to complete the operation" error when you run
Get-AzADGroupMember
In this case, it looks like you could be missing the permission to read groups.
You may have granted your app permissions for the Microsoft Graph API, where the Get-AzADGroup uses the deprecated Azure AD Graph API. Try adding the service principal to the User Administrator role and make sure that the "Directory Reader" role is assigned under Azure AD > Roles and administrators > roles > add assignments > add the Object ID of the managed identity.
See similar issue here: https://www.reddit.com/r/AZURE/comments/qrxvo9/addazadgroupmember_insufficient_privileges_to/
Let me know if this helps and if you still face the issue.
If the information helped you, please Accept the answer. This will help us as well as others in the community who may be researching similar information. Otherwise let me know if you have further questions.