I have an problem with adding existing Azure AD groups to SharePoint online. What am I trying to do, I’m creating 50+ sites and break the site inheritance. then I like to add existing AzureAD groups to the SharePoint online site

there are a lot of sites that explaine how to create a new group and add that to the site and how to add users to a group but I haven’t found an site that explains how to add an existing group to a site.

I looked at this site but this is adding users to an group Add AD group to SharePoint Online using REST API

the title of the site sounded good

I know how to do this on-prem but in the cloud there is where i have a problem

Hope someone knows the answer

  • do these groups have email address ? do you want to add the Azure AD group to a SharePoint group ? Mar 27, 2018 at 12:10
  • I like to add an Azure AD group to an site, not to an SharePoint group if i add an Azure AD group to an Sharepoint group than I have two groups for the same site. if possible I want to skip the Sharepoint group
    – Robert1972
    Mar 28, 2018 at 6:26

2 Answers 2


We did the following when adding AD groups via C#:

var group = ctx.Web.EnsureUser($"c:0t.c|tenant|{groupid}");
item.RoleAssignments.Add(group, new RoleDefinitionBindingCollection(ctx) {contribute});

Where groupid was the object identifier of the AD group. If you import the SharePoint Client libraries to PowerShell, you should be able to refactor this so that you can use it.

  • I don't get this to work I added these two files to the powershell script but no luck Add-Type -Path "C:\~\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\~\Microsoft.SharePoint.Client.Runtime.dll" also I have to say that my C# knowledge is not that great, PowerShell is a lot better
    – Robert1972
    Apr 11, 2018 at 6:41

I already faced this situation, the trick is to create a SP group let's name it (All AD Groups), and let's suppose we already created our AD groups (for example: ADG1, ADG2 ...etc)

in sharepoint the AD groups are considered users (not SP groups), so all you need to do is to add this AD groups to the SP group created above "All AD Groups", and you will see that your AD groups are automatically add to your site collection.

  • BOULAGIA Did you manage to do it from code? I have the same situation but I have trouble when adding the groups using code.
    – JohnRambo
    Nov 20, 2020 at 11:19
  • Never tried it, can you illustrate it more ? Dec 5, 2020 at 11:20
  • Well I fixed it using some of the code in this answer: sharepoint.stackexchange.com/questions/287058/… But the mistake was mine to try to add Office365 groups at the first place. It is working perfectly fine if only security groups are used
    – JohnRambo
    Dec 8, 2020 at 12:58

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.