Sharepoint Online permission management - grant an AD group SPO permission

This is probably an easy one, but I’m a sharepoint online noob and just learning powershell, so a push in the right direction would be very helpful from this awesome community.

Here’s what I’m trying to do:

Grant an Active Directory group: “group 1”
a custom permission I created in SPO “custom permission”
to a library “library 1”
in my site collection “site1”

I can’t figure it out, but I’m sure it’s possible. I found some articles detailing processes that would effectively allow me to do this, but involved adding an AD group to SPO group, which would necessitate creating a SPO group for every library.

Any ideas?

Have you seen this yet?

Thanks for the help Jack! I actually didn’t come across that post, but it’s for sharepoint and I’m using Sharepoint online. The cmdlets are different, and I’m trying to make it work, but so far no luck.

Are you syncing your AD groups to Office 365? You’ll be assigning permissions to a Sharepoint group (security group in Office 365), but these can be synced over from your on-premise AD using Dirsync/AADSync.

Once the group is in Sharepoint, you should be able to set permissions on a site using Set-SPOSiteGroup:

Thanks for the help Matt!

I think you can only add sharepoint groups to site permissions with that commandlet (I could be wrong), I’m trying to add AD-groups to sharepoint libraries’ permissions and still can’t get it working.

Our AD groups are sync’d with O365, and they do show up in the Azure AD portal. I can also accomplish fine through the Sharepoint online administration center in the library permissions group, so I know that sharepoint online recognizes the groups, I just can’t figure out how to automate this with powershell.

Not sure if this helps or not but I’ve found this set of modules to be very beneficial when dealing with Sharepoint Online:


Here are all the commands with Permissions in them:

get-command -module officedevpnP* Permissions

CommandType Name Version Source

Cmdlet Get-SPOGroupPermissions 2.3.1604.1 OfficeDevPnP.PowerShell.V16.Commands
Cmdlet Get-SPOGroupPermissions 2.3.1604.1 OfficeDevPnP.PowerShell.V15.Commands
Cmdlet Set-SPOGroupPermissions 2.3.1604.1 OfficeDevPnP.PowerShell.V16.Commands
Cmdlet Set-SPOGroupPermissions 2.3.1604.1 OfficeDevPnP.PowerShell.V15.Commands