Sitecore XM Cloud CLI Cheat Sheet To contribute, please reach out. https://www.linkedin.com/in/nehemiahj/
|
To login to XM Cloud Organization using a device code flow with writing allowed
|
dotnet sitecore cloud login --allow-write
|
Can access the XM Cloud Deploy API and the CM instance APIs of all environments in an organization
|
|
To login to XM Cloud Organization using a credentials flow (Organization Credentials)
|
dotnet sitecore cloud login --allow-write --client-credentials --client-id <Org-Client-Id> --client-secret <Org-Client-Secret>
|
Can access the XM Cloud Deploy API and the CM instance APIs of all environments in an organization
|
|
To login to XM Cloud Environment using a credentials flow (Automation Credentials)
|
dotnet sitecore cloud login --allow-write --client-credentials --client-id <Automation-Client-Id> --client-secret <Automation-Client-Secret>
|
Can access the CM instance APIs of a specific environment. No Deploy API Access.
|
|
To login to XM Cloud Organization using a credentials flow including authority and audience (Organization Credentials)
|
dotnet sitecore cloud login --allow-write --authority https://auth.sitecorecloud.io/ --audience https://api.sitecorecloud.io --client-id <Org-Client-Id> --client-secret <Org-Client-Secret> --client-credentials
|
Can access the XM Cloud Deploy API and the CM instance APIs of all environments in an organization
|
|
To login to Edge administration using a credentials flow (Edge Administration Credentials)
|
dotnet sitecore cloud login --allow-write --client-credentials --client-id <Edge-Client-Id> --client-secret <Edge-Client-Secret>
|
Can manage the Experience Edge for XM Cloud settings of an environment
|
|
To logout of an XM Cloud Environment
|
dotnet sitecore cloud logout
|
Same for all type of login flow.
|
|
Need Organization Credentials for using Client Credentials or Use code flow. Automation or Edge Administration credentials will return forbidden error.
|
||
|
To display information about the current user's organizations
|
dotnet sitecore cloud organization info --organization-id <id>
|
-
|
|
To display information about the current user's organizations as JSON
|
dotnet sitecore cloud organization info --organization-id <id> --json
|
Output as Json
|
|
To display the health status of the organization's resources
|
dotnet sitecore cloud organization health --organization-id <id>
|
-
|
|
To display the health status of the organization's resources as JSON
|
dotnet sitecore cloud organization health --organization-id <id> --json
|
Output as Json
|
|
To download the organization's license to the current folder
|
dotnet sitecore cloud organization license --organization-id <id>
|
-
|
|
Need Organization Credentials for using Client Credentials or Use code flow. Automation or Edge Administration credentials will return forbidden error.
|
||
|
To list all the XM Cloud projects
|
dotnet sitecore cloud project list
|
-
|
|
To list all the XM Cloud projects as JSON
|
dotnet sitecore cloud project list --json
|
Output as Json
|
|
To get information about a XM Cloud Project
|
dotnet sitecore cloud project info --project-id <Project-Id>
|
-
|
|
To get information about a XM Cloud Project as JSON
|
dotnet sitecore cloud project info --project-id <Project-Id> --json
|
Output as Json
|
|
To create a new XM Cloud Project
|
dotnet sitecore cloud project create --name "<Project-Name>"
|
-
|
|
To update the XM Cloud Project details
|
dotnet sitecore cloud project update --project-id <Project-Id> --name "Nehem"
|
Only one attribute (name) can be updated at this time.
|
|
To delete the XM Cloud Project
|
dotnet sitecore cloud project delete --project-id <Project-Id>
|
Cannot delete the project if 1 or more active environments. Should delete all the environment at first and then project can be deleted.
|
|
To create a deployment request
|
dotnet sitecore cloud deployment create --environment-id <Environment-Id>
|
Deployment request created and started immediately for the environment.
|
|
To queue a deployment request
|
dotnet sitecore cloud deployment create --environment-id <Environment-Id> --no-start
|
Need to call
deployment start to start the deployment |
|
To create the deployment request without showing the status in CLI Console
|
dotnet sitecore cloud deployment create --environment-id <Environment-Id> --no-watch
|
-
|
|
To create the deployment request and upload the assets from current working directory
|
dotnet sitecore cloud deployment create --environment-id <Environment-Id> --upload
|
-
|
|
To create the deployment request and upload the assets from a custom working directory
|
dotnet sitecore cloud deployment create --environment-id <Environment-Id> --upload --working-dir "C:\Artifacts"
|
-
|
|
To view the existing deployment request information
|
dotnet sitecore cloud deployment info --deployment-id <Deployment-Id>
|
-
|
|
To list all the deployment requests on an XM Cloud Environment
|
dotnet sitecore cloud deployment list --environment-id <Environment-Id>
|
-
|
|
To start a deployment which is in queue
|
dotnet sitecore cloud deployment start --deployment-id <Environment-Id>
|
-
|
|
To start the deployment and watch the post actions in CLI Console
|
dotnet sitecore cloud deployment start --deployment-id <Environment-Id> --waitForPostActions
|
-
|
|
To watch the status of the deployment request in Console
|
dotnet sitecore cloud deployment watch --deployment-id <Deployment-Id>
|
Will attach the console to see the status realtime
|
|
To view the deployment log in console
|
dotnet sitecore cloud deployment log --deployment-id <Deployment-Id>
|
-
|
|
To download the deployment log to a specific folder
|
dotnet sitecore cloud deployment log --deployment-id <Deployment-Id> --outputpath .
|
Downloads the deployment log to the current working folder.
|
|
Output of the log file will be saved in the current folder in this format. Deployment_<DEPLOYMENTID>_logs.json
|
||
|
To list all XM Cloud Environment for a project
|
dotnet sitecore cloud environment list --project-id <Project-Id>
|
Need specific Project ID
|
|
To list all XM Cloud Environment for a project as JSON
|
dotnet sitecore cloud environment list --project-id <Project-Id> --json
|
Output as JSON
|
|
To get the information
|
dotnet sitecore cloud environment get --environment-id <Environment-Id>
|
-
|
|
To get the information as JSON
|
dotnet sitecore cloud environment info --environment-id <Environment-Id> --json
|
Output as JSON
|
|
To create a new XM Cloud Environment
|
dotnet sitecore cloud environment create --name "QA" --project-id <Project-Id>
|
Need specific Project ID under which Environment will be created
|
|
To create a new XM Cloud Production Environment
|
dotnet sitecore cloud environment create --name "Production" --project-id <Project-Id> --prod
|
Need --prod to indicate that it is a production Environment
|
|
To create a new XM Cloud Environment as JSON
|
dotnet sitecore cloud environment create --name "QA" --project-id <Project-Id> --json
|
Output as JSON
|
|
To update an XM Cloud Environment
|
dotnet sitecore cloud environment update --environment-id <Environment-Id> --name "<New-Name>"
|
Need the specific Environment ID. Only name can be updated as of now
|
|
To delete an XM Cloud Environment
|
dotnet sitecore cloud environment delete --environment-id <Environment-Id>
|
Need the specific Environment ID
|
|
To connect current Sitecore solution to an XM Cloud Environment
|
dotnet sitecore cloud environment connect --environment-id <Environment-Id> --name "Staging"
|
Establish connection info for an XM Cloud Environment (updates endpoints in user.json). Add a new endpoint in user.json with name. --name is optional.
|
|
To disconnect current Sitecore solution to an XM Cloud Environment
|
sitecore cloud environment disconnect --environment-id <Environment-Id> --name "Staging"
|
Remove connection info for an XM Cloud Environment (updates endpoints in user.json). --name is optional.
|
|
To promote a deployment to another XM Cloud Environment
|
dotnet sitecore cloud environment promote --environment-id <Environment-Id> --source-id <Deployment-Id>
|
Similar to Deployment Create command. Need the source deployment ID which should be promoted to. Can create the promotion deployment request without starting it.
|
|
dotnet sitecore cloud environment promote --environment-id <Environment-Id> --source-id <Deployment-Id> --no-start
|
Similar to deployment create command, deployment can be queued.
|
|
|
dotnet sitecore cloud environment promote --environment-id <Environment-Id> --source-id <Deployment-Id> --no-watch
|
Will not show the deployment progress in CLI
|
|
|
dotnet sitecore cloud environment promote --environment-id <Environment-Id> --source-id <Deployment-Id> --waitForPostActions
|
Will show the Post Actions progress in the CLI. Be default, post actions are not shown in real time in CLI. --no-watch has high precedence than --waitForPostActions
|
|
|
To list all the available logs from an XM Cloud Environment
|
dotnet sitecore cloud environment log list --environment-id <Environment-Id>
|
-
|
|
dotnet sitecore cloud environment log list --environment-id <Environment-Id> --latest
|
Gets only the latest set of log files
|
|
|
dotnet sitecore cloud environment log list --environment-id <Environment-Id> --latest --json
|
Get the latest log files in a JSON format and it has the API path property to get the log file.
|
|
|
To download the specific log file
|
dotnet sitecore cloud environment log download --environment-id <Environment-Id> --logfile <LogFile> --outputpath .
|
Downloads in the current folder (.)
|
|
To view the log file in the console
|
dotnet sitecore cloud environment log view --environment-id <Environment-Id> --logfile <LogFile>
|
Similar to Download except it is rendered in console. There is no tail option.
|
|
To get the health of the environment
|
dotnet sitecore cloud environment health --environment-id <Environment-Id>
|
Calls https://<Environment-Host>/healthz/ready and provides whether it is healthy or not. /healthz/ready. Healthy if 200 and Unhealthy if 503 response code.
|
|
To list all the environment variables of an Environment
|
dotnet sitecore cloud environment variable list --environment-id <Environment-Id>
|
To print all the variables in the Console
|
|
dotnet sitecore cloud environment variable list --environment-id <Environment-Id> --json
|
Output as JSON
|
|
|
- Creating/Updating/Deleting Environment Variable requires a rebuild/redeploy of XM Cloud environment for the changes to take effect. |
||
|
To create/update an environment variable of an Environment
|
dotnet sitecore cloud environment variable upsert --environment-id <Environment-Id> --name "Variable-Name" --value "Variable-Value"
|
-
|
|
dotnet sitecore cloud environment variable upsert --environment-id <Environment-Id> --name "Variable-Name" --value "Variable-Value" --target CM
|
Target this variable for CM only
|
|
|
dotnet sitecore cloud environment variable upsert --environment-id <Environment-Id> --name "Variable-Name" --value "Variable-Value" --target <Rendering-Host-Name>
|
Target this variable for Rendering Host
|
|
|
dotnet sitecore cloud environment variable upsert --environment-id <Environment-Id> --name "Variable-Name" --value "Variable-Value" --secret
|
This bool sets the variable encrypted
|
|
|
To delete an environment variable
|
dotnet sitecore cloud environment variable delete -environment-id <Environment-Id> --name "Variable-Name"
|
-
|
|
To restart an environment
|
dotnet sitecore cloud environment restart --environment-id <environment-id>
|
Environment will be restarted without any intervention to CM instance.
|
|
To create a new editing host
|
dotnet sitecore cloud editinghost create --cm-environment-id <cm-id> --name "Staging"
|
-
|
|
To update the name of an existing editing host
|
dotnet sitecore cloud editinghost update --environment-id <editinghost-id> --name "Staging updated"
|
-
|
|
To permanently delete an editing host
|
dotnet sitecore cloud editinghost delete --environment-id <editinghost-id>
|
-
|
|
To create and start a deployment entity for an editing host
|
dotnet sitecore cloud editinghost deploy --environment-id <editinghost-id>
|
-
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.