Introduction
When working with multiple environments (Development, UAT, Production), manually moving Power Platform solutions can slow down your delivery cycle. With Azure DevOps and Microsoft's Power Platform Build Tools, we can automate:
- Exporting the solution from the source
- Storing and unpacking it in a repository
- Packing and importing it into the target environment
Step 1: Azure App Registration
Go to Azure Portal and open App registrations.
Click on New registration and name your app (e.g., Pipelines CICD Deployment Power Apps).
After registration:
Save the Application (client) ID
Save the Directory (tenant) ID
Navigate to API permissions and add:
- Azure DevOps → user_impersonation
- Dynamics CRM → user_impersonation
- PowerApps Runtime → user_impersonation
Go to Certificates & Secrets → New client secret and store it securely.
Step 2: Power Platform Setup
Start by logging into make.powerapps.com and select your source environment (e.g., "Dev" or "Default").
Click on Solutions → New solution.
Give it a name (e.g., Client Feedback Solution) and select a publisher.
After creating the solution, add your components — for example:
A Dataverse table (e.g., Client Feedback)
A Canvas app that connects to this table and allows users to submit feedback.
Once created, be sure to save and publish your solution.
To enable Azure DevOps to interact with Power Platform environments, you must authorize your registered Azure App by creating Application Users with the right permissions.
Here's how to do it:
Go to the Power Platform Admin Centre.
In the left menu, click on Environments, then choose your source environment.
Click on Settings → Users + permissions → Application users.
Click + New app user and follow these steps:
Select the app: Choose the Azure AD app you registered in Step 1.
Business Unit: Choose the root business unit.
Security Role: Assign the System Administrator role (this is required for full deployment access).
And then click "Save"
After that just open the app user that you just added and click on the refresh button (having tooltip as: "Update application name from Microsoft Entra ID")
Repeat the same steps for your target environment (e.g., "Test" or "Production").
This setup ensures your DevOps pipeline can export and import solutions securely across environments.
Step 3: DevOps Project Configuration
Go to Azure DevOps and create a new private project.
Install the Microsoft Power Platform Build Tools from the Azure Marketplace
Create Service Connections for both Source and Target environments using:
- Client ID
- Tenant ID
- Client Secret
- Environment URLs
Go to Project Settings (bottom-left gear icon) → Service connections → Click "Create service connection".
Search for "Power Platform", select it, and click Next.
Fill in the Source Connection details: select "Application Id and client secret" as the authentication method, enter the Source environment URL, Tenant ID, Application (Client) ID, Client Secret, and name it "Source Connection". Check "Grant access permission to all pipelines" and click Save. Repeat the same steps for the Target Connection using the Target environment URL.
Both Source Connection and Target Connection are now created and visible under Service connections.
Step 4: Build Pipeline (Continuous Integration)
Navigate to Repos -> Files -> Initialize a Git Repository and configure permissions.
Project Setting Repository Security – User Permission–contribute Allow
Go to https://dev.azure.com with your account. Once you're in your organization's portal, click on Organization Settings in the bottom left corner.
Inside Organization Settings, select Agent Pools. Here you'll see a list of pools — typically there's Default (Microsoft-hosted) already there.
To create a new pool, click New Pool or reuse Default.
Select Default or your preferred pool. Click New Agent. This will prompt you to Download the agent package (for 64-bit or 32-bit).
Save this ZIP file to your machine.
Extract the downloaded ZIP and inside, you'll see files like:
config.cmd
run.cmd
bin
Navigate to your extracted directory. Then run: config.cmd
✅ This will launch a configuration script in cmd.
When prompted:
Enter your Server URL — typically your Azure DevOps organization's URL (e.g.: https://dev.azure.com/tenant).
Select Personal Access Token for authentication.
Go to your Azure DevOps profile -> Personal Access Tokens.
Click on New Token. Create a new PAT with Full Access (or custom) and expiration as needed. Copy this PAT and paste it into the configuration script.
It will ask:
"Enter agent pool (press enter for default)"
"Enter agent name"
Consider a custom, descriptive name (for example: self-hosted-agent).
It will scan for tool capabilities and connect successfully. Then:
Confirm working directory with Enter.
Say Y to enable service installation (run agent as service).
Say Y for the SERVICE_SID_TYPE_UNRESTRICTED
Account credentials or use network service as enter.
Once configured, you can start the service:
Open Services (press Windows + S, then search Services -> run as admin).
Look for Azure Pipelines Agents with your agent's name.
Right Click on it -> Start the service if it's not already running.
Go back to Azure DevOps -> Organization Setting -> Agent Pools -> [Your Pool]. Your new agent should show up Online, ready to be used in your pipeline.
Congratulations! Your self-hosted agent is up and running. It's now available for your pipeline's parallel job execution in your CI process.
Create a new pipeline (Classic Editor).
Select Empty Job
Add tasks in order:
Take the solution name and put it in the variable name in the pipeline
Search and add Power platform tool installer
Search for the export solution and add the "Power Platform Export Solution"
Set the following properties
Configure the Export Solution task: set Authentication type to Service Principal, choose the Source Connection, leave Environment URL as $(BuildTools.EnvironmentUrl), set Solution Name to $(SolutionName), and set Solution Output File to $(Build.StagingDirectory)/$(SolutionName)_unmanaged.zip. Leave "Export as Managed" unchecked.
Search for the unpack solution
Set the following properties
Configure the Unpack Solution task: set Solution Input File to $(Build.StagingDirectory)/$(SolutionName)_unmanaged.zip, Target Folder to $(Build.SourcesDirectory)/$(SolutionName)/Unmanaged, and Type of Solution to "Unmanaged".
Search for the "Publish build artifacts" and add that to steps.
Set the following properties.
Set the Path to Publish to $(Build.SourcesDirectory)/$(SolutionName)/Unmanaged. This publishes the unpacked solution components as a build artifact.
Search for the "Command line" and add that to steps
Add the following script in the command line:
echo commit all changes
git config user.email "test@test.com"
git config user.name "Name"
git checkout -B main
git add --all
git commit -m "code commit"
git -c http.extraHeader="AUTHORIZATION: Bearer $(System.AccessToken)" push origin mainRemember to:
Use variables for solution name.
Enable "Allow scripts to access OAuth token" for Git push.
Click Save and Queue
Change the settings, add commit message and click save and run
Check logs
The build process has now completed successfully.
Step 5: Release Pipeline (Continuous Deployment)
Go to Releases → New Release Pipeline.
Navigate to Pipelines → Releases in the left menu. Click "New pipeline" to create a new release pipeline.
The new release pipeline view shows two sections: Artifacts (left) and Stages (right). We need to configure both.
Add your build artifact as a source.
Click "+ Add" under Artifacts. Select "Azure Repos Git" as the source type, choose your project, select the repository and "main" branch, set Default version to "Latest from the default branch", and click Add.
After the artifact is linked, click "+ Add a stage" under Stages. Select "Empty job" from the template list.
Name the stage (e.g., "Stage 2") and click on "1 job, 0 task" to start adding tasks.
Rename the stage to "First Release" under the Tasks tab. This is where you'll add the release tasks.
Go to the Variables tab and add a pipeline variable: Name = SolutionName, Value = your solution's internal name (e.g., PipelinesAzureDevOpsDemo).
In the stage:
Search for "Power Platform Tool Installer" and click Add. This must be the first task in the release stage.
Search for "pack" and add the "Power Platform Pack Solution" task.
In the Pack Solution task, click the browse button (...) next to Source Folder. Navigate to the linked artifact's Unmanaged folder inside your solution directory.
Configure the Pack Solution properties: set Source Folder to $(System.DefaultWorkingDirectory)/_Power Apps CI-CD Pipeline/$(Build.SourceDirectory)/$(SolutionName)/Unmanaged, Solution Output File to $(Build.StagingDirectory)/$(SolutionName).zip, and Type of Solution to "Unmanaged".
Search for "import" and add the "Power Platform Import Solution" task.
Configure the Import Solution task: set Authentication type to "Service Principal/client secret", select the Target Connection as the service connection, leave Environment URL as $(BuildTools.EnvironmentUrl), and set Solution Input File to $(Build.StagingDirectory)/$(SolutionName).zip. Check "Import solution as asynchronous operation".
Search for "publish" and add the "Power Platform Publish Customizations" task.
Configure Publish Customizations: set Authentication type to "Service Principal/client secret", select the Target Connection, and leave the Environment URL as default. Check "Publish Customizations as asynchronous operation".
Click Save at the top-right. Add a comment (e.g., "Release Created") and click OK.
Once saved, all four tasks are visible in the stage. Click "Create release" at the top-right.
In the "Create a new release" dialog, confirm the stage ("First Release"), verify the artifact version, add a release description (e.g., "Prod Release"), and click Create.
The release is created. A banner confirms "Release-1 has been created."
Monitor logs and verify the deployment in the target environment.
Click the Deploy dropdown and select "Deploy stage" or "Deploy multiple" to trigger the deployment.
In the Deploy release panel, select the "First Release" stage, optionally add a comment, and click Deploy.
The release is now in progress. You can see the stage status showing "In progress" with a task counter and timer.
The release has succeeded! The "First Release Stage" shows a green "Succeeded" status.
Verify the deployment by navigating to the target environment in Power Apps (make.powerapps.com). The solution (e.g., "Pipelines Azure DevOps…") now appears in the Solutions list, confirming a successful CI/CD deployment.
Conclusion
Congratulations! You now have an end-to-end automated pipeline for deploying Power Platform solutions using Azure DevOps. This setup:
- Reduces manual effort
- Ensures consistency across environments
- Improves delivery speed and confidence
With this CI/CD process, you're better equipped to handle modern ALM practices for Power Platform.

No comments:
Post a Comment