# Migrate a Sitefinity CMS project to Sitefinity Cloud

## Procedure

Existing Sitefinity CMS projects that are hosted on-premises can be migrated to Sitefinity Cloud. To do this, you must have the [Developer Extensions](https://www.progress.com/documentation/sitefinity-cms/cloud/platform-overview/developer-extensions--sitefinity-cloud-paas-) toggle enabled for your Sitefinity Cloud setup and must complete the following steps:

### 1. Upgrade to the latest supported version

To migrate your Sitefinity CMS self-hosted project to Sitefinity Cloud, your project **must be** on one of the two latest versions or on the latest LTS version.\
For more information about upgrading Sitefinity CMS, see [Upgrade Sitefinity CMS](https://www.progress.com/documentation/sitefinity-cms/upgrade).

### 2. Turn on Auto storage mode for configurations

For more information, see [Auto-storage mode of configurations](https://www.progress.com/documentation/sitefinity-cms/auto-storage-mode-of-configurations#turn-on-auto-storage-mode-of-configurations).

### 3. Enable Multisite

In Sitefinity Cloud, all the projects must use multisite. You must have the *Multisite* module activated.

> info **NOTE**: Sitefinity CMS unifies single-site and multisite modes and allows you to seamlessly manage transitions from single-site to multisite, without changes in the end-user experience.
> In case you need to combine more than one Sitefinity single-site projects in one multisite project, see [Migrate a single site to multisite with Site Sync](https://www.progress.com/documentation/sitefinity-cms/migrate-a-single-site-to-a-multisite-instance).

### 4. Migrate media libraries to Database storage

Sitefinity CMS supports multiple storage providers for media libraries. For more information, see [Storage providers for libraries](https://www.progress.com/documentation/sitefinity-cms/storage-providers-for-libraries).

To move a media library to a different storage provider, perform the following:

1. In your Sitefinity CMS backend, navigate to *Content* » *Documents & Files* (or *Images* / *Videos* depending on the library type).
2. On the *Documents* page, expand the *Actions* menu of the library that you want to move to another storage and click *Library properties*.\
   The *Library properties* page opens.
3. Under *Storage provider*, select a storage provider where you want to move the library.

   > info **NOTE**: If you are using *File System* as a storage provider for your media libraries, change the storage provider of the library to *Database*.\
   > If you are using an external storage provider for your media libraries, optionally move the library to *Database*. If you intend to use external storage providers with the Sitefinity Cloud setup, leave the external storage provider as is.
4. Click *Save changes*.

### 5. Install Sitefinity Cloud NuGet package

Install the [Progress.Sitefinity.Cloud](https://www.nuget.org/packages/Progress.Sitefinity.Cloud) NuGet package in your project.
This will automatically install all dependencies.

You need to consider the following version compatibility mapping:

 <table>
    <tbody>
        <tr>
            <td><strong>Progress.Sitefinity.Cloud package version</strong></td>
            <td><strong>Minimum required Sitefinity CMS version</strong></td>
        </tr>
        <tr>
            <td>1.4.7</td>
            <td>14.4.8135<br>
            </td>
        </tr>
        <tr>
            <td>1.4.8</td>
            <td>14.4.8135</td>
        </tr>
        <tr>
            <td>1.4.9</td>
            <td>15.0.8227</td>
        </tr>
        <tr>
            <td>1.4.10</td>
            <td>15.0.8227</td>
        </tr>
        <tr>
            <td>1.5.0</td>
            <td>15.2.8426</td>
        </tr>
        <tr>
            <td>1.5.1</td>
            <td>15.2.8426</td>
        </tr>
        <tr>
            <td>1.5.2</td>
            <td>15.2.8426</td>
        </tr>
        <tr>
            <td>1.5.3</td>
            <td>15.2.8426</td>
        </tr>
        <tr>
            <td>1.5.4</td>
            <td>15.2.8426</td>
        </tr>
    </tbody>
</table>

### 6. Add Microsoft Entra ID (formerly Azure AD) authentication support

To enable integrated Microsoft Entra ID authentication, add the following configuration to the `~/AppData/Sitefinity/Configuration/AuthenticationConfig.config` file:

```xml
<relyingPartySettings additionalScopes="ADGroups">
</relyingPartySettings>
<securityTokenServiceSettings>
    <authenticationProviders>
        <add name="OpenIDConnect" config:flags="1">
            <ClaimsMap>
               <remove field="SitefinityProfile.LastName" />
               <add claim="name" field="SitefinityProfile.FirstName" config:flags="1" />
            </ClaimsMap>
        </add>
    </authenticationProviders>
</securityTokenServiceSettings>
```

### 7. Manage configurations across different environments

Your Sitefinity Cloud website is configured in a Continuous Delivery (CD) pipeline setup. This way, code changes are deployed to non-Production environments like *Staging* first, and then to *Production*. In this setup, the code base does not change, but your website configurations may need to vary to reflect different environment settings, such as connection strings and SMTP settings. To facilitate these needs, Sitefinity Cloud offers different options for managing configurations, which can be used in conjunction with one another.

For more information about using these options, see [Manage the configurations](https://www.progress.com/documentation/sitefinity-cms/cloud/develop-and-deploy/manage-the-configurations).

### 8. Configure crawlers

1. To prevent crawlers from crawling the site on non-Production environments, add the following setting to the `web.config` file:

```xml
<system.webServer>
...
    <httpProtocol>
        <customHeaders>
           <add name="x-robots-tag" value="noindex, nofollow" />
        </customHeaders>
    </httpProtocol>
...
</system.webServer>
```

2. To enable crawlers to crawl the site on *Production*, add the following to the `web.Production.config` transformation file:

```xml
<system.webServer>
    <httpProtocol>
        <customHeaders>
            <add name="x-robots-tag" xdt:Locator="Match(name)" xdt:Transform="Remove" />
        </customHeaders>
    </httpProtocol>
</system.webServer>
```

### 9. Configure the WebSecurity module

Add the following configuration:

1. In Sitefinity CMS backend, navigate to *Administration » Modules & Services* and enable the *WebSecurity* module.
2. Ensure the following configuration is added to the `WebSecurityConfig.config` file:

```xml
<webSecurityConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type">
   <redirectValidation trustedLocations="https://login.microsoftonline.com" />
   <cookiesProtector enable="False" />
</webSecurityConfig>
```

3. Ensure all the needed scripts used in your project are not blocked in the *WebSecurity* module configuration.

### 10. Verify the deployment package

In a Continuous Delivery process, every deployment to a Sitefinity Cloud environment uses a package created through an automated build process.

You can verify the package that will be deployed to Sitefinity Cloud by manually generating a deployment package on your local machine. To do this, follow the steps:

1. Open the Developer Command Prompt of Visual Studio.
2. Navigate to your solution folder.
3. Run the following MSBuild command:\
   `C:\MySolutionFolder>msbuild MySolution.sln /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:AutoParameterizationWebConfigConnectionStrings=False /p:TransformWebConfigEnabled=False /p:MarkWebConfigAssistFilesAsExclude=false /p:PackageTempRootDir="" /p:PackageLocation="C:\BuildPackageFolder"`

> info **NOTE**: If you notice that certain files (such as configuration files or static resources) are missing from the generated package, they may not be included in your project configuration.\
> Unlike a standard build process, which compiles only source code files, the packaging process includes only the files explicitly specified in the `.csproj` file.

### 11. Ensure that the project uses relative URLs

When you build a URL in your code, make sure that it uses a relative path and not an absolute one, because this may lead to rendering an incorrect domain on the site.
