Backup your PowerApps apps for non-CDS environments
Looking for a way to automate backing up your PowerApps for non CDS environments? Here is a post on how along with a good administration scenario.
Prerequisites
- Environment admin rights to environments
- One PowerApps or Flow premium license – for anyone making backups as it requires to use an HTTP connector.
Technical Details – PowerApps for Admin connector + Flow
PowerApps for admin connector have an action called “Get App as Admin” which retrieves all the information related to the specified app.
This action has a field called – “readonlyValue” which actually points to a link that stores the PowerApps msapp file. By combining the HTTP connector with this link, will allow you to retrieve the contents of the msapp file – thus, you can store your PowerApps backup to anywhere you want!
Sample Template – Backing up PowerApps apps to OneDrive for Business
Example below shows how you can use Microsoft Flow to periodically (in this sample, daily) store your PowerApps app backups to OneDrive for Business.
Flow is first triggered off using the Scheduler trigger to run this Flow every day. It then uses the Power Platform Admin connector to retrieve the list of Environments in your tenant. From this list, it then looks into what apps are there within each environment.
Next, for the apps in the environment, Get App as Admin action will retrieve further details of each app – including the “readonlyvalue” as explained above. Using this result and setting it in HTTP connector will then retrieve the app data to Flow. By adding the action “Create file” in OneDrive for Business connector, and setting the body from HTTP connector will allow you to save your app to OneDrive for Business. You can instead set it to other storage like Azure Blob Storage or SharePoint document library etc.
Admin scenario – Backup old apps in the environment
Suppose your company have been using PowerApps for a while now, and want to periodically take backup of old apps before deleting it, you just need to modify above template just a little bit, and add a condition action.
Using the lastModifiedDate from Get App as admin action, and getPastTime function to check if the app has not been modified for the last 60 days, you can then make it so that the Flow will only make backups if the apps meets this criteria.
Setup from a template
To save time, we have created a template for you – which you can download from this link on GitHub (aka.ms/PowerAppsBackupTemplate). We will hopefully have the template available from Flow directly in future!