In our spo group user add command, we currently do not allow to add Azure AD groups as a user.
We could add the following option to allow for this
| Option |
Description |
--aadGroupId [aadGroupId] |
The object Id of the Azure AD group to add as a member. If multiple groups needs to be added, the Id's have to be comma separated. Specify either userName, email, aadGroupId or aadGroupName. |
--aadGroupName [aadGroupName] |
The name of the Azure AD group to add as a member. Specify either userName, email, aadGroupId or aadGroupName. |
Remarks
Update: We've renamed the commands to spo group member in #4087.
When adding groups by name, you cannot use a comma separated list of multiple names. The comma could be part of the display name.
Examples
Add an Azure AD group as a SharePoint Group Member
m365 spo group member add --webUrl https://contoso.sharepoint.com/sites/SiteA --groupId 5 --aadGroupId "121917be-e057-44e6-b017-238166656223"
Add the Azure AD Sales group as a SharePoint Group Member
m365 spo group member add --webUrl https://contoso.sharepoint.com/sites/SiteA --groupId 5 --aadGroupName "Sales"
In our spo group user add command, we currently do not allow to add Azure AD groups as a user.
We could add the following option to allow for this
--aadGroupId [aadGroupId]userName,email,aadGroupIdoraadGroupName.--aadGroupName [aadGroupName]userName,email,aadGroupIdoraadGroupName.Remarks
Update: We've renamed the commands to spo group member in #4087.
When adding groups by name, you cannot use a comma separated list of multiple names. The comma could be part of the display name.
Examples
Add an Azure AD group as a SharePoint Group Member
m365 spo group member add --webUrl https://contoso.sharepoint.com/sites/SiteA --groupId 5 --aadGroupId "121917be-e057-44e6-b017-238166656223"Add the Azure AD Sales group as a SharePoint Group Member
m365 spo group member add --webUrl https://contoso.sharepoint.com/sites/SiteA --groupId 5 --aadGroupName "Sales"