The feature discussed in this blog post is experimental and subject to changes. Use at your own risk.
Microsoft has recently introduced a new experimental feature to directly store the modifications to your canvas apps to Git. This offers multiple advantages:
- Multiple people can now work on the same power app at the same time. All changes are stored in Git and once you save, your colleague can synch the changes and pick off from where you left off.
- You have version control for your app. All saves are stored as a Git commit, meaning you have a full trace of all changes and modifications. If you mess up, you can go back easily.
- You can link this to CI/CD pipelines to automatically build and deploy versions of your app.
Using Git version control really opens up Power Platform development to mature and proven good practices in software development.
Enabling and using version control
To enable the experimental feature and to get a view on how to use it, I’ll refer you to the official Microsoft documentation about it here:
https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/git-version-control
The most important steps are:
- Enabling the feature in the Power Apps Settings
- Create a repository on for example GitHub for your canvas app
- Connect your app to the Git repository
- Generate a Personal Access Token for the repo that allows Power Apps to read/modify the repository
- Profit!
The annoying part… always authenticating
While this feature offers a lot of benefits, one thing that bothered me while using it was that each time you open up the canvas app, you’d be presented with this:
Microsoft does not store your Git credentials between sessions, which means you’ll have to authenticate each time you open the Power Apps editor and each time you’ll need to provide your username and the personal access token. This token is often a long autogenerated string that’s impossible to remember, so you might end up copy pasting this PAT from somewhere each time you open up the app.
Bitwarden to the rescue
It’s a good practice to use a password manager. They allow you to create a random password per service that you use on the internet and store all of these so you don’t have to remember them.
You can use a password manager to store your Git credentials as well. Any of them will do, but my personal preference goes out to Bitwarden. Bitwarden is open source, free and easy to use while not compromising on security. It has browser extensions for all main browsers and iOS and Android apps.
Once you’ve set up Bitwarden, installed the browser plugin and created an account, we can add the Git credentials. The easiest way to do this is to browse to your canvas app, or Dataverse for teams canvas app, that has the experimental Git feature enabled. You’ll be greeted with the sign in prompt from the screenshot above.
Here’s the step by step:
- Click on the browser extension and add a new login by clicking on the + sign. This will create a new login.
- Give the login a name. I would suggest to name it after your Power app because the login is specific to this app.
- Fill in the username: your GitHub username
- Fill in the password: your Personal Access Token
- The URI is important as well. As you can see, it automatically stores your current URI for the new login. This URI contains the ID’s to your app. It only prefills the correct URI if you start this process when you’re on the app designer for the correct app in your browser.
- Click Save to store the login.
Now Bitwarden will automatically detect when you’re on a page for which it has a stored login. The icon of the browser extension changes to indicate how many potential logins are available for this page. Without leaving the Power Apps editor, you can now click on the browser extension, select the login you’ve just added and it will prefill both the username and the PAT.