Portals support for Microsoft Power Platform CLI - My take on development and deployment
Resources :
Overview of portals support for Microsoft Power Platform CLI
Power Platform VS Code Extension
Nuget package for PowerApps.CLI
Deployment profile for different environments
Microsoft Power Platform CLI(Command Line Interface) is a simple, single-stop developer command-line interface that empowers developers and app makers to create code components. With portals support for Microsoft Power Platform CLI, you can now use offline-like capability for portals customization by making changes to the portals content. And once all customizations or changes are saved, upload them to the portal.
To make my work simpler, I have create bat file to run the commands with the authentications.
- I have provided the path of the pac.exe from the packages to run the command from my solution.
- auth clear - clears the existing authentication profile, if there is any.
- auth create - create the credentials to connect with D365 CRM
- paportal download - downloads the portal from Portal Management
- paportal upload - uploads the portal from local path to D365 Records.
- you can deploy portal in different environment using deployment profile. refer to above link.
Portal-Upload.bat : uploads the local content to D365..\packages\Microsoft.PowerApps.CLI.1.9.9\tools\pac.exe auth clear
..\packages\Microsoft.PowerApps.CLI.1.9.9\tools\pac.exe auth create -u <D365 URL> -id <Client/App Id associated with D365 application user> -cs <Secret> -t <TenantId>
..\packages\Microsoft.PowerApps.CLI.1.9.9\tools\pac.exe paportal download --path "<Path to download portal>" --webSiteId <Website Id from CRM> --overwrite <true/false>
..\packages\Microsoft.PowerApps.CLI.1.9.9\tools\pac.exe auth clear
..\packages\Microsoft.PowerApps.CLI.1.9.9\tools\pac.exe auth create -u <D365 URL> -id <Client/App Id associated with D365 application user> -cs <Secret> -t <TenantId>
..\packages\Microsoft.PowerApps.CLI.1.9.9\tools\pac.exe paportal upload --path "<Portal Name>"
My take on portal deployment in different
environments.
One of the main issue i was trying to resolve is how to deploy portal using devops pipeline in different environments. To achieve that i have creates some steps in pipeline. Below are the images and yaml for the steps
1. Install Nuget
Yaml:
steps:
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
2. Install Powerapps CLI as custom command in pac directory.Yaml:
steps:
- task: NuGetCommand@2
displayName: 'NuGet custom install Powerapps Cli'
inputs:
command: custom
arguments: 'install Microsoft.PowerApps.CLI -OutputDirectory pac '
3. Run command line task to deploy the portal
- With in agent, go in to the folder were pac.exe is installed.
- Clear and create the authentication profile using "auth" command.
- upload the portal using "paportal upload" command.
Command linecd paccd Microsoft.PowerApps.CLI*cd toolspac.exe auth clearecho creating authpac.exe auth create -u $(DestinationCrmUrl) -id $(DestinationClientId) -cs $(DestinationSecret) -t $(TenantID)echo portal uploadpac.exe paportal upload --path "$(System.DefaultWorkingDirectory)/<Directory path which contain all the files for downloaded portal>" --deploymentProfile <profile name>Yaml:steps:- script: |cd paccd Microsoft.PowerApps.CLI*cd toolspac.exe auth clearecho creating authpac.exe auth create -u $(DestinationCrmUrl) -id $(DestinationClientId) -cs $(DestinationSecret) -t $(TenantID)echo portal uploadpac.exe paportal upload --path "$(System.DefaultWorkingDirectory)//<Directory path which contain all the files for downloaded portal>" --deploymentProfile <profile name>
displayName: 'Command Line Script - Deploy Portal'


Good intro Sam. Looking forward to more.
ReplyDelete