I'm using the REST API to create a site in SharePoint Online and add an AAD security group to the site member group. When one of the AAD group members tries to access the site it displays the access request page. If the user logs out of O365 and logs back in they are able to access the site.

My basic steps are:

  1. Create site _api/SPSiteManager/create
  2. Create AAD security group and add members
  3. Wait for AAD group to be synced to SharePoint
  4. Add AAD group to site member group _api/web/sitegroups(<id>)/users

Is there a step that would fix this issue? I'm somewhat restricted in what I can use (no javascript, no powershell)

  • Is it happening for all members of AD group or just one particular user account? Oct 6, 2022 at 4:36
  • This affects all members Oct 6, 2022 at 16:19
  • Did you use ensureUser before adding AD group to SP group? Can you share code you used if possible? Oct 7, 2022 at 2:20
  • ensureUser makes no difference vs not having it. I'm fairly certain Paul is correct. I just now need to refresh the users' claims somehow. Oct 7, 2022 at 19:02

2 Answers 2


I believe this is the expected behavior for AAD groups and SharePoint, due to a user's claims/token caching. As I understand it, it can take 8 hours before the user can access the site, unless of course they logout/login which refreshes their claims.

  • This was my hunch as well. I'm still hoping there is something that I can do, either shorten the time for the token to be refreshed or detect when it is refreshed. Oct 6, 2022 at 16:24

You can try to add Azure AD security Group into the SPO Site group using powershell

Add-PnPGroupMember -LoginName <Azure AD Group Name> -Group "<Group Name>"

You can refer to this article for more details


  • I would absolutely love to use PnP.Powershell but it is not an option in the environment I'm running my script in. Oct 6, 2022 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.