Create an XM Cloud project using the Sitecore CLI

You can create projects, environments, and deployments with the Sitecore CLI commands provided by the XM Cloud plugin. Using the Sitecore CLI instead of the XM Cloud Deploy app for creating the XM Cloud project is a matter of preference if your project repository is hosted on GitHub, but it is necessary if your organization hosts source-code repositories on other platforms.

This walkthrough demonstrates using the Sitecore CLI to deploy a Sitecore solution to an XM Cloud environment.

Before you begin

This walkthrough describes how to:

Optional: Obtain the initial source code

If you do not have an XM Cloud-compatible solution and do not want to host the source code in a GitHub repository, you can obtain an initial solution by cloning a foundation template.

To obtain the initial source code for your XM Cloud project:

Tip

If you use GitHub to host your repositories, the fastest and easiest way to create an XM Cloud project is using the XM Cloud Deploy app. You can then follow the walkthrough to set up your local development environment.

Log in to XM Cloud

To run CLI commands against the SaaS XM Cloud platform, you must authorize your device and provide your XM Cloud credentials. The login process described here performs the necessary device and user authorization and authentication.

You obtain your authentication credentials during the onboarding process.

Create an XM Cloud project

A project within XM Cloud represents a collection of one or more Sitecore XM environments.

Create an environment for the XM Cloud project

An XM Cloud environment represents a SaaS Sitecore Content Management (CM) tenant along with all the services and supporting tenants for hosting a Sitecore solution. Every environment belongs to a project.

Deploy the solution to the XM Cloud environment

The XM Cloud deployment process deploys an image of your solution to a specified environment. It provisions and configures the necessary infrastructure. This section describes using the --upload CLI command.

The default value for the --upload command parameter is the current working directory. When providing the argument, everything in the directory is packaged and deployed to XM Cloud unless specified in a .gitignore file.

To use another folder, use the --upload parameter and provide the path to another directory with the --working-dir (-dir) parameter. For example:

RequestResponse

dotnet sitecore cloud deployment create --environment-id <id> --no-start --no-watch --upload --working-dir <path>

Additional steps

After deploying your solution to the XM Cloud platform, you can continue to develop locally and then deploy customizations to the XM Cloud environment. You can also synchronize items between your local development environment and the XM Cloud CM instance.

See also how to deploy the client/front-end application.

Do you have some feedback for us?

If you have suggestions for improving this article,