Skip to main content

Notifications

Announcements

No record found.

Deploy Power Automate using Azure DevOps

Summary

Step-by-step instructions from ZERO to move Power Automate flow from Dev to QA via Azure DevOps Pipeline without user interaction. The flow uses Microsoft Dataverse and Office 365 Outlook connector, as the following shows.

6180.pastedimage1677592318938v1.png

    Steps including:

  1. Create Service Principal (Azure AD Application).
  2. Create a Dataverse Application User.
  3. Create Azure DevOps Service Connection to connect to Dataverse.
  4. Share connections with Service Principal.
  5. Deployment setting to link connection reference with connection in the target environment.
  6. Deploy the solution via Azure Pipeline.

Service Principal Configurations

Create Service Principal (Azure AD Application)

  1. Navigate to Azure Portal, and Azure Active Directory.
  2. Click “App registrations” then “New registration.”
  3. Input a Name, select a supported account type then “Register.”
  4. Click “API permissions” to add Dynamics CRM.

 3618.CreateAzureADApp.gif

Tutorial: Register an app with Azure Active Directory (Microsoft Dataverse)

Create Dataverse Application User

  1. Navigate to the Power Platform admin center then select the environment.
  2. Click “Settings” on the ribbon then search for “Application users.”
  3. Click “New app user” on the ribbon then create the Application user.
    1. Add the App registered.
    2. Select the top business unit.
    3. Add “System Administrator” role.

 5775.CreateApplicationUser.gif

Manage application users in the Power Platform admin center - Power Platform

Azure DevOps Service connection

  1. Browser marketplace to install the Power Platform Build tool” if not already.
  2. Click “Project Settings” to add “Service connections.”
  3. Create the Power Platform service connection.
    1. Service URL: The environment URL.
    2. Tenant ID: Direct(tenant) ID in Azure App Overview.
    3. Application ID: Application (client) ID in Azure App Overview.
    4. Client secret: New or existing from Azure App Certificates & secrets

 7317.CreateServiceConnection.gif

Microsoft Power Platform Build Tools for Azure DevOps - Power Platform

Connection in the target environment

To make connections visible to the Service Principal during solution deployment, Connections need to be created in advance and shared with the Service Principal. It is a one-time step-up for each connection.

Create a connection and share the connection with Service Principal

 3107.CreateShareConnection.gif

 

Azure DevOps Pipeline

Create deployment Setting.

Deployment setting can be used to link the connection references with the connections in the target environment during the deployment.

  1. Export solution from the Dev environment.
  2. Use PAC CLI to create a deployment setting for the QA environment.
    1. “pac solution export” to export the solution from your dev.
    2. “pac solution create-settings” to create a deployment setting file.
  3. Fill in “ConnectionId” for each connection.

1614.DeploymentSetting.gif

Refer here for details steps: Pre-populate connection references and environment variables for automated deployments using Power Platform Build Tools

pac commands used in this step:

Microsoft Power Platform CLI auth command group

Microsoft Power Platform CLI solution command group

Git Configuration

Set up a Git repository to source control the unpacked Power Automate flows with its deployment setting. Later Azure Pipeline definition (Yamal file) will also be added to the source control.

  1. Initial a git repository.
    1. Navigate to Azure DevOps and click “Repos.”
    2. Click “Initialize” to create a new Repo for the DevOps Project.
  2. Export then unpacks the solution.
    1. “pac solution export” to export the solution from your dev.
    2. “pack solution unpack” to unpack the solution into files.
  3. Commit the source file for the Power Automate and Deployment setting file.
    1. Navigate to “Repos” and click “Clone” to get the command line for initialing the git.
    2. Execute the command line to initial the Repo locally under the same folder you unpack the solution.
    3. Committing the local changes to Azure DevOps Server using the preferred tool, Git extension for Visual Studio was used in the demo.

 4503.GitConfigurate.gif

pac commands used in this step:

Microsoft Power Platform CLI solution command group

Azure Pipeline to release to QA.

Set up an Azure Pipeline to release the managed solution to the QA environment using the following tasks from the "Power Platform Build tool."

  1. Power Platform Tool Installer
  2. Power Platform Pack Solution
  3. Power Platform Import Solution

In Task #3, You can specify the deployment setting file used for the solution import. So, the connection reference in your solution will link to the connection in the target environment. Flows in the solution would stay active as in the previous step. We shared the connections with the Service Principal used by the Azure Service connection. Navigate to “Pipelines” under “Pipelines.”

  1. Click “New pipeline.”
  2. Select “Azure Repos Git.”
  3. Select the Repo setup for the source control.
  4. Select “Existing Azure Pipelines YAML file.
  5. Select the YAML file (YAML schema reference ) and click “Continue.” 
  6. Click “Run” to save the pipeline.

 6560.Pipeline.gif

If the project still uses the classic pipeline, we recommend referring to Migrate from Classic to YAML pipelines - Azure Pipelines to start using YAML pipelines. It allows the definition of the pipeline as a set of your source code to be version controlled.

Build took Tasks used in this step:

Build tool tasks - Power Platform

Comments