The Rockhop logo in the navigation bar
The Rockhop logo in the navigation bar

Power Platform ALM with GitHub

June 15, 2023

Overview

This walkthrough demonstrates how to integrate GitHub with Power Platform to enable full ALM, version control, and automated deployment using GitHub Actions. By configuring Azure app registrations, repository secrets, and three key workflows, solutions can be exported from Dev, versioned in GitHub, and automatically imported into production as managed solutions. The result is a streamlined, scalable, and modern development lifecycle for Power Platform environments.

Configuring Azure and Power Platform for GitHub Integration

I'm Michael Buckman, and I'm going to talk to you a little bit about GitHub and Power Platform today. We're going to see how they work together, we're going to see how we can use ALM, and we're going to look at version control with Power Platform solutions.

The first thing I want to look at today is the Microsoft documentation on how to set up a Power Platform solution with GitHub and GitHub Actions. I think this is a super detailed walkthrough, and if you ever get stuck or need help, this is a great reference.

There are a few things that we need to configure before we jump into GitHub. I'm going to jump into the Azure portal. Inside here, we'll go to Azure Active Directory and then to App Registrations. I've already configured my app registration, but I'm going to show you how to do this. You're going to click on New Registration and give this some kind of meaningful name, like Azure DevOps or the name of your solution. You can also create one for your Dev environment and one for production—that's how I've chosen to set this up.

Once you've created your app registration, you'll see something like this. Now we need to go to API permissions and make sure that the Dynamics CRM permission is added. To do that, you just click on Add Permission, add Dynamics CRM, and then make sure the user impersonation permission is checked. Once that's selected, you'll click Add Permission. That will show up here, and you'll want to make sure that you grant admin consent to this permission.

The other area we want to go to is Certificates and Secrets. We need to create a client secret for this app registration. Once you click Add, make sure you copy the value of that secret and store it somewhere accessible because we'll use that soon in the configuration in GitHub.

You'll also want to make sure you copy the application ID and the directory (tenant) ID. We'll use those in GitHub as well.

Next, we need to navigate over to the Power Platform Admin Center and add that app registration into our environments. This gives GitHub access to our Power Platform environments so it can export and import our solutions.

Setting Up GitHub, Repository Secrets, and Workflow Actions

Now I am in the Power Platform Admin Center, and I'm going to click on my Dev environment. Under Settings → Users and Permissions → Application Users, we need to add our app registration. You select the app, set the business unit, and choose security roles—either System Administrator or System Customizer.

Next, in GitHub, we need to configure a repository. A readme file is enough to start. Then, under Actions, we're going to create the export and branch solution action. Microsoft provides templates in the Power Platform Actions Lab repository, and we can copy the YAML from there.

Before configuring the workflow, we need to go into Settings → Secrets and Variables → Actions and create repository secrets for our client secret. I have one for Dev and one for production.

After secrets are stored, we return to Actions and create a new workflow. We paste the template YAML, rename the file, and update our configuration values: environment URL, client ID, tenant ID, and so on. Once committed, we can run this workflow. It will export the solution, unpack it, create a branch, and check in the solution.

This will create a Solutions folder in your repository containing the unpacked solution. I also manually created a Settings folder inside Solutions and added my rockhop-out-of-office.json environment variables file, generated from the Power Platform CLI.

Release Workflows, Importing to Production, and End-to-End ALM

Next, we need two more actions: one reusable workflow for importing solutions to production, and another that calls it whenever a release is created in GitHub. Again, Microsoft provides template YAML files for these, and I updated only the necessary configuration values.

Once all actions are configured, we can run the full ALM flow. First, we trigger the export and branch workflow. It exports the solution, unpacks it, creates a branch, and prepares a pull request. After reviewing and merging the pull request into Main, we create a GitHub release.

Creating the release triggers the release action call, which sends inputs to the reusable workflow. This workflow packs the solution, imports it into Dev, exports it as a managed solution, stores it in the artifact store, and finally imports it into production using the settings file.

Once the production import succeeds, we can verify the changes. I updated my app message to say, “We are in production. Thanks for watching.” Checking the production environment confirms the update.

So, to recap: we were able to use GitHub with Power Platform to get version control and set up ALM with GitHub Actions, exporting from Dev and importing into production. Branching, pull requests, releases—all the good things GitHub provides—work seamlessly with Power Platform solutions. Microsoft has done a great job integrating this with GitHub, Azure DevOps, and built-in Power Platform pipelines. Really cool stuff. Thanks for watching, and we'll see you next time.

Talk to a Rocker! chevron-down