Skip to content
Tutorials Center
My learning

Topics

Lesson 29 of 38 ยท Components and ALM

Pipelines, Source Control and the CLI

Automate Power Apps deployment: Power Platform pipelines, the pac CLI to unpack solutions into source control, Git workflows and a release checklist.

Exporting and importing solution zip files by hand works for a first release. After that it is slow and easy to get wrong: wrong version, wrong environment, forgotten step. This lesson shows the three automation tools you will meet: pipelines in Power Platform, the Power Platform CLI (pac) and source control.

The commands below are accurate descriptions of the tools; they cannot run on this site, so they appear as read-only blocks, with stand-ins for the logic.

Pipelines in Power Platform

Pipelines (also called Power Platform pipelines) give makers a guided deployment path inside the maker portal. An admin sets up a host environment and defines a pipeline with stages, for example Dev, then Test, then Prod, linking each target environment. A maker then opens their solution, chooses Pipelines in the left bar, picks the pipeline and clicks Deploy. The platform exports the solution as managed, imports it, and records the run.

Benefits:

  • Makers deploy without admin rights in the target environments.
  • Admins control where solutions may go and can add approval steps (through Power Automate extensions on deployment events).
  • Every deployment is logged with the version and the person.

The Power Platform CLI

The Power Platform CLI is a command-line tool, installed with the VS Code extension or with dotnet tool install --global Microsoft.PowerApps.CLI.Tool. Its command is pac. Common commands:

TEXT
pac auth create --environment https://yourorg.crm.dynamics.com
pac solution export --name MySolution --path ./out --managed
pac solution unpack --zipfile ./out/MySolution.zip --folder ./src/MySolution
pac solution pack --folder ./src/MySolution --zipfile ./out/MySolution.zip --packagetype Managed
pac solution import --path ./out/MySolution.zip
pac solution version --strategy solution --value 1.2.0.0

(pac auth create signs you in; unpack turns the zip into many readable files; pack rebuilds the zip.) Run pac --help and pac solution --help to see the commands for your installed version, since options evolve.

Source control with unpacked solutions

A solution zip is a binary blob that Git cannot diff. Unpack it, and each component becomes its own file (XML or JSON, and for canvas apps the unpacked app source). Commit those files:

  1. Make changes in the Dev environment.
  2. pac solution export (unmanaged) then pac solution unpack into your repository folder.
  3. git add, git commit and open a pull request to review the diff.
  4. A build pipeline runs pac solution pack and imports to Test.

Team tips:

  • Use one dev environment per maker or per feature when several people change the same solution; two makers editing one app in one environment overwrite each other.
  • Keep source control as the truth and the dev environment as a workspace.
  • Never edit production directly; fix forward through the pipeline.

Release path

Dev Unmanaged solution
Git Unpacked source, review
Test Managed import
Prod Approved deployment
1 / 2

Version numbers: a stand-in

Solution versions have four parts, major.minor.build.revision. Importing a managed solution upgrades only if the version is higher. This stand-in compares versions and picks the next one, the logic a release script needs.

JS Stand-in: compare and bump solution versions

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Notice 1.10 is newer than 1.2 because each part is compared as a number, not as text.

A release gate: a stand-in

Pipelines often add checks before deploying to production. This stand-in models a gate that blocks a release when conditions fail.

JS Stand-in: release checklist gate

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Automating with a build service

You can run the same pac commands in GitHub Actions or Azure DevOps using Microsoft's Power Platform build tools. The pattern is the same: authenticate with a service principal (an app registration with rights in the environments, not a person's password), export, unpack, commit, then pack and import on a trigger. Store secrets in the service's secret store, never in the repository.

Good habits

  • Increase the version on every release.
  • Deploy only managed solutions to Test and Prod.
  • Keep a short release note with each version.
  • Test upgrades, not only fresh imports: import version N, then N+1.
  • Take a backup of production before the deployment (admin center, Backup & restore).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why unpack a solution before committing to Git?

    A binary zip cannot be diffed; unpacked component files can.
  2. 2. Which CLI command rebuilds a solution zip from source files?

    pack turns the unpacked folder back into a zip.
  3. 3. Which credential should an automated pipeline use?

    A service principal is an identity for automation, with only the rights it needs.
  4. 4. Which version is newer, 1.10.0.0 or 1.2.0.0?

    Each part is a number, and 10 is greater than 2.

Summary

  • Pipelines give guided, logged deployments; the pac CLI scripts export, unpack, pack and import.
  • Unpack solutions into Git for reviewable diffs and treat source control as the truth.
  • Automate with a service principal in GitHub Actions or Azure DevOps; never store secrets in the repo.
  • Bump versions, deploy managed, test upgrades and keep backups.

Next: Environment Variables and Connection References