# Advanced Setup: Deployment options

This provides control over the CI/CD deployment process within the isolated instance before your code is pushed to the Cloud environment.

## Skip preserving `umbraco-cloud.json`

The Umbraco Cloud platform controls the `umbraco-cloud.json` file. It holds a description of the environment relationships used for content deployments. The configuration needed to be able to log in to the backoffice locally with Umbraco ID is also part of this file.

The CI/CD deployment system ensures that the current JSON file in the cloud environment is preserved.

In edge cases, users might need to supply their own `umbraco-cloud.json` to the system and overwrite the one on the cloud.

Enabling the `skipPreserveUmbracoCloudJson` option allows users to overwrite the `umbraco-cloud.json` through CI/CD Flow.

{% hint style="warning" %}
It is not recommended to edit or add values to the `umbraco-cloud.json` file. Use the appropriate `appSettings.*.json` file instead, or add secrets through the Secrets Management page in the Cloud Portal. The cloud platform uses `umbraco-cloud.json` to update environment relationships when adding or removing environments.
{% endhint %}

## Skip version checks

During deployment, the system automatically checks for downgrades of Cloud dependencies. This prevents accidental downgrades of packages that may have been automatically upgraded on Umbraco Cloud.

Enabling the `skipVersionCheck` option will allow deployments that include downgraded packages.

{% hint style="info" %}
This option increases risk and is not recommended for normal workflows. Do not skip the version checks unless you understand the package differences and accept the potential consequences.
{% endhint %}

## Skip build and restore steps

The Umbraco CI/CD flow runs the deployment in an isolated instance and performs `dotnet restore` and `dotnet build` to catch obvious build issues before deploying to the Cloud.

Enabling the `noBuildAndRestore` option skips the restore and build steps in that isolated instance, which can shorten deployment time by a few minutes.

Keep in mind that the final Kudu deployment on the Cloud environment will still run **restore**, **build**, and **publish**; those steps cannot be skipped.

## Disable schema extraction

When deploying schema changes to environments beyond "left-most", the CI/CD Flow deployment system will automatically run a schema extraction.

Setting `runSchemaExtraction` to false, will result in the system not automatically running the schema extraction on the environment. [You can still run schema extractions manually](https://docs.umbraco.com/umbraco-cloud/optimize-and-maintain-your-site/monitor-and-troubleshoot/power-tools/manual-extractions).

{% hint style="info" %}
This setting doesn't have any effect on the `left-most environment`.
{% endhint %}

## How to enable the options

While pipeline scripts follow the same structure, there are a few small details to be aware of.

{% tabs %}
{% tab title="Azure DevOps Bash" %}
Locate the main entry pipeline file. It will usually be this one: `azure-release-pipeline.yaml`.

```yml
  # Deploy to Umbraco Cloud
  # ####
  # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson,
  # and runSchemaExtraction
  # use booleans but as strings
  - stage: CloudDeploymentStage
    displayName: Deploy To Cloud
    dependsOn: cloudPrepareArtifact
    condition: in(dependencies.cloudPrepareArtifact.result, 'Succeeded')
    variables:
      artifactId: $[ stageDependencies.cloudPrepareArtifact.PrepareAndUploadArtifact.outputs['uploadArtifact.artifactId'] ]
    jobs: 
      - template: cloud-deployment.yml
        parameters:
          artifactId: $(artifactId)
          skipPreserveUmbracoCloudJson: 'false'
          noBuildAndRestore: 'false'
          skipVersionCheck: 'false'
          runSchemaExtraction: 'true'
```

The `skipPreserveUmbracoCloudJson`, `noBuildAndRestore` and `skipVersionCheck` options can be enabled by changing the value to `'true'`. The `runSchemaExtraction` can be disabled by changing the value to `'false'`.
{% endtab %}

{% tab title="Azure DevOps PowerShell" %}
Locate the main entry pipeline file. It will usually be this one: `azure-release-pipeline.yaml`.

```yml
  # Deploy to Umbraco Cloud
  # ####
  # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson,
  # and runSchemaExtraction   
  # use booleans
  - stage: CloudDeploymentStage
    displayName: Deploy To Cloud
    dependsOn: cloudPrepareArtifact
    condition: in(dependencies.cloudPrepareArtifact.result, 'Succeeded')
    variables:
      artifactId: $[ stageDependencies.cloudPrepareArtifact.PrepareAndUploadArtifact.outputs['uploadArtifact.artifactId'] ]
    jobs: 
      - template: cloud-deployment.yml
        parameters:
          artifactId: $(artifactId)
          skipPreserveUmbracoCloudJson: false
          noBuildAndRestore: false
          skipVersionCheck: false
          runSchemaExtraction: true
```

The `skipPreserveUmbracoCloudJson`, `noBuildAndRestore` and `skipVersionCheck` options can be enabled by changing the value to `true`. The `runSchemaExtraction` can be disabled by changing the value to `false`.
{% endtab %}

{% tab title="GitHub Actions Bash" %}
Locate the main entry pipeline file. It will usually be this one: `main.yml`.

```yml
  # Deploy to Umbraco Cloud
  # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson,
  # and runSchemaExtraction  
  # use booleans but as strings
  cloud-deployment:
    name: "Deploy to Cloud"
    needs: cloud-artifact
    uses: ./.github/workflows/cloud-deployment.yml
    with:
      artifactId: ${{ needs.cloud-artifact.outputs.artifactId }}
      targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }}
      skipPreserveUmbracoCloudJson: "false"
      noBuildAndRestore: "false"
      skipVersionCheck: "false"
      runSchemaExtraction: "true"
    secrets:
      projectId: ${{ secrets.PROJECT_ID }}
      umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }}
```

The `skipPreserveUmbracoCloudJson`, `noBuildAndRestore` and `skipVersionCheck` options can be enabled by changing the value to `"true"`. The `runSchemaExtraction` can be disabled by changing the value to `"false"`.
{% endtab %}

{% tab title="GitHub Actions PowerShell" %}
Locate the main entry pipeline file. It will usually be this one: `main.yml`.

```yml
  # Deploy to Umbraco Cloud
  # ####
  # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson,
  # and runSchemaExtraction 
  # use 0 for false and 1 for true
  cloud-deployment:
    name: "Deploy to Cloud"
    needs: cloud-artifact
    uses: ./.github/workflows/cloud-deployment.yml
    with:
      artifactId: ${{ needs.cloud-artifact.outputs.artifactId }}
      targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }}
      skipPreserveUmbracoCloudJson: 0
      noBuildAndRestore: 0
      skipVersionCheck: 0
      runSchemaExtraction: 1
    secrets:
      projectId: ${{ secrets.PROJECT_ID }}
      umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }}
```

The `skipPreserveUmbracoCloudJson`, `noBuildAndRestore` and `skipVersionCheck` options can be enabled by changing the value to `1`. The `runSchemaExtraction` can be disabled by changing the value to `0`.
{% endtab %}
{% endtabs %}

## Use the latest scripts

The sample scripts are updated to include these extra options. If you need to update, you do not have to update everything; only the following scripts have been updated:

| PowerShell files       | Bash files            |
| ---------------------- | --------------------- |
| `Start-Deployment.ps1` | `start_deployment.sh` |

The following pipeline files are also updated. Remember to get the right files from either `V2/bash` or `V2/powershell` depending on what you are currently using.

| GitHub                  | Azure DevOps                               |
| ----------------------- | ------------------------------------------ |
| `cloud-deployment.yml`  | `cloud-deployment.yml`                     |
| `main.yml`              | `azure-release-pipeline.yaml`              |
| `main-more-targets.yml` | `azure-release-pipeline-more-targets.yaml` |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.umbraco.com/umbraco-cloud/build-and-customize-your-solution/handle-deployments-and-environments/umbraco-cicd/samplecicdpipeline/advanced-deployment-options.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
