Adventures with Power Platform: Deployment Struggles

I recently encountered an error ☠️ deploying a solution with the in-product Power Platform Pipelines:

What was the error?

ImportAsHolding failed with exception :Workflow uninstall: FAILURE, workflow id 68d10fa8-ce13-f011-998a-000d3a58f84e category ModernFlow name Scratch 1 Flow 4 (Instant)

Super helpful error message! 🆘

Let’s look at my solution, not the actual one I was working, but one the replicates the problem.

Figure 1 – Solution

The solution include five Power Automate flows.

✔️ Scratch 1 Flow 1 (Instant) – Flow with Manually trigger a flow trigger and a Compose action.

✔️ Scratch 1 Flow 2 (Instant) – Flow with Manually trigger a flow trigger, a Run a Child Flow action that calls Scratch 1 Flow 3 (Instant) and a Compose action.

Figure 2 – Scratch 1 Flow 2 (Instant)

✔️ Scratch 1 Flow 3 (Instant) – Flow with Manually trigger a flow trigger and a Respond to a Power App or flow action.

Figure 3 – Scratch 1 Flow 3 (Instant)

✔️ Scratch 1 Flow 4 (Instant) – Same as Scratch 1 Flow 3 (Instant).

✔️ Scratch 1 Flow 5 (Instant) – Same as Scratch 1 Flow 2 (Instant) except the Run a Child Flow action calls Scratch 1 Flow 4 (Instant).

Like most projects, requirements change!

I no longer needed the last two flows, Scratch 1 Flow 4 (Instant) and Scratch 1 Flow 5 (Instant), so I removed them from the solution.

I never delete 🗑️ them until I am sure the deployment has been successful.

Figure 4 – Solution with removed flows

I clicked Pipelines and Deploy here.

After the approval ✔️ and a few minutes ⌚, I received the ImportAsHolding failed with exception... error.

Figure 5 – Deployment error

Ugh! What happened?! 🤔

I took a peek at the Operation details, see if anything in there jumped out at me. 👻

Not the most pleasurable of experiences, but I eventually stumbled on a clue, Microsoft.Crm.CrmException: The Workflow(68d10fa8-ce13-f011-998a-000d3a58f84e) component cannot be deleted because it is referenced by 1 other components.

Hmmm. 🤔

I would have thought it would look at dependencies and deleted them in the proper order, for example, in my solution, delete Scratch 1 Flow 5 (Instant) first and then delete Scratch 1 Flow 4 (Instant).

But it didn’t.

To get these flows deleted in the target environment, I first had to add Scratch 1 Flow 5 (Instant) back to my solution and then redeployed.

This time the deployment was successful, and Scratch 1 Flow 5 (Instant) was deleted from the target environment. 🥳

I then removed Scratch 1 Flow 4 (Instant) from my solution and redeployed, again success, with Scratch 1 Flow 4 (Instant) no longer in the target environment. 🥳

Figure 6 – Successful deployment in production environment

Apparently, deletions occur in the order they show in the manifest.

The next time you want to delete components from your solution and redeploy, be mindful of dependencies!

My recommendation, remove the components from the solution, not delete, so that if you do encounter any dependency challenges you can add them back to the source solution.

It may take multiple deployments to get all the components removed from the target environment, but this seems to be the only way to do it.

Hopefully this will be addressed in some future update! 🤲


Discover more from Matt Ruma

Subscribe to get the latest posts sent to your email.

Leave a Reply

Your email address will not be published. Required fields are marked *