---
title: Deploy code and data changes
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

## Deploy new code to an existing published application

You will have to take a different approach for deploying new code to an existing published project depending on whether or not you [configured external storage](https://docs.kentico.com/modules/private-cloud-deployment/deploy-xperience-with-cli.md#configure-external-storage).

If you've configured external storage according to our recommendations, you should be able to clear the existing deployment and re-deploy with the same steps as the initial deployment- first [publish](https://docs.kentico.com/modules/private-cloud-deployment/deploy-xperience-with-cli.md#create-a-publishable-package) your application and then deploy the published files according to your platform.

> **Tip:** If you host your app in an _Azure Web App_, you can use the `--clean` parameter of the `az webapp deploy` command to clear out the deployment slot before you do anything.
>
> If you use IIS, we recommend creating a reusable script that clears out the deployment location and copies the publishable files.

> **Warning:** **If you do not use external storage**, you'll need to copy _asset files_, _media files_, and _form submission files_ to a safe location before clearing the existing deployment, then copy them back after deployment.
>
> Otherwise, **they may be lost permanently**.
>
> We recommend creating a script to automate this process.

## Deploy new data to an existing published application

### Standard Continuous Deployment

In some cases, you may want to create some data in your development environment and deploy it to the published environment. For example, you might create a custom module, which contains classes and class data alongside code.

We recommend using **Continuous deployment (CD)** to keep the data in sync between your environments. You can follow the guidance in the [Continuous Deployment documentation](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/continuous-deployment.md).

### Deploy only selected data

If your development environment and your published environment hold different data, limit the scope of Continuous Deployment. This way, a restore can't overwrite or delete data that exists only in the published environment:

- Store your changes with a dedicated CD configuration file that lists only the object types, content types, and individual objects or content items of your change. The [repository configuration templates](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories/repository-configuration-templates.md) give you starters for common scenarios, such as deploying specific content item data or object type changes.
- Set a restrictive [restore mode](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories.md#configure-cd-restore-mode). The `Create` mode only adds new objects and never modifies or deletes existing ones. The `CreateUpdate` mode never deletes objects missing from the repository.

For content that editors create and maintain, such as reusable content items, pages, and forms, consider [content sync](https://docs.kentico.com/documentation/business-users/content-sync.md), which transfers selected content from one instance to another. For setup instructions, see [Content sync configuration](https://docs.kentico.com/documentation/developers-and-admins/configuration/content-sync-configuration.md).
