Usage
m365 spo site admin add [options]
Description
Adds a user or group as a site collection administrator
Options
| Option |
Description |
-u, --siteUrl <siteUrl> |
The URL of the site |
--userId [userId] |
The ID of the user to add as a site collection admin |
--userName [userName] |
The user principal name of the user to add as a site collection admin |
--groupId [groupId] |
The ID of the Microsoft Entra ID group to add as a site collection admin |
--groupName [groupName] |
The name of the Microsoft Entra ID group to add as a site collection admin |
--primary |
If set, will add the user as primary site collection admin. The old primary site collection admin will be replaced and set as secondary site collection admin |
--asAdmin |
If specified, we will use the SharePoint admin center to execute the command |
Examples
Add user as primary site collection administrator
m365 spo site admin add --siteUrl https://contoso.sharepoint.com --userId 600713c5-53c6-4f24-b454-3c35e22b2639 --primary
Adds group as secondary site collection administrator
m365 spo site admin add --siteUrl https://contoso.sharepoint.com --groupName SP_Administrators
Response
This command has no response
Usage
m365 spo site admin add [options]
Description
Adds a user or group as a site collection administrator
Options
-u, --siteUrl <siteUrl>--userId [userId]--userName [userName]--groupId [groupId]--groupName [groupName]--primary--asAdminExamples
Add user as primary site collection administrator
Adds group as secondary site collection administrator
Response
This command has no response