Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>PowerApps Portals Build Tools

PowerApps Portals Build Tools

Arpit Dynamics

|
501 installs
| (3) | Free
An extension to automate PowerApps Portals deployment using PowerApps CLI

About PowerApps Portals Build Tools

This tool empowers developers to enable CI/CD (Continuous Integration/Continuous Deployment) of portal configuration. You can use this tool to check-in the portal configuration to source control and move portal configuration to any environment using Power Apps CLI.

For more details about Power Apps CLI support for Power Apps Portal. You can check these articles:

  • https://docs.microsoft.com/en-us/powerapps/maker/portals/power-apps-cli-tutorial
  • https://docs.microsoft.com/en-us/powerapps/maker/portals/power-apps-cli
Task Description
Portal Tool Installer This tasks install pre-requisites tools like node.js and npm to connect, authenticate, download and upload the portal configuration
Export Portal Configuration This task exports the portal configuration from power platform enviornment and save it in the source control.
Import Portal Configuration This task imports the Portal configuration in power platform environment

Steps to configure

Step 1 - Install the extension in your Azure Devops Instance

  1. Create a build pipeline in Azure DevOps and find the tool with the name : "Power Apps Portal Build Tools".
  2. Click on "Get it free" to get this tool installed in your Azure Devops instance.

alt text

Step 2 - Portal Tool Installer

Portal Tool Installer task is used to install all prereusites softwares and tools like npm, node.js etc in Azure Devops VM. These tools and softwares are required to connect, authenticate, download and upload the portal data from/to your Power Platform environment.

alt text

Step 3 - Export Portal Configuration

Export Portal Configuration task is used to export(download) the portal configuration (form, list, webpages, content snippet etc) from your Power Platform environment and store it in the source control. In order to use this task in your build pipeline(CI), You need to pass some mandatory information like D365 instance URL, application Id, client secret, tenent id, website id and the folder path of your source control where you want to save the portal configurations.

Here are the mandatory details that you need to provide:

  • Dynamics 365 URL: https://.crm.dynamics.com
  • Application Id: Register an Azure AD app in azure and capture this value from there
  • Client Secret Key: Register an Azure AD app in azure and capture this value from there
  • Azure Tenant Id: Capture this value from your Azure AD
  • Portal Website id: Capture this value from Dynamics 365 instance, where your portals is installed
  • Save export data (All): Folder path in repository, where you want to store your complete portal configuration data. For Ex. if you have a folder in repository with name Power-Platform-Solution and inside that there is one more folder called PowerApps-Portals, where you want to export the portal configuration, then this parameter value must be: Power-Platform-Solution\PowerApps-Portals
  • Save export data (Selected): Folder path in repository, where you want to store only selected portal configuration data.
  • Exclude data: Here you can provide the list of all tables/files (in comma seperated format) whose data you don't want to import in target instance. For example, while doing Portal deployment if you don't want to migrate site-setting, content-snippet and website-language data to target instance, then you can specify these file/table folder name in comma seperated format. Please see below screenshot to check the folder/file name of portal components.

Important Note: I have used Output variable in order to pass the Exclude data value to the next step of the pipeline. Hence, set the reference name (portal) of the output variable as per the shown in the following screenshot.

alt text

alt text

Step 4 - Commit data to source control

Once you export the portal configuration, it is currently available on your Azure DevOps virtual machine. You need to commit that data to your source control in Master branch. To do that, you should add a Powershell task and add the following script.

Note: In git add command (4th line in the script, as shown below), give the folder path where you want to store the portal configuration in repository

alt text

Step 5 - Powershell script - Exclude data from export

This script has a logic to remove the portal component folders from the repository that you don't want to migrate to the target instance. To manage this, i have created 2 folders (Portal-Source and Portal-Deployment) in my repository. Portal-Source folder holds the complete portal data export and Portal-Deployment folder holds only selected portal data export (that i want to import).

Currently, there is no way in PowerApps CLI to do the increamental or selective portal component deployment. The only alternative, i found is to remove the corresponding folder of a particular portal component.

git config --global user.email "arpit.crmconsultant@gmail.com" git config --global user.name "Arpit Shrivastava" $tables = $(portal.ExcludedTables); $lists = $tables.split(","); Write-Output $lists foreach($l in $lists) { git rm -r Power-Platform-Solution\Portal-Deployment\starter-portal$l Write-Output $l removed... } git add . git commit -a -m "removed folder" git push origin master

alt text

Step 6 - Publish Artifact

This step is used to store the build artifacts to the staging directory.

Please point 'Path to publish' field value to the folder, where you are storing the selective portal data export in the repository.

alt text

Step 7 - Create Deployment Profile

Please read the following articles to know what is the significance of using deployment prifiles and how to use it:

  • https://powerapps.microsoft.com/en-us/blog/power-apps-portals-create-deployment-profile-for-dev-test-prod-environment-using-power-apps-cli/
  • https://docs.microsoft.com/en-us/powerapps/maker/portals/power-apps-cli-tutorial#step-5-upload-the-changes

You need to manually create the deployment profiles inside the folder containing the portal content (see below). In the below example, I have to deploy the portal to SIT, UAT and PROD environment. Therefore, I have created 3 different deployment profiles.

alt text

Note: Deployment profiles needs to be created only one time. From next time onwards, you may only required to change its content (if required).

Step 8 - Import Portal Configuration (Use it in Release Pipeline)

Import Portal Configuration task is used to import(upload) the portal configuration (form, list, webpages, content snippet etc) to your Power Platform environment. In order to use this task in your release(CD) pipeline, You need to pass some mandatory information like D365 instance URL, application Id, client secret, tenent id and the folder path of your source control where you have exported/stored the portal configurations.

Here are the mandatory details that you need to provide:

  • Dynamics 365 URL: https://.crm.dynamics.com
  • Application Id: Register an Azure AD app in azure and capture this value from there
  • Client Secret Key: Register an Azure AD app in azure and capture this value from there
  • Azure Tenant Id: Capture this value from your Azure AD
  • Portal data: Point this to your build artifact (as shown below)
  • Deployment Profile Name: Provide the nsme of deployment profile thst you hsve created for your target environment. Let say, if your UAT deployment profile is UAT.deployment.yml then the name of deployment profile would be UAT.

alt text

alt text

Support and Contact

For any support and assistance, you can connect me through following channels:

  • Blog: https://arpitpowerguide.com
  • LinkedIn: https://www.linkedin.com/in/arpit-shrivastava-29747761
  • Twitter: https://twitter.com/arpitsdynamic
  • YouTube: https://www.youtube.com/channel/UCoo8XC7e5uzyu83WN61zPTQ/
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2022 Microsoft