Ever deployed a solution to an environment manually or using build tools and caused a bit of a catastrophe in doing so with changes the deployment makes? Perhaps, you deleted a column of data or table in development somehow, and deployed those changes resulting in a loss of your data? Well I’m here with a post to resolve those scenarios!
In the latest part of my wider series on the Power Platform developer tools we’ve been talking about using the Power Platform Build Tools to automate various tasks around application lifecycle management. In this post, we’re going to make the addition to this part of the series of looking at some build tools tasks around environment lifecycle management. I’ll be showing you how to automate environment backups as part of a release pipeline as the very first step before making an environment change by completing a deployment.
Release pipeline
So first let’s take a look at a release pipeline I’ve got. In my last three posts we looked at the following…
- Creating build pipelines for working with Power Platform solutions
- Creating release pipelines for deploying Power Platform solutions
- Using a deployment settings file to replace connection reference connections, and to populate environment variable values on deployment during a release
We’re going to take a look at the release pipeline I created for the solution in the posts above, and add an environment backup into this release pipeline as the first task to be completed.
So here is my release pipeline with two stages in it for me to deploy to two different environments.
I’m going to step into the tasks for the build stage first, and then I’ll apply the same changes to the rest of the stages later. For now lets look at the changes I’ll need to make to my build environment.
At the moment my stage this is what I’m working with. Simply just a task to import my solution to the environment which utilises a deployment settings file.
I’m now going to add a new task in, in-between the Power Platform Tool Installer task, and the Import Solution task. I need to always add any Power Platform Build Tools tasks in following the tool installer task, and the task I want to do must happen before I make any changes to the environment by importing a solution.
So now I’m going to add the Power Platform Backup Environment task in, after the tool installer task.
So I’ve now added in my task, all I need to do here is set the authentication type to service principal and then utilise the service connection relevant to the environment this stage does a deployment to.
Now I’m going to save my release pipeline and give it a run, to see what happens!
So, to start with, we have a successful pipeline run!
Not only that, if I take a look at my environment in the Power Platform admin center, I’ve got my backup there just in case something didn’t go quite right with my deployment 🙂
Now you have a backup taken just before deployments for any cases where a deployment didn’t go completely right! What an easy way to roll back 💖🚀
Upcoming content
So! We’re not done with this content yet. I’ve still got more posts coming on the Power Platform Build Tools and much more as part of this wider series on the Power Platform Developer Tools!
Make sure you’re subscribed so you don’t miss a thing, and instead, my posts get delivered to your inbox on a daily basis, throughout this year as part of my challenge to complete #365PostsIn365Days! 📩
Subscribe