Modern application development demands agility, repeatability, and automation. When working with Power Pages (formerly PowerApps Portals), a CI/CD (Continuous Integration/Continuous Deployment) pipeline ensures consistent, automated deployments across development, test, and production environments.
GitHub Actions is a powerful automation tool that helps you orchestrate CI/CD workflows. By integrating Power Pages with GitHub, you can:
- Track portal code changes via source control
- Automate build and deployment tasks
- Minimize human error and downtime
- Streamline collaboration across teams
This guide walks through creating a CI/CD pipeline for Power Pages using GitHub Actions, covering everything from prerequisites to deployment.
1. Why CI/CD for Power Pages?
Power Pages involves:
- Portal configuration (web pages, forms, snippets, etc.)
- Liquid templates and JavaScript code
- Dataverse table schema and data
A manual deployment of this content can be:
- Error-prone
- Time-consuming
- Hard to audit or roll back
With CI/CD, your portal development becomes:
- Repeatable: Consistent across environments
- Traceable: Trackable through Git commit history
- Auditable: Every deployment is logged
2. Prerequisites
Before setting up the CI/CD pipeline, make sure you have:
A Power Platform environment with Power Pages
A GitHub repository to store portal configuration
Installed Power Platform CLI (PAC CLI)
A GitHub personal access token
Power Platform Service Principal (or use your username/password for development)
3. Folder Structure in GitHub Repository
Use this structure to organize your portal content in the repo:
📁 PowerPages-CICD/
│
├── 📁 src/
│ └── MyPortal/ (downloaded portal code)
│
├── 📁 workflows/
│ └── ci-cd.yml (GitHub Actions workflow)
│
├── .gitignore
└── README.md
4. Exporting Portal Code
Export portal configuration using PAC CLI:
pac auth create --url "https://<env>.crm.dynamics.com"
pac paportal download --path "src/MyPortal" --webSiteId <GUID>
Commit this code to GitHub. This forms your source of truth for portal logic.
5. Setting Up GitHub Actions Workflow
Create a file: .github/workflows/ci-cd.yml
name: Power Pages CI/CD
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy Power Pages
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.x'
- name: Install Power Platform CLI
run: |
dotnet tool install --global Microsoft.PowerApps.CLI.Tool
- name: Authenticate with Power Platform
run: |
pac auth create --clientId ${{ secrets.CLIENT_ID }} --clientSecret ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.TENANT_ID }} --url ${{ secrets.ENVIRONMENT_URL }}
- name: Upload Portal Changes
run: |
pac paportal upload --path src/MyPortal
6. GitHub Secrets Configuration
In your GitHub repository, go to Settings > Secrets and variables > Actions > Secrets and add:
Secret Name | Description |
---|---|
CLIENT_ID | Azure AD App (Service Principal) ID |
CLIENT_SECRET | Service Principal Secret |
TENANT_ID | Your Azure AD Tenant ID |
ENVIRONMENT_URL | URL to your Power Platform environment |
Use Azure App Registrations to create a service principal and assign proper roles in the Power Platform admin center.
7. Automating the Full CI/CD Process
To automate the full lifecycle:
Continuous Integration (CI)
- Validate Liquid or JS syntax (use linting tools if possible)
- Run unit tests for backend logic (e.g., plugins or custom connectors)
Continuous Deployment (CD)
- Upload portal code to the target environment
- Optionally include Dataverse data using
pac data import
- Add approval gates before deploying to production
Optional Enhancements:
- Multi-environment deployment (
dev
,test
,prod
) - Environment-based branches (
main
for production,dev
for staging) - Slack/Teams notifications on successful deployment
8. Adding a Manual Trigger
You can also add manual deployment:
on:
workflow_dispatch:
inputs:
environment:
description: 'Select environment'
required: true
default: 'dev'
This allows you to trigger deployments from the GitHub UI.
9. Handling Schema and Data Migration
Power Pages often depend on underlying Dataverse data. Include table schema and reference data using:
pac solution export --path "solution.zip" --name "MySolution"
In GitHub Actions, upload this as part of the pipeline:
- name: Import Solution
run: |
pac solution import --path solution.zip
Use pac data import
to seed portal-related data like contact records or lookup values.
10. Testing After Deployment
Add a step to verify if deployment was successful:
- name: Validate Portal Deployment
run: |
curl --fail https://yourportal.powerappsportals.com
You can also trigger Playwright tests or Postman API tests after deployment.
11. Rollback Strategy in Pipeline
Include rollback logic by re-uploading a previous portal version:
- name: Rollback Portal
if: failure()
run: |
pac paportal upload --path backup/PreviousPortal
12. Monitoring and Alerts
- Use Application Insights to track portal performance and exceptions
- Add alerts if GitHub Action fails using:
- GitHub notifications
- Slack / Microsoft Teams integrations
- Azure Monitor alerts
13. Best Practices
Keep environments isolated (dev, test, prod)
Use short-lived feature branches and merge via PRs
Store portal backups in separate folders or branches
Test scripts locally before adding to GitHub Actions
Document portal changes in Git commits