Welcome everyone to the Power Guide Mentorship Program.
Today I am going to share #PowerGuideTip12, in which I\’ll share a Tip to Automate the PowerApps Portals or Dynamics CRM Portals Backup using Azure DevOps.
As you already know, Power Apps makers can now create a powerful new type of experience: external-facing websites (PowerApps Portals), that empower anyone either inside or outside your organization to interact with Common Data Service data either anonymously or through commercial authentication providers like LinkedIn, Microsoft, Facebook, and Google, or enterprise providers such as Azure AD B2C, Azure AD, and Okta.
Portal development involves several configurations and customizations to achieve the desired experience for portal end-users. However, one of the most common mistakes that every developer often does is – Forget to take Backup of his/her daily work.
After you have completed the development or configuration of your portal instance, you might want to take backup to save your daily work. Sometimes taking manual Backup of your Portal Configuration is a very time-consuming process.
Today, In this article, I am going to share an automated solution in order to Automate your PowerApps Portal Backup, which will reduce the headache and load of every developer to take the Portal Backup every day manually.
Let\’s get started…
Approach 1 – Portal Configuration Backup using Azure DevOps
Azure DevOps is a Software as a service (SaaS) platform from Microsoft that provides end-to-end components, processes, and various tools for developing and deploying the software. It also integrates with most leading tools on the market which allows you to automate your deployments.
Azure DevOps provides five Azure Services or Components:
Azure Boards: agile planning, work item tracking, visualization, and reporting tool.
Azure Pipelines: a language, platform, and cloud-agnostic CI/CD platform with support for containers or Kubernetes.
Azure Repos: provides cloud-hosted private git repos.
Azure Artifacts: provides integrated package management with support for Maven, npm, Python, and NuGet package feeds from public or private sources.
Azure Test Plans: provides an integrated planned and exploratory testing solution.
Today, I\’ll not deep-dive in explaining Azure DevOps. I\’ll explain this in my further article.
In this article, I\’ll show, how can I automate the Portal Backup using the Azure DevOps services.
- Azure DevOps Subscription. If not, you can create a trial with no expiration validity. Can check here.
- Power DevOps Tools. Can get it from here.
- Configuration Migration Tool. Can download the latest tool from here.
Step 1 – Create Schema File to Export Portal Configuration
You can get the Portal Schema File from here. If it doesn\’t work due to any reason, you can create your own schema file as well for the selected Portal Entities.
Step 2 – Set Up Azure DevOps Configurations
(a) Create a new Project in Azure DevOps (Ignore this step, if you already have an existing project)
(b) Create a new Repository
(c) Create a new Folder inside the Repository (named: Portal Configuration)
(d) Upload Portal Scheme File inside Portal Configuration Folder (Generated from Step 1)
(e) Create a new Pipeline
(f) Install Power DevOps Tools. In my instance, It\’s already installed, hence it\’s showing \’Installed\’ not \’Get It Free\’.
(g) Add the following Tasks in below-mentioned order
- Task 1 – Power DevOps Tool Installer
- Task 2 – Ping Environment
- Task 3 – Export Configuration Migration Data
- Task 4 – Publish Build Artifacts
- Task 5 – Extract Configuration Migration Data
- Task 6 – Publish Build Artifacts
(h) Change the default Build Number Format to Today\’s Date.
By default, Build Number shows a unique integer number for each running job like – #55, #56, #57, and so on. However, for readability purposes and find the Portal backup of a specific date, I have used the Build Job date as the Build number.
(i) Schedule the Pipeline (Job).
I have scheduled the Job to run at 10:00 PM Monday to Friday. We can configure it as per our need.
Step 3 – Run and Test
|Email Confirmation on Portal Backup Job Completion|
- In this demonstration, I have used only Build Pipeline (CI) in Azure DevOps in order to take the Portal Backup and storing it in Build Artifacts. If you want to deploy/migrate/import this data to Target CRM instance, you can create a Release Pipeline (CD), which will pick the package from the Build Artifacts and Import it in Target Instance.
- Keep the Portal Backup CI Pipeline separate from your actual Build CI pipeline.
- If your organization is not allowed to use Power DevOps Tools, You can write your own PowerShell Scripts to perform all the above-mentioned tasks.
- Microsoft is also adding new Tasks in Power Build Tools. Hence in the future, you can also use, Microsoft\’s Power Build Tools to perform the same tasks that we have done using Power DevOps Tools.
- This process takes the export of Complete Portal Configuration like changes made in the webpage, entity list, entity form, web template, etc, however, if you want to take the backup of CRM Customization as well, then you can add other tasks like Export Solution, Extract Solution using the same tool.
- If you do not want to take the backup of whole portal configurations (all entities), you can create/modify the schema file and can only include most used portal entities like Web Pages, Web Templates, Entity Forms, etc
- To view the backup of your Portal Configuration, you need to open the Pipeline Job (Open the Build Pipeline > Go to Job Run > Click to Open the Job > Click on Artifacts) of a specific date or you can check it on your email. For Example: If I want to get the Backup of Portal Configuration taken on 24/05/2020, I need to open the Portal Backup Pipeline Job of 24_05_2020. That\’s why I have modified the Build Number format to Date Format so that developer can easily find/search the backup by backup date.
Because Configuration Migration Tool gives the XML File (data.zip) of the Portal Configuration, and it\’s very hard to get/read the HTML/jquery/liquid template code from that file.
Approach 2 – Portal Custom Code Backup using Power Automate
In my next article, I\’ll share the #PowerGuideTip13 – To Automate the Portal Code backup using Power Automate.