Exercise - Configure Git integration and a CI pipeline

Completed

In this exercise, you configure Git integration for a development environment and create an automated CI pipeline with a solution checker quality gate in Azure DevOps. You simulate the workflow that Zava's platform team uses to validate solutions automatically before they move toward production, ensuring full traceability and automated quality checks for the Zava Pay solution.

This exercise should take approximately 45 minutes to complete.

Note

Some of the technologies used in this exercise are in active development. Menu options and interface layouts in Azure DevOps and the Power Platform admin center might differ slightly from the steps shown here.

Prerequisites

To complete this exercise, you need:

  • A Power Platform environment with Dataverse (developer or sandbox)
  • An unmanaged solution in your development environment (you can use the Zava Pay solution from earlier exercises, or create a simple solution with at least one table and one app)
  • An Azure DevOps organization with a project created (free tier is sufficient)
  • The Power Platform Build Tools extension installed in your Azure DevOps organization
  • Global Administrator or Power Platform Administrator role to create service principals
  • The Power Platform CLI (pac) installed locally

Important

If you don't have the Power Platform Build Tools extension, install it from the Visual Studio Marketplace before starting this exercise. Navigate to your Azure DevOps organization settings > Extensions to verify it's installed.


Connect your development environment to Git

Source-controlling your Power Platform solutions in Git enables version history, branching, pull requests, and collaboration. In this section, you connect a development environment to an Azure DevOps repository so that solution changes are committed and tracked.

  1. Open the Power Platform admin center.

  2. In the left navigation, select Environments, and then select your development environment.

  3. On the environment details page, select Git integration (under the Resources section).

  4. Select Set up Git integration.

  5. In the configuration panel, provide the following details:

    Setting Value
    Source control provider Azure DevOps
    Organization Your Azure DevOps organization
    Project Your Azure DevOps project
    Repository Your repository (create one named zava-pay-solutions if needed)
    Branch main
    Folder /solutions
  6. Select Connect.

  7. Wait for the connection status to show Connected. This process can take one to two minutes.

Note

If the connection fails, verify that the Azure DevOps organization is linked to the same Microsoft Entra ID tenant as your Power Platform environment. Cross-tenant connections aren't supported.

Commit your solution to the repository

  1. Open Power Apps and go to your development environment.
  2. Select Solutions in the left navigation.
  3. Select the solution you want to source control (for example, Zava Pay).
  4. In the solution view, select Source control from the command bar.
  5. Review the list of components to commit. All solution components appear as new additions.
  6. Enter a commit message: Initial commit of Zava Pay solution.
  7. Select Commit.
  8. Wait for the commit to complete. A success notification appears when finished.

Verify the commit in Azure DevOps

  1. Open your Azure DevOps project in a browser.
  2. Go to Repos > Files.
  3. Confirm that a /solutions folder exists and contains your solution's unpacked files (XML, JSON, and other component files).

Tip

The unpacked solution format stores each component as a separate file, so you can easily review changes in pull requests and track who modified each component.


Create a service principal for pipeline authentication

Automated pipelines need a non-interactive identity to authenticate with Power Platform. Create an application registration in Microsoft Entra ID and register it as an application user in your Power Platform environments.

Register an application in Microsoft Entra ID

  1. Open the Azure portal.

  2. Go to Microsoft Entra ID > App registrations.

  3. Select New registration.

  4. Enter the following values:

    Setting Value
    Name ZavaPay-Pipeline-SP
    Supported account types Accounts in this organizational directory only
    Redirect URI Leave blank
  5. Select Register.

  6. On the app registration overview page, copy and save the Application (client) ID and the Directory (tenant) ID - you need these values later.

Create a client secret

  1. In the app registration, select Certificates & secrets in the left menu.
  2. Select New client secret.
  3. Enter a description: Pipeline automation.
  4. Set expiration to 6 months (or your organization's policy).
  5. Select Add.
  6. Copy the Value of the secret immediately - it's only shown once.

Important

Store the client secret securely. You add it to Azure DevOps as a service connection. Never commit secrets to source control.

Register the application user in Power Platform

  1. Open a terminal or command prompt with the Power Platform CLI installed.

  2. Authenticate to your tenant:

    pac auth create --environment https://yourenv.crm.dynamics.com
    

    Replace the URL with your environment's URL (found in the admin center under environment details).

  3. Register the service principal as an application user:

    pac admin assign-user --environment https://yourenv.crm.dynamics.com --user <Application-Client-ID> --role "System Administrator" --application-user
    

    Replace <Application-Client-ID> with the Application (client) ID you copied earlier.

  4. Verify the command completes without errors. The service principal now has permissions to export and import solutions in this environment.

Note

In a production scenario, assign a least-privilege custom security role rather than System Administrator. For this exercise, System Administrator simplifies the setup.

Create a service connection in Azure DevOps

  1. In Azure DevOps, go to your project and select Project settings (gear icon, bottom-left).

  2. Under Pipelines, select Service connections.

  3. Select New service connection.

  4. Search for and select Power Platform.

  5. Enter the following values:

    Setting Value
    Server URL Your environment URL (e.g., https://yourenv.crm.dynamics.com)
    Tenant ID The Directory (tenant) ID you copied
    Application ID The Application (client) ID you copied
    Client secret The secret value you copied
    Service connection name ZavaPay-Dev-Connection
  6. Check Grant access permission to all pipelines.

  7. Select Save.


Build a CI pipeline with solution checker

Now you create a CI pipeline that automatically exports your solution, runs the Power Platform solution checker for quality validation, and publishes the solution artifact. This pipeline triggers on every commit to the repository's main branch.

Create the pipeline definition file

  1. In Azure DevOps, go to Repos > Files.

  2. Select the root of your repository (not the /solutions folder).

  3. Select New > File.

  4. Name the file azure-pipelines.yml.

  5. Paste the following YAML content:

    trigger:
      branches:
        include:
          - main
      paths:
        include:
          - solutions/**
    
    pool:
      vmImage: 'windows-latest'
    
    variables:
      - name: SolutionName
        value: 'ZavaPay'
      - name: ServiceConnection
        value: 'ZavaPay-Dev-Connection'
    
    stages:
      - stage: Build
        displayName: 'Export and Validate Solution'
        jobs:
          - job: ExportAndCheck
            displayName: 'Export, Check, and Package'
            steps:
              - task: PowerPlatformToolInstaller@2
                displayName: 'Install Power Platform Build Tools'
    
              - task: PowerPlatformExportSolution@2
                displayName: 'Export solution as unmanaged'
                inputs:
                  authenticationType: 'PowerPlatformSPN'
                  PowerPlatformSPN: '$(ServiceConnection)'
                  SolutionName: '$(SolutionName)'
                  SolutionOutputFile: '$(Build.ArtifactStagingDirectory)/$(SolutionName).zip'
                  Managed: false
    
              - task: PowerPlatformChecker@2
                displayName: 'Run Solution Checker'
                inputs:
                  authenticationType: 'PowerPlatformSPN'
                  PowerPlatformSPN: '$(ServiceConnection)'
                  FilesToAnalyze: '$(Build.ArtifactStagingDirectory)/$(SolutionName).zip'
                  RuleSet: '0ad12346-e108-40b8-a956-9a8f95ea18c9'
    
              - task: PowerPlatformExportSolution@2
                displayName: 'Export solution as managed'
                inputs:
                  authenticationType: 'PowerPlatformSPN'
                  PowerPlatformSPN: '$(ServiceConnection)'
                  SolutionName: '$(SolutionName)'
                  SolutionOutputFile: '$(Build.ArtifactStagingDirectory)/$(SolutionName)_managed.zip'
                  Managed: true
    
              - task: PublishBuildArtifacts@1
                displayName: 'Publish solution artifacts'
                inputs:
                  PathtoPublish: '$(Build.ArtifactStagingDirectory)'
                  ArtifactName: 'drop'
                  publishLocation: 'Container'
    

    This pipeline performs four key actions:

    • Exports the unmanaged solution from your development environment.
    • Runs Solution Checker against the exported solution to detect quality issues (the RuleSet GUID corresponds to the "Solution Checker" ruleset).
    • Exports the managed version for deployment to downstream environments.
    • Publishes both artifacts so a release pipeline can consume them.
  6. Select Commit to save the file to the main branch.

  7. Enter a commit message: Add CI pipeline with solution checker.

  8. Select Commit.

Tip

The paths trigger filter ensures the pipeline only runs when files in the /solutions folder change. This filter prevents unnecessary builds when you modify the pipeline YAML or documentation files.

Run the pipeline

  1. In Azure DevOps, go to Pipelines in the left menu.
  2. You see a pipeline that's automatically created from azure-pipelines.yml. If prompted, select Run pipeline.
  3. If the pipeline doesn't appear, select New pipeline > Azure Repos Git > select your repository > Existing Azure Pipelines YAML file > select /azure-pipelines.yml > Run.
  4. Wait for the pipeline to execute. Monitor the progress by selecting the running pipeline.

Review pipeline results

  1. After the pipeline completes, select the completed run to view its summary.
  2. Expand the Export, Check, and Package job to review each step's logs.
  3. Select the Run Solution Checker step and review the output. Look for:
    • The number of issues found (Critical, High, Medium, Low)
    • Specific component names and rule violations (if any)
  4. Navigate to the Artifacts section (published artifacts) and verify that both ZavaPay.zip (unmanaged) and ZavaPay_managed.zip (managed) are available.

Note

If the solution checker reports critical issues, investigate them by reviewing the detailed results. Common issues include deprecated API usage, accessibility violations, and missing component dependencies. In a real workflow, you would fix these before merging.


Continuous deployment (conceptual overview)

With the CI pipeline producing validated, managed solution artifacts, the next step in a complete ALM workflow is continuous deployment (CD). Due to time constraints, this section describes the CD pattern conceptually rather than implementing it fully.

A CD pipeline for Power Platform typically includes these stages:

  1. Deploy to Test - Import the managed solution artifact into a test environment using PowerPlatformImportSolution@2. Configure the stage to trigger automatically after a successful CI build.
  2. Run validation tests - Execute automated tests (such as Power Apps Test Engine or custom API tests) to verify the solution works correctly in the target environment.
  3. Approval gate - Add a manual approval before production deployment. In Azure DevOps, configure this using environment approvals under Pipelines > Environments.
  4. Deploy to Production - Import the managed solution into the production environment after approval.
  5. Rollback strategy - If deployment fails or post-deployment validation detects issues, re-deploy the previous solution version from an earlier artifact. Azure DevOps retains build artifacts, allowing you to re-run a release with a known-good version.

Tip

For Zava Pay's PCI-DSS compliance requirements, the approval gate is critical. Configure at least two approvers for production deployments, and enable the "Requester cannot approve their own changes" option in your Azure DevOps environment settings.


Success criteria

Verify that you have completed the exercise successfully by confirming the following:

  • Your development environment shows Connected status for Git integration in the Power Platform admin center.
  • Your Azure DevOps repository contains unpacked solution files in the /solutions folder.
  • A service connection named ZavaPay-Dev-Connection exists in your Azure DevOps project settings.
  • The CI pipeline (azure-pipelines.yml) runs successfully and completes all four steps.
  • Solution checker results are visible in the pipeline logs.
  • Both unmanaged and managed solution ZIP files are published as build artifacts.

Clean up

If you've finished exploring, clean up the resources you created to avoid unintended usage:

  1. In Azure DevOps, navigate to Pipelines, select your pipeline, select the three-dot menu, and choose Delete to remove the pipeline.
  2. In Azure DevOps > Project settings > Service connections, delete the ZavaPay-Dev-Connection service connection.
  3. In the Azure portal, navigate to Microsoft Entra ID > App registrations, find ZavaPay-Pipeline-SP, and select Delete.
  4. In the Power Platform admin center, navigate to your environment's Git integration settings and select Disconnect to remove the Git connection.

Note

If you plan to continue with subsequent exercises in this learning path, you may want to keep these resources in place. Only clean up when you are finished with all exercises.