Power Platform connections
- Posted on April 4, 2022
- Estimated reading time 6 minutes
As part of the Power Platform series of blog posts, that we intend to publish monthly, I am very excited to write the first post around Power Platform connections and connection references. It is assumed that the readers of this blog have some experience with Power Automate cloud flows to understand the nuances of a connector and the respective connections.
Please note that the details presented below were latest at the time of writing. With Microsoft making updates to the platform on a regular basis, it is possible that some of the details may below be deprecated at the time of publishing.
Why connections and connection references are important?
When Power Automate was introduced with the concept of connectors to integrate with different application sources, all developers created connections on the fly when building flows. This has resulted in hundreds of connections created in an environment. For organizations with a smaller number of developers, this may not be an issue. However, for large organizations, this will rapidly degrade the environment and make maintenance a cumbersome task.
Fig 1: Multiple connections in an environment
Though Microsoft introduced the concept of “connection references” in late 2020, this has still not caught on with most of the Power Automate developers. Developers continue to build automations by creating connections on the fly and spend time re-binding them when migrating to a different environment.
This specific blog will focus on two topics:
1. What are connection references?
2. How to create connection references when building Power Platform solutions
dependent on the scenario?
Connector: Per Microsoft, a connector is a proxy or a wrapper around an API that allows the underlying service to talk to Microsoft Power Automate, Microsoft Power Apps, and Azure Logic Apps. It provides a way for users to connect their accounts and leverage a set of prebuilt “actions” and “triggers” to build their apps and flows.
Connection: A connection refers to an authenticated instance of each action/trigger associated with a connector. In short, each action or trigger in a flow will be bound to a specific connection.
Solution and solution-aware flows
In-order to understand the concept of connections and connection references, we should discuss what solutions and solution-aware flows are.
- Solutions are logical grouping of all components that complete the software/solution being built (e.g., flows, apps, tables, connection references, environment variables, etc.) to become portable and making it effortless to move them and all the components from one environment to another.
Fig 2: Solution component view
- Solution-aware flows are flows that are created within a solution. Flows created within a solution automatically creates connection references which point to a connection or use an existing connection reference within the solution or other solutions depending on the connector type. You can add multiple flows as well as other components within a solution to create a complete package.
- When flows are created outside of a solution within the ‘My Flows’ section, such flows are called ‘non-solution-aware flows’ and they tend to use a connection directly.
What are connection references and why use them?
Connection references as the name implies, provide an abstraction layer between the Power Automate flows and the connections used by the respective triggers and actions. In other words, it is a solution component that contains information about a connector.
Think of a scenario whereby a developer is building Power Automate flows that has the following attributes:
1. Trigger when a record is created in Microsoft Dataverse
2. Action 1 – (Excel Connector) – Find in excel if this record already exists
3. Action 2 – (Excel Connector) – Create the record in excel if it is not found
1. Trigger when a record is deleted in Microsoft Dataverse
2. Action 1 – (Excel Connector) – Find in excel if this record already exists
3. Action 2 – (Excel Connector) – Delete the record in excel if found
In the context of a connection reference, the above scenario will look like the below
Fig 3: Connection references (Source: Microsoft)
If you notice, all the triggers and actions from the Power Automates flow are now using a connection reference which in turn is linked to an actual connection (blue dotted line).
The major benefit of this set-up is that if you want to swap-out the connections (use a different credentials), you will have the ability to update the connection reference only with an existing connection or create a new connection. The change will automatically be reflected in the actions and triggers that are connected to the connection reference.
In addition, you will need to set-up connection references only once per environment as when the solution is imported into the newer environment, it will automatically identify the existing connection references by the type of connector and attach automatically.
Creating connection references
Connection references can be created in a solution in few different ways depending on the need.
A) For instance, if you are building a new flow within a solution
- Determine the type of connector you will be using (e.g., Dataverse Connector, Excel Connector)
- If an existing connection reference* does not exist for the type of connector, do the below:
- Select New ➔ Connection Reference
- On the New Connection Reference Pane, enter the below details
- Display name: Unique name to differentiate this Connection Reference
- Description: A short description of the Connection
- Connector: Select the type of Connector
- Connection: This will display an existing list of Connections available in the environment to choose from. You can also create a new Connection and link it with this Connection Reference if required.
- Click Create. This will create the Connection Reference in this environment.
Fig 4. Connection reference window
The above action will ensure that any flow actions or triggers within this solution utilizing the specific type of connector uses the appropriate connection reference.
B) If you need to update your flows that are outside a solution to use connection references instead of a connection, do the below:
- Create a Solution if you do not have one already.
- Validate the environment has the required connection references or create the connection reference by following the previous section.
- Within the solution, select Add Existing ➔ Automation ➔ Cloud Flow.
- Select the Cloud Flow to be added to the solution.
- Open the Cloud Flow in edit mode and check Flow Checker, which will want that the flow is using connections and it is recommended to use connection references. Clicking this warning will remove all connections and display the available connection references to choose from.
- Repeat this exercise for all flows that are imported into the solution.
Fig 5: Flow checker warning on connection references
C) If you need to import a solution with Connection References into a new environment, do the below
- Go to Solutions ➔ Import and choose the Managed/Unmanaged solution you would like to import
- The platform will automatically detect the Connection References in the imported solution and prompt to repoint them to appropriate Connections within the environment. The platform also provides the opportunity to select an existing connection in the target environment or create a new Connection if needed.
Fig 6: Import window prompt to select connections
Connection references are a massive improvement to the platform to ease maintenance and enhance the Power Platform ALM capabilities.
In addition, when moving solutions between environments, instead of having to manually update each trigger and actions within a flow to update to the newer connection, you can now import a solution and just repoint the connections references to the appropriate connection.
In short, when you create Power platform implementations, make use of the solution and connection references capability to enhance the experience.
Happy Power Platforming!