1. The CLI cloud command

The cloud login command

The Sitecore XM Cloud plugin provides the cloud login command. The command authenticates a person through the Sitecore CLI with a SitecoreAI Organization, granting them access tokens and claims based on authorization.

Initial credentials and endpoints are stored in the Sitecore.DevEx.Extensibility.XMCloud<version>\plugin\plugin.json file. After logging in, you can find them in the .sitecore\user.json file.

Note

XM Cloud is now SitecoreAI Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.

Usage

You can use the cloud login command as follows:

shell
dotnet sitecore cloud login [options]

You can run the command without any options.

To log in to a SitecoreAI Organization, the Sitecore CLI XM Cloud plugin allows two flows of authentication and authorization:

  • An interactive user login using a device code flow.
  • A non-interactive client login using a client credentials flow. This is used by clients such as Continuous Integration (CI) servers.

For interactive user login using a device code authentication flow, use the command:

shell
dotnet sitecore cloud login

For non-interactive client logins using client credential flows, use the command:

shell
dotnet sitecore cloud login --client-credentials --client-id <clientId> --client-secret <clientSecret>

Options

The cloud login command has the following options:

OptionDescription
--allow-write, -awA Boolean parameter specifying if writing (pushing) data to the SitecoreAI environment is allowed.Default: False
--authority, --authSpecifies the Identity Server used to authenticate to the Sitecore Cloud system and Organization.Default: the value set with the SaaS Identity auth URL.
--audienceSpecifies the audience for authentication to the Sitecore Cloud system and Organization. In production, provide one of the following audiences
access the environment, https://api.sitecorecloud.io.To access the Sitecore deployment using the XM Cloud DevEx plugin, https://xmcloud-cm.sitecorecloud.io.XM Cloud is now SitecoreAISome code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
--client-idSpecifies the client ID used for the Sitecore Cloud system and Organization authentication.
--client-secretSpecifies the client secret used for authentication to the Sitecore Cloud system and Organization.
--client-credentialsA Boolean parameter specifying whether to use the client credentials flow. Use it for authentication flows with continuous integration and automation tools.
--xmcloudhostSpecifies the SitecoreAI hosting URL.XM Cloud is now SitecoreAISome code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
--xmcloudmonitoringhostSpecifies the SitecoreAI MonitoringAPI hosting URL
--configPath to the folder containing the sitecore.json file.Default: the root directory of the Sitecore project solution.
--verbose, -vWrite additional information about the command.
--trace, -tWrite diagnostics and detailed information about the command.
-?, -h, --helpDisplay developer help and usage information about the command.
If you have suggestions for improving this article, let us know!