Skip to main content

Notifications

Announcements

No record found.

Solution Rollback in Dataverse

In Power Platform, a solution rollback process is a set of steps that allows you to undo a solution deployment. This is often used when a hotfix cannot be deployed in an acceptable time frame to the business.

If you are using Power Platform pipelines, this can be achieved by simply redeploying a previous run, as described here .

If you are not using Power Platform pipelines and/or have been trying to achieve the same result in the last years, you might be familiar with the error message below preventing you from importing a lower version of a solution.



The workaround would then be to either repackage the older version as a higher version (which can be achieved in source control), or simply change the solution.xml file to a higher version (an unsupported approach).

The good news is that these workarounds are no longer necessary, as Power Platform Command Line Interface (PAC CLI) does not have the same limitation as the UI on importing older versions of the same solution. Below are the steps to do this operation.

Requirements:
  • Install PAC CLI (Microsoft Power Platform CLI - Power Platform | Microsoft Learn).
  • Visual Studio Code.
  • Access to a Dataverse environment.
  • Privileges to import solutions in the target environment (System Administrator or System Customizer work).
  • Managed solution in a target environment and the file of an older version of the same managed solution.
Steps:
  1. After installing PAC CLI, create a new Terminal in Visual Studio Code by going to Terminal > New Terminal

  2. The first step is to authenticate to the correct environment:
    1. pac auth list - this will provide with a list of available authentications

    2. pac auth create - this will open an authentication window to create a new authentication if none exists.

    3. pac auth select --index X - this will set the authentication with Index X as active.

  3. Once authenticated, run the following command to import the solution to the target environment:

    pac solution import --environment <URL_TARGET_ENVIRONMENT> --path <PATH_TO_OLDER_SOLUTION_FILE> --stage-and-upgrade

  4. Once the command finishes the solution will have been rolled back to the previous version.
Note that if you have an automation setup and want to prevent older versions of solutions from being imported (just like when importing manually through the UI) then you can add the parameter --skip-lower-version.

IMPORTANT: The parameter stage-and-upgrade is critical for a reliable rollback, as otherwise the import will perform an Update operation, which will not remove the new components on the solution being rolled back. Additionally, this will highly likely lead to a mismatch between the rollbacked solution and its version in source control.

As you are doing an upgrade, the rollback will be complete. Not only will changes to components be reverted, but added components (Tables, Columns, etc.) will be removed.

You can find more information on the commands used above in: Microsoft Power Platform CLI Command Groups - Power Platform | Microsoft Learn .

Comments