Learn about Power Automate Deployment

Today we will learn basic knowledge regarding the Power Automate deployment model. As you know, when we want to deploy from Dev to UAT, we need those components inside Solution. The basic components of the Power Automate (Flow) and how we are importing it are like the below image:

Flow Power Automate deployment

By default, when we create Power Automate and have the action for instance to create/update data in Dataverse, then we need the Connection Reference. For Dataverse, we have the option to create the connection using the current connection (your user login) or Connect with the service principal (you need to create the App Registration in Azure Active Directory and register the Application User in Dataverse). If you create the connection using Service Principal, then you will need to submit all the below information (based on your App Registration + Client secret that you generated):

Power Automate create service principal connection reference

But if you choose to use your existing connection, you just need to click the Sign In button:

Create connection reference using current connection

For the demonstration, I’ll just a simple flow where we will create Contact data using the existing connection and update the Contact using Service Principal connection:

Demo flow

The logic inside the flow is not really important as what we want to know is how the deployment from 1 environment to another works. So bare with me for this one 😁. Once the flow is ready, we can export (managed solution) and inspect the Customization.xml. My finding is the connections that we are using will be just definitions in the XML:

<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Entities></Entities>
  <Roles></Roles>
  <Workflows>
    <Workflow WorkflowId="{89e13689-ae5c-ed11-9562-002248264979}" Name="Create Contact">
      <JsonFileName>/Workflows/CreateContact-89E13689-AE5C-ED11-9562-002248264979.json</JsonFileName>
      <Type>1</Type>
      <Subprocess>0</Subprocess>
      <Category>5</Category>
      <Mode>0</Mode>
      <Scope>4</Scope>
      <OnDemand>0</OnDemand>
      <TriggerOnCreate>0</TriggerOnCreate>
      <TriggerOnDelete>0</TriggerOnDelete>
      <AsyncAutodelete>0</AsyncAutodelete>
      <SyncWorkflowLogOnFailure>0</SyncWorkflowLogOnFailure>
      <StateCode>1</StateCode>
      <StatusCode>2</StatusCode>
      <RunAs>1</RunAs>
      <IsTransacted>1</IsTransacted>
      <IntroducedVersion>1.0.0.0</IntroducedVersion>
      <IsCustomizable>1</IsCustomizable>
      <BusinessProcessType>0</BusinessProcessType>
      <IsCustomProcessingStepAllowedForOtherPublishers>1</IsCustomProcessingStepAllowedForOtherPublishers>
      <PrimaryEntity>none</PrimaryEntity>
      <LocalizedNames>
        <LocalizedName languagecode="1033" description="Create Contact" />
      </LocalizedNames>
    </Workflow>
  </Workflows>
  <FieldSecurityProfiles></FieldSecurityProfiles>
  <Templates />
  <EntityMaps />
  <EntityRelationships />
  <OrganizationSettings />
  <optionsets />
  <CustomControls />
  <EntityDataProviders />
  <connectionreferences>
    <connectionreference connectionreferencelogicalname="ins_sharedcommondataserviceforapps_3bb66">
      <connectionreferencedisplayname>Microsoft Dataverse Blog-3bb66</connectionreferencedisplayname>
      <connectorid>/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps</connectorid>
      <iscustomizable>1</iscustomizable>
      <statecode>0</statecode>
      <statuscode>1</statuscode>
    </connectionreference>
    <connectionreference connectionreferencelogicalname="ins_sharedcommondataserviceforapps_8573b">
      <connectionreferencedisplayname>Microsoft Dataverse Blog-8573b</connectionreferencedisplayname>
      <connectorid>/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps</connectorid>
      <iscustomizable>1</iscustomizable>
      <statecode>0</statecode>
      <statuscode>1</statuscode>
    </connectionreference>
  </connectionreferences>
  <Languages>
    <Language>1033</Language>
  </Languages>
</ImportExportXml>

As you can see in the above XML, lines 39 – 54 show that the connection reference is just plain metadata. There is no real “secret” information that we can get from the solution.

Import Solution (First Time)

When we import the solution to the other Environment using make.powerapps.com (new UI), the below dialog will be shown to create the connections necessary:

The dialog to create the connections necessary

But when we use the legacy solutions import/via Microsoft Power Platform CLI (pac solution import), it will not ask anything and will be imported directly (after clicking the wizard):

There is no dialog to create new connection using legacy import solution

After the solution is successfully imported (using legacy/Power Platform CLI) when we want to invoke the Flow, it will get an error “Error from token exchange: Permission denied due to missing connection ACL: User = 4e8a594f-68a6-4ad8-be7c-771ed0f9e657@fd1298be-c09f-4349-96e8-bd097210e274 appid=7df0a125-d3be-4c96-aa54-591f83ff541c, connection=unitedstates-002/logicflows/4560daf1-d634-c4f0-6b60-7a9c74d0efde“:

Error when executing the flow

The conclusion is, you need to use make.powerapps.com to import the solution for the first time to ensure the connection references are created:

Once you create the connection in the targeted environment, then you can continue to import the solution:

Once it is done, you can verify the flow:

Test the flow

Deploy Update Solution

If for instance, the flow needs to be modified in the Dev environment:

Changes on the flow in Dev

We need to re-export the solution + import it to the UAT environment. We don’t need to set again the connection as the connection is already in the targeted environment (this time I’m using the “pac solution import” command):

Solution import using Microsoft Power Platform CLI

Then when re-test the flow in the targeted environment, it will be up to date:

Second import no need to use make.powerapps.com to update the flow 😁

Happy CRM-ing!

Advertisement

3 thoughts on “Learn about Power Automate Deployment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.