How to Deploy PowerApps Solutions Using Azure DevOps

Introduction

In the evolving landscape of application development, agility and automation are key. For those navigating the Power Platform universe, the question often arises: How can we automate the deployment of PowerApps solutions to enhance efficiency and reliability? Enter Azure DevOps – Microsoft’s suite of DevOps tools that support building and releasing software through a plethora of automated pipelines. 

In this insightful blog, we’re diving into the deployment of power apps using Azure DevOps. We’ll demonstrate the simplicity of utilizing Power Platform Build Tools in constructing and managing build and release pipelines that automate your PowerApps deployments. This is not just about automation, but also about adopting a DevOps mindset to bring more rigor and consistency to your deployment processes.

Source Control

In any basic DevOps process, we must first ask where our source of truth is. The same applies to Dynamics 365 PowerApps solutions. Can our DEV environment be wiped and provisioned again?

For that to happen, our solution must be in a repo in DevOps, so let’s see how we can do that.

Learn more about our DevOps Services.

Pre-Requisites

  1. Azure DevOps 
  2. Power Platform Build Tools Power Platform Build Tools (1.0.41) – Visual Studio Marketplace 
  3. Multiple Dynamics 365 PowerApps instances to simulate DEV/UAT/PRD 

Solution Customizations

To keep things simple, I have created a new solution, Account Customizations to customize my account entity/table. I have also created a new attribute/column called strategic account, and the data type is two options/Yes/No and placed this field on the main Account form. 

Repo in Azure DevOps

Next, I have  created a project in Azure DevOps called DYN365ALM. I will add my repo, build, and release pipelines to this project. 

The report will contain the solution in its unpacked form. This will help review and merge changes when someone checks in, runs the build pipeline, and creates a Pull Request. Eventually, the solution will deploy via a release pipeline. 

Build Pipeline

Please note that I have  created a service connection using a service principal to connect with Dynamics 365 PowerApps as an Application User. If you need additional information on how to do that, please read the following articles: 

  1. Tutorial: Register an app with Azure Active Directory (Microsoft Dataverse) – Power Apps | Microsoft Docs 
  2. Manage application users in the Power Platform admin center – Power Platform | Microsoft Docs 

We will  create two build pipelines. The first pipeline would extract the unmanaged solution, unpack it, and check-in in the repo. Once the solution is unpacked, it could be used to create a PR, and then merge the changes to be imported in a Build environment or SIT environment. 

The second pipeline would be used to pack the merged change, import it in the SIT environment and export a managed solution to be released for production. 

 Here is how the first pipeline looks. I have created a SolutionName variable to control which solution needs to be worked on. 

Export Unmanaged

This image shows the Export Unmanaged

YAML:

pool:

  name: Azure Pipelines

variables:

  SolutionName: ‘AccountCustomizations’

steps:

– task: microsoft-IsvExpTools.PowerPlatform-BuildTools.tool-installer.PowerPlatformToolInstaller@0

  displayName: ‘Power Platform Tool Installer ‘

  inputs:

    PowerAppsAdminVersion: 2.0.137

    CrmSdkCoreToolsVersion: 9.1.0.90

– task: microsoft-IsvExpTools.PowerPlatform-BuildTools.export-solution.PowerPlatformExportSolution@0

  displayName: ‘Power Platform Export Solution ‘

  inputs:

    authenticationType: PowerPlatformSPN

    PowerPlatformSPN: CRM967032

    SolutionName: ‘$(SolutionName)’

    SolutionOutputFile: ‘$(Build.ArtifactStagingDirectory)\$(SolutionName).zip’

– task: microsoft-IsvExpTools.PowerPlatform-BuildTools.unpack-solution.PowerPlatformUnpackSolution@0

  displayName: ‘Power Platform Unpack Solution ‘

  inputs:

    SolutionInputFile: ‘$(Build.ArtifactStagingDirectory)\$(SolutionName).zip’

    SolutionTargetFolder: ‘$(Build.SourcesDirectory)\$(SolutionName)’

– script: |

   echo commit all changes

   git config user.email “[email protected]

   git config user.name “Automatic Build”

   git checkout main

   git add –all

   git commit -m “solution init”

   echo push code to new repo

   git -c http.extraheader=”AUTHORIZATION: bearer $(System.AccessToken)” push origin main

  displayName: ‘Command Line Script’

Leverage Azure DevOps for Efficient PowerApps Deployment

Maximize your PowerApps deployment efficiency with AlphaBOLD's specialized Azure DevOps services. Our team is ready to assist you in leveraging Azure DevOps for streamlined automation, integration, and deployment.

Request a Consultation

Import To Build Env And Export Managed

Next, we need to import the unmanaged customizations to a Build or SIT environment. 

this image shows the YAML

YAML:

pool:

  name: Azure Pipelines

variables:

  SolutionName: ‘AccountCustomizations’

steps:

– task: microsoft-IsvExpTools.PowerPlatform-BuildTools.tool-installer.PowerPlatformToolInstaller@0

  displayName: ‘Power Platform Tool Installer ‘

  inputs:

    PowerAppsAdminVersion: 2.0.137

    CrmSdkCoreToolsVersion: 9.1.0.90

– task: microsoft-IsvExpTools.PowerPlatform-BuildTools.pack-solution.PowerPlatformPackSolution@0

  displayName: ‘Power Platform Pack Solution ‘

  inputs:

    SolutionSourceFolder: ‘$(Build.SourcesDirectory)\$(SolutionName) ‘

    SolutionOutputFile: ‘$(Build.ArtifactStagingDirectory)\$(SolutionName).zip’

– task: microsoft-IsvExpTools.PowerPlatform-BuildTools.import-solution.PowerPlatformImportSolution@0

  displayName: ‘Power Platform Import Solution ‘

  inputs:

    authenticationType: PowerPlatformSPN

    PowerPlatformSPN: CRM907570

    SolutionInputFile: ‘$(Build.ArtifactStagingDirectory)\$(SolutionName).zip’

– task: microsoft-IsvExpTools.PowerPlatform-BuildTools.publish-customizations.PowerPlatformPublishCustomizations@0

  displayName: ‘Power Platform Publish Customizations ‘

  inputs:

    authenticationType: PowerPlatformSPN

    PowerPlatformSPN: CRM907570

– task: microsoft-IsvExpTools.PowerPlatform-BuildTools.export-solution.PowerPlatformExportSolution@0

  displayName: ‘Power Platform Export Solution ‘

  inputs:

    authenticationType: PowerPlatformSPN

    PowerPlatformSPN: CRM907570

    SolutionName: ‘$(SolutionName)’

    SolutionOutputFile: ‘$(Build.ArtifactStagingDirectory)\$(SolutionName)_managed.zip’

    Managed: true

– task: PublishBuildArtifacts@1

  displayName: ‘Publish Artifact: drop’

To ensure CI/CD, I have enabled trigger for managed build to trigger on completion of unmanaged export pipeline.

this image shows the enabled trigger for managed build to trigger on completion of unmanaged export pipeline - Deploy PowerApps Solutions Using Azure DevOps

Now that we have our managed solution exported and checked-in in the repo, we will proceed with our release pipeline for production deployment.

Start with a blank release pipeline and select the artifact from the export managed build pipeline.

Next, add the following steps to the release stage for production deployment.

Release Pipeline

this image shows the Release Pipeline - How to Deploy PowerApps Solutions Using Azure DevOps

Let’s trigger the build pipeline and see the results:

this image shows the trigger the build pipeline
this image shows the jobs in run - Deploy PowerApps Solutions Using Azure DevOps
this image shows the release - How to Deploy PowerApps Solutions Using Azure DevOps
this image shows the release PRD success - Deploy PowerApps Solutions Using Azure DevOps

And in Dynamics 365 production organization, we have our managed solution with the new Strategic Account field deployed.

Further Reading: Migrating A Power Apps Form From Development To Production

this image shows managed solution with the new Strategic Account field deployed.
the image shows the Strategic Account field deployed - Deploy PowerApps Solutions Using Azure DevOps

Achieve Deployment Excellence with Azure DevOps Services

Our approach to deployment using Azure DevOps ensures that you get the efficiency, automation, and reliability you need. Experience the difference our Azure DevOps services can make.

Request a Consultation

Conclusion

Using Azure DevOps for PowerApps deployment can streamline and simplify the process of releasing applications. We’ve covered how to create build and release pipelines that integrate Dynamics 365 PowerApps with Azure DevOps, bringing a foundational level of Application Lifecycle Management (ALM) to your workflow. 

This blog has aimed to show you the straightforward steps to get your PowerApps solutions from development to production using Azure DevOps. Yet, navigating PowerApps deployment using Azure DevOps can sometimes be challenging, especially as your projects grow in complexity. 

This is where a provider like AlphaBOLD can be valuable. With expertise in both PowerApps and DevOps solutions, they are equipped to help streamline your deployment process. Whether you’re refining an existing pipeline or starting a new PowerApps Azure DevOps integration, AlphaBOLD’s consultants can help you tackle the technicalities, ensuring your deployments are as smooth and efficient as possible. 

Explore Recent Blog Posts

Infographics show the 2021 MSUS Partner Award winner

Related Posts

Receive Updates on Youtube