spo user remove
Removes user from specific web
Usage
m365 spo user remove [options]
Options
-u, --webUrl <webUrl>URL of the web to remove user.
--id [id]ID of the user to remove from web. Use either
idorloginNameoremail,userName,entraGroupId, orentraGroupName, but not all.--loginName [loginName]Login name of the user to remove from web. Use either
idorloginNameoremail,userName,entraGroupId, orentraGroupName, but not all.--userName [userName]User name of the user to remove from web. Use either
idorloginNameoremail,userName,entraGroupId, orentraGroupName, but not all.--email [email]Email of the user to remove from web. Use either
idorloginNameoremail,userName,entraGroupId, orentraGroupName, but not all.--entraGroupId [entraGroupId]Object ID of the Entra group ID to remove. Use either
idorloginNameoremail,userName,entraGroupId, orentraGroupName, but not all.--entraGroupName [entraGroupName]Name of the Entra group to remove. Use either
idorloginNameoremail,userName,entraGroupId, orentraGroupName, but not all.-f, --forceDo not prompt for confirmation before removing user from web
-h, --help [help]Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are
options,examples,remarks,permissions,response,full. Default isoptions.--query [query]JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]Output type.
json,text,csv,md,none. Defaultjson.--verboseRuns command with verbose logging.
--debugRuns command with debug logging.
Examples
Removes user by id from a web without prompting for confirmation
m365 spo user remove --webUrl "https://contoso.sharepoint.com/sites/HR" --id 10 --force
Removes user by loginName from a web
m365 spo user remove --webUrl "https://contoso.sharepoint.com/sites/HR" --loginName "i:0#.f|membership|john.doe@mytenant.onmicrosoft.com"
Removes user by userName from a web
m365 spo user remove --webUrl "https://contoso.sharepoint.com/sites/HR" --userName "john.doe_hotmail.com#ext#@mytenant.onmicrosoft.com"
Removes user by email from a web
m365 spo user remove --webUrl "https://contoso.sharepoint.com/sites/HR" --email "john.doe@mytenant.onmicrosoft.com"
Removes user by entraGroupId from a web
m365 spo user remove --webUrl "https://contoso.sharepoint.com/sites/HR" --entraGroupId f832a493-de73-4fef-87ed-8c6fffd91be6
Removes user by entraGroupName from a web
m365 spo user remove --webUrl _https://contoso.sharepoint.com/sites/HR_ --entraGroupName "Test Members"
Response
The command won't return a response on success.