Skip to main content

spo user ensure

Ensures that a user is available on a specific site

Usage

m365 spo user ensure [options]

Options

-u, --webUrl <webUrl>

Absolute URL of the site.

--entraId [--entraId]

Id of the user in Entra. Specify either entraId or userName.

--userName [userName]

User's UPN (user principal name, e.g. john@contoso.com). Specify either entraId or userName.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Examples

Ensures a user by its Entra Id.

m365 spo user ensure --webUrl https://contoso.sharepoint.com/sites/project --entraId e254750a-eaa4-44f6-9517-b74f65cdb747

Ensures a user by its user principal name.

m365 spo user ensure --webUrl https://contoso.sharepoint.com/sites/project --userName john@contoso.com

Response

{
"Id": 35,
"IsHiddenInUI": false,
"LoginName": "i:0#.f|membership|john@contoso.com",
"Title": "John Doe",
"PrincipalType": 1,
"Email": "john@contoso.com",
"Expiration": "",
"IsEmailAuthenticationGuestUser": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": false,
"UserId": {
"NameId": "1003200274f51d2d",
"NameIdIssuer": "urn:federation:microsoftonline"
},
"UserPrincipalName": "john@contoso.com"
}
CTRL + M