---
title: Deploy a new CMS site
slug: dxp/docs/creating-a-new-cms-site-and-deploying
docTags: 
createdAt: 2026-07-30T20:33:07.109Z
---

## When is this applicable?

This is an onboarding scenario for a **first-time/onboarding deployment of a new site based on the Optimizely sample templates**, to use from start for development in a cloud environment. A new site like this does not require database restore, and the database schema is created during initial deployment.

## Before you start

This example uses deployment API to publish code.

- See [DXP requirements](https://docs.developers.optimizely.com/digital-experience-platform/docs/requirements) for recommended software versions, tools, and services when deploying.
- See [Get started with DXP](https://docs.developers.optimizely.com/digital-experience-platform/docs/getting-started-with-dxp) for deployment information.
- See [Install Optimizely](https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/installing-optimizely-legacy-cms-11-and-commerce-13) for instructions on how to add the Optimizely NuGet feed to Visual Studio.
- Before deploying, add a wildcard binding to the site in the Manage Websites screen. This will help prevent failures due to URL-dependent code when migrating the database between environments. The following image shows an example of wildcard binding.
  a. Go to **Admin > Config > Manage Websites**.
  b. Click **Add** and add a wildcard (\*) Host Name.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/qWWCYMRwKIH-dBSiUTZiW_68cc4af96fd78ae9db1b6f3c344e52766041c2a4a4175f855588ee73d784c4fc-image.png)

## Deployment steps

The following steps create a website, add Azure and Search & Navigation (formerly called Find), and deploy the code and database with content to the *Integration* environment in DXP. The deployment uses the publishing profiles provided by Optimizely with your DXP setup.

:::hint{type="info"}
**Note**

Optimizely has a bootstrap feature for deploying content. If there is an export package located in `\App_Data\DefaultSiteContent.episerverdata`, the bootstrap feature imports that package during initialization and creates a site with content. The bootstrap is applied only if the site in the web app does not have any existing content.
:::

### Step 1 – Create an Optimizely project

Follow the steps in [Create a starter project](https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/creating-a-starter-project).

```powershell
dotnet new epi-cms-empty
```

1. Go to **Tools > NuGet Package Manager > Manage NuGet Packages for Solution** to update the website to the latest Optimizely NuGet packages.
2. In the NuGet Package manager:
   1. Select **Updates**.
   2. Select **Optimizely Packages** in the **Package source** field to locate the latest updates.
   3. Enable **Select all packages**.
   4. Click **Update** and confirm the updates.

![Update NuGet packages](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/vwd12EIo6_PTdENdG4sQV-20260722-203650.png "update-packages.png")

3. Add a cloud platform to the website. In the NuGet package manager:
   1. Select **Browse**.
   2. Enter **Optimizely Azure** in the search field.
   3. Select the `EPiServer.CloudPlatform.Cms` package.
   4. Select your project.
   5. Click **Install** and confirm the installation.

![Confirm the installation](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/12MtBJvlAyQsYabtOuthG-20260722-203650.png "imagejtvs.png")

4. To configure the `EPiServer.CloudPlatform.Cms` package, add this code in `ConfigureServices` method in `startup.cs` file.

```csharp
public class Startup
{
    private readonly IWebHostEnvironment _webHostingEnvironment;
    private readonly IConfiguration _configuration;

    public Startup(IWebHostEnvironment webHostingEnvironment, IConfiguration configuration)
    {
        _webHostingEnvironment = webHostingEnvironment;
        _configuration = configuration;
    }

    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddCmsCloudPlatformSupport(_configuration);
    }
}
```

:::hint{type="info"}
**Note**

If you only want to add the `EPiServer.CloudPlatform.Cms` package to specific environments, you can run something similar to the following code to check the environment.
:::

```csharp
public class Startup 
{ 
    private readonly IWebHostEnvironment _webHostingEnvironment; 
    private readonly IConfiguration _configuration; 
 
    public Startup(IWebHostEnvironment webHostingEnvironment, IConfiguration configuration) { 
        _webHostingEnvironment = webHostingEnvironment; 
        _configuration = configuration; 
    } 
 
    public void ConfigureServices(IServiceCollection services){ 
       ...        
        if (!_webHostingEnvironment.IsDevelopment()) { 
            services.AddCmsCloudPlatformSupport(_configuration); 
        } 
    } 
}
```

5. Add required header scripts to Razor view before the closing of `</head>` tag.

```csharp
@Html.RequiredClientResources("Header")
```

:::hint{type="info"}
**Note**

Optimizely recommends this step to make Azure Application Insights works for front-end pages.
If you are not using Razor to render views or are unable to add Header required resources, please manually add Application Insights JS SDK initialization script following [Microsoft's guide here](https://learn.microsoft.com/en-us/azure/azure-monitor/app/javascript-sdk#add-the-code-snippet).
Retrieve the Application Insights instrumentation key from the `APPINSIGHTS_INSTRUMENTATIONKEY` environment variable.
:::

6. Run the solution.

### Step 2  – Publish the website to create a code package

:::hint{type="info"}
**Note**

You can replace steps 1 through 4 with the following command in PowerShell. This creates a publish folder in  the `\bin\release` folder that could be zipped up and renamed to `ProjectName.cms.app.00001.nupkg`. See [dotnet publish command - .NET CLI](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish).
:::

```powershell
dotnet publish -c Release
```

1. In Solution Explorer, right-click the project in Visual Studio and select **Publish**.
2. In the **Pick a publish target** dialog box, select **New Folder**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/CIY44Wa-zwXy6MMmHG7Rx-20260722-203650.png)

3. Click **Next**.
4. Choose a location or keep the default.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/BkqKMXSBU2yV8mA1bYg9p_f0839cf6c40a68902fa9691b407e3ef4782d0700de31f14d7ae130d13b5d3278-image.png)

