To implement CI/CD process with Azure DevOps Pipelines, we can store the Power Platform solution in the source control. There are two main Paths –
Fig 1
In this article, we will show the steps to achieve the Option above 2 above, and Fig 1 depicts the process.
Create source and target environments. Both should have Dataverse database enabled. Create an unmanaged Solution in the source environment
Create Azure AD App Registration
Add the service principal as App user into Power Platform source and destination environment.
Create Service Connection with Application ID and Client Secret
Create Pipeline – Export from Source
i. From the left navigation within the Project, click on Pipelines >New Pipeline>Use the Classic Editor
ii. Select the Source as Azure Repos Git, select your Project, Repository and Branch and click continue
iii. Under select template, start with Empty job
iv. Click Agent Job 1 and make sure Allow Scripts to access OAuth token is checked
v. Add the task Power Platform Tool Installer with task version 2
vi. Add the task Power Platform Export Solution. We are adding the task to export the solution as unmanaged here
For Service Connection, Select Service Principal> Select Dev Service Principal from Dropdown
Provide your Solution Name (not the display name)
Solution output file name $(Build.ArtifactStagingDirectory)\<SolutionName>.zip
Uncheck export as Managed Solutin
vii. Copy the above task . This time we are exporting managed solution. Keep all settings same, only check the box Export as Managed solution and the Solution Output file name to $(Build.ArtifactStagingDirectory)\<SolutionName>_managed.zip
viii. Add the task Power Platform Unpack Solution
Solution Input File -$(Build.ArtifactStagingDirectory)\<SolutionName>.zip
Target Folder to Unpack Solution - $(Build.SourcesDirectory)\<SolutionName>
Type of Solution – Both
ix. Add a task Command Line script, and paste the below script
echo commit all changes
git config user.email “<email>”
git config user.name "<user name>"
git checkout -B main
git add --all
git commit -m "code commit"
git push --set-upstream origin main
x. Save and queue the Pipeline and wait it to be finished
xi. Check the repository for the unpacked source code
Create Deployment Settings File
pac solution export --name <solutionname> --path .\ --managed false
iv. Run below command to create Deployment Settings file
pac solution create-settings --solution-zip .\<SolutionName>.zip --settings-file <SolutionName>.json
v. Update values in the Deployment Settings file for the target environment
vi. In the Repository, create a Folder named Settings, create a file <SolutionName>.json within it, copy the text from the Deployment Settings File
Create Build Pipeline
Source Folder of Solution to Pack -Select Folder by clicking 3 dots
Solution Output File -<SolutionName>.zip
Type of Solution -Both
iv. Add a task -Copy Files
Source Folder -Settings
Contents -**
Target Folder - $(Build.ArtifactStagingDirectory)
v. Add a task Publish Artifact
Path to publish - $(Build.ArtifactStagingDirectory)
Artifact Name – drop
vi. Save and Queue the Build Pipeline
Create Release Pipeline
Select your project and build pipeline
Source alias -drop
iv. Service Connection – Select the service connection you created for Prod.
v. Solution Input File – Select clicking 3 dots, select the managed zip file for Prod
vi. Check Use Deployment Settings File and select the Deployment settings file by clicking 3 dots.
vii. For Prod, under Advanced, check Import Managed Solution
viii. Save the pipeline and create a Release
ix. Check the Solution has been deployed properly to Production
Please follow this Blog for detail steps .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.