---
title: "Manage an environment"
slug: "manage-an-environment"
abstract: "Describes how to manage environments in the Deploy app."
---
# Manage an environment

An environment represents a single Sitecore Content Management (CM) instance[^UUID-3ceb7d45-3caf-3196-3a9a-f59a9474182a_xmc_cmi] along with all the services and supporting tenants for hosting a Sitecore solution. Every environment belongs to a project[^UUID-3ceb7d45-3caf-3196-3a9a-f59a9474182a_xmc_project].

## Create a new environment

> [!note]
> When you create an environment, it appears as an app in the [Sitecore Cloud Portal](https://doc.sitecore.com/portal/en/developers/sitecore-cloud-portal/introduction-to-the-sitecore-cloud-portal.html).

The total number of projects and environments you can create is based on your subscription. For example, if your subscription has four non-production environments, two production environments, and two projects, you could use them all in one project or spread them across the two projects. You can reallocate these environments between projects as needed. If you need more environments or projects, please contact your Sitecore representative.

When you [create a project in the Deploy app](https://doc.sitecore.com/sai/en/developers/sitecoreai/getting-started-with-sitecoreai/deploy-a-project-and-environment.html "Deploy a project and environment"), it will also create an environment.

To create a new environment in an existing project:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project where you want to create a new environment.
3. On the project page, click **Create environment**.
4. In the **Create environment** dialog, in the **Environment name** field, enter a name for your environment.
5. In the **Is this a production environment?** drop-down menu, choose if you want to create a production or non-production environment.

    > [!note]
    > A production environment is optimized for production traffic and is covered by the [Sitecore SaaS Service Level Agreement](https://www.sitecore.com/legal/sla/saas).

6. In the **Link to branch** drop-down menu, click the repository branch that you want to link to your environment.
7. If you linked your environment to a branch, in the **Auto deploy on push to repository** drop-down menu, choose whether you want to trigger an automatic deployment when you push to the linked repository branch.
8. Click **Create**. A new environment appears.

## Create a build and deploy it to an environment

You can create a new build and deploy it to an environment. If there is manually uploaded source code from the CLI, the build and deployment is based on the current artifacts. If the environment is linked to a repository, the build is based on the latest commits.

To create a build and deploy it to an environment:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment where you want to create a new build and deployment.
3. On the project page, locate the environment where you want to create a new build and deployment. Click **Actions** :mdiDotsHorizontal: > **Build and deploy**.

You can also create a build and deploy it to an environment from the **Deployments** page:

1. In the navigation pane of the Deploy app, click **Deployments**.
2. On the **Deployments** page, click **Create deployment**.
3. In the **Create deployment** dialog, in the **Select project** drop-down menu, choose the project that contains the environment where you want to create a deployment.
4. In the **Select environment** drop-down menu, select the environment where you want to create a deployment, then click **Deploy**.

## Restart an environment

> [!note]
> [Modifying environment variables](https://doc.sitecore.com/sai/en/developers/sitecoreai/deploying-sitecoreai/deploy-app/manage-an-environment/environment-variables/manage-environment-variables-in-the-deploy-app.html "Manage environment variables in the Deploy app") requires a [build and deploy](https://doc.sitecore.com/sai/en/developers/sitecoreai/deploying-sitecoreai/deploy-app/manage-an-environment.html#UUID-e4b70229-154c-fd24-03f8-3098e09d2eec_section-idm1733329911802898 "Create a build and deploy it to an environment") of your environment for the changes to take effect.

To restart an environment:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment you want to restart.
3. On the project page, click **Actions** :mdiDotsHorizontal: > **Restart environment**.
4. In the **Restart environment** dialog, click **Restart**.

## Link an environment to a different branch

If your environment is linked to a repository, when you create a build and deploy it to an environment, the Deploy app uses the code in the linked repository branch of your environment. You can link an environment to a different branch within the same repository.

To link an environment to a different branch:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment you want to link to a different branch.
3. On the project page, click the environment you want to link to a different branch.
4. On the environment page, click **Options** > **Link environment to another branch**.
5. In the **Link environment to another branch** dialog, click the branch that you want, then click **Link**.

> [!note]
> Alternatively, on the environment page click Options > Edit environment details. In the Edit environment details dialog, in the Link to branch drop-down menu, click the branch you want to link to the environment, then click Save.

## Change an environment name

To change the name of an environment:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment you want to change.
3. On the project page, click the environment you want to change.
4. On the environment page, click **Options** > **Edit environment details**.
5. In the **Edit environment details** dialog, in the **Environment name** field, enter the environment name you want, then click **Save**.

## Enable automatic deployment when you push to the linked repository branch

To keep your environment updated with the latest code, you can enable an automatic deployment every time you push to the repository branch linked to your environment.

To enable automatic deployment when you push to your repository branch:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment where you want to enable automatic deployment.
3. On the project page, click the environment you want.
4. On the environment page, click **Options** > **Edit environment details**.
5. In the **Edit environment details** dialog, in the **Auto deploy on push to repository** drop-down menu, click **Yes**, then click **Save**.

> [!note]
> To disable automatic deployment, in the Edit environment details dialog, in the Auto deploy on push to repository drop-down menu, click No, then click Save.

## Delete an environment

To delete an environment:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment you want to delete.
3. On the project page, locate the environment you want to delete, then click **Actions** :mdiDotsHorizontal: > **Delete**.
4. In the **Delete environment** dialog, enter the environment name, then click **Delete**.

## View environment details

From the **Details** tab, you can view environment details, Context IDs, and generate Edge tokens.

To view the details of an environment:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment whose details you want to view.
3. On the project page, click the environment you want.
4. On the environment page, click the **Details** tab.

## View environment logs

> [!note]
> Log files are stored for 90 days. If you need to retain log files for longer than 90 days, you can [download them using the CLI](https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecore-command-line-interface/sitecore-cli-command-reference/the-cli-cloud-command/the-cloud-environment-command.html#UUID-32374c80-d0ca-5780-0826-1b9718cce25c_section-idm4522257056305633198943853045 "The log download subcommand") or from the Deploy app.

From the environment logs page, you can view the Sitecore logs of each environment, including all CM logs and Rendering Host logs.

To view the logs of an environment:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment whose logs you want to view.
3. On the project page, click the environment you want.
4. On the environment page, click **Logs**.

## Open the SitecoreAI dashboard

After you deploy an environment, you can open its dashboard.

To open the dashboard of an environment:

1. On the navigation pane of the Deploy app, click **Projects**.
2. On the **Projects** page, click the project that contains the environment you want to open.
3. On the project page, click the environment you want.
4. On the environment page, click **Options** > **Open dashboard**.

[^UUID-3ceb7d45-3caf-3196-3a9a-f59a9474182a_xmc_cmi]: At the heart of your environment is a *Content Management (CM) instance*. The CM instance is where you create, store, and edit site content; and manage publishing, content modelling, versioning, workflows, translations, rules, and permissions. A content management instance includes your page layouts, components, data source configurations, localization, and personalization settings. You deliver the data from the CM instance to Experience Edge, using GraphQL.

[^UUID-3ceb7d45-3caf-3196-3a9a-f59a9474182a_xmc_project]: A **project** is a logical grouping of environments. Each project can include several environments, such as a development, testing, and production environment. In SitecoreAI, you can create a project using the Deploy app, the CLI, or REST APIs.
    
    When you create a project using the Deploy app, one environment is automatically created, and you can choose whether it’s a production environment (that gets faster support than the non-production environments). The number of projects you can create depends on your subscription.