5. Click **Finish**.
6. Zip the contents of the publish directory and rename to `ProjectName.cms.app.00001.nupkg`.

### Step 3 – Deploy the package

Get API credentials. See [Deployment API authentication](https://docs.developers.optimizely.com/digital-experience-platform/docs/authentication).

:::hint{type="info"}
**Note**

If not already installed, install the `Epicloud` and `Azure.Storage` modules, then import the modules to your session. In PowerShell, run these commands.
:::

```powershell
Install-Module -Name EpiCloud
Install-Module -Name Azure.Storage -Scope CurrentUser -Repository PSGallery -Force -AllowClobber
Import-Module Azure.Storage
Import-Module EpiCloud
```

The following sample uses PowerShell to deploy the code. Any deployment API method will work as long as you deploy a package.

```powershell
# Connect EpiCloud using credentials from portal
Connect-EpiCloud -ProjectId "projectId" -ClientKey "key" -ClientSecret "secret"


# Upload .NET Core Alloy to blob storage
$sasUrl = Get-EpiDeploymentPackageLocation
Add-EpiDeploymentPackage -SasUrl $sasUrl -Path .\AlloyNetCore.cms.app.0.1.0.nupkg


# Deploy package to environment. This will first build a docker image out of the package and then deploy it to the target environment.
Start-EpiDeployment -DeploymentPackage "AlloyNetCore.cms.app.0.1.0.nupkg" -TargetEnvironment "Integration" -DirectDeploy -Wait
```

### Step 4 – Verify the website

1. Go to the default access URLs for the environment, for example `http://[projectNNNNinte].dxcloud.episerver.net`.
2. Log in as an administrator to the website.
3. Verify that the website is working.

### Step 5 – Add Search & Navigation

An index is automatically set up and configured as part of DXP. In this step, you add Optimizely Search & Navigation (formerly Find) as the default search for your solution and publish the changes to Integration.

1. In the NuGet package manager for your project, locate the `EPiServer.Find.Cms` package and click **Install**.

![In the NuGet package manager for your project, locate the EPiServer.Find.Cms package and click Install](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/eKLaq_qKgqExQLUUXCd3c-20260722-203650.png "add-find.png")

2. Right-click the project in Visual Studio's Solution Explorer and select **Publish**.

:::hint{type="warning"}
**Caution**

In the **Edit > Publish > Settings** screen, ensure that **Update database** is *not* selected (deselect if needed).
:::

3. Click **Publish**.
4. Verify that the website is working.

## Related topics

- [Install Optimizely (ASP.NET Core)](https://docs.developers.optimizely.com/content-management-system/docs/installing-optimizely-net-5)
- [Install Optimizely (CMS 11 and Commerce (PaaS) 13](https://docs.developers.optimizely.com/content-management-system/v11.0.0-cms/docs/installing-optimizely-legacy-cms-11-and-commerce-13)
- [Install Optimizely updates (CMS 11 and Commerce (PaaS) 13)](https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/installing-optimizely-updates-cms-11-and-commerce-13)
- [Deploy an existing CMS site](https://docs.developers.optimizely.com/digital-experience-platform/docs/deploying-an-existing-cms-site)
