<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Liyaquat Lashkariya (Leo)</title>
    <description>The latest articles on DEV Community by Liyaquat Lashkariya (Leo) (@liyaquat_lashkariya).</description>
    <link>https://dev.to/liyaquat_lashkariya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2930696%2Fc087c583-b488-4190-915f-10e6d76239af.jpg</url>
      <title>DEV Community: Liyaquat Lashkariya (Leo)</title>
      <link>https://dev.to/liyaquat_lashkariya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/liyaquat_lashkariya"/>
    <language>en</language>
    <item>
      <title>Consolidating Power Automate Flows to a Single Connection Reference with PAC CLI</title>
      <dc:creator>Liyaquat Lashkariya (Leo)</dc:creator>
      <pubDate>Mon, 18 May 2026 19:19:30 +0000</pubDate>
      <link>https://dev.to/liyaquat_lashkariya/consolidating-power-automate-flows-to-a-single-connection-reference-with-pac-cli-152p</link>
      <guid>https://dev.to/liyaquat_lashkariya/consolidating-power-automate-flows-to-a-single-connection-reference-with-pac-cli-152p</guid>
      <description>&lt;p&gt;&lt;em&gt;A friendly, end-to-end walkthrough for Power Platform admins and developers&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;If you've inherited (or grown) a Power Platform solution where every flow has its own connection reference for the same connector, you already know the pain: every new environment means re-mapping a dozen references, every connection rotation cascades into a dozen failures, and "who owns what" becomes a Tuesday-morning archaeology project.&lt;/p&gt;

&lt;p&gt;The cleaner pattern is to consolidate to a single connection reference per connector and have every flow in the solution point at it. That way, when you swap the underlying connection, you swap it once.&lt;/p&gt;

&lt;p&gt;This post walks through the full loop using PAC CLI: installing the tooling in VS Code, authenticating to your dev environment, cloning the solution, editing the flow JSON to point at one shared connection reference, and importing the result back without your flows turning themselves off in the process. There's a small but important warning at the end about who owns what during import — please don't skip it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1xn937jn7w01cs73v8r.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1xn937jn7w01cs73v8r.PNG" alt="Before and after: five flows each with their own connection reference, vs. five flows pointing at a single shared connection reference" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What you'll need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Visual Studio Code installed&lt;/li&gt;
&lt;li&gt;Maker access to a development environment with the solution you want to refactor&lt;/li&gt;
&lt;li&gt;(Optional but recommended) A service principal you can use as the importer — covered in the appendix&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 1 — Install PAC CLI in VS Code
&lt;/h2&gt;

&lt;p&gt;The fastest way to get PAC CLI working is to install the &lt;strong&gt;Power Platform Tools&lt;/strong&gt; extension. It bundles the CLI and wires it up to your integrated terminal automatically.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open VS Code.&lt;/li&gt;
&lt;li&gt;Open the Extensions view (&lt;code&gt;Ctrl+Shift+X&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Search for &lt;strong&gt;Power Platform Tools&lt;/strong&gt; (publisher: &lt;code&gt;microsoft-IsvExpTools&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Install&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Reload VS Code if prompted.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Open a new PowerShell terminal in VS Code (&lt;code&gt;Ctrl+`&lt;/code&gt;) and confirm everything's wired up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pac&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the PAC CLI banner with a version number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Microsoft PowerPlatform CLI
Version: 1.x.x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;pac&lt;/code&gt; isn't recognized in a plain Windows Command Prompt or system PowerShell, that's expected — by default the extension only enables PAC inside the VS Code integrated terminal. If you want it everywhere, install the &lt;a href="https://learn.microsoft.com/power-platform/developer/howto/install-cli-net-tool" rel="noopener noreferrer"&gt;.NET Tool version&lt;/a&gt; or the &lt;a href="https://learn.microsoft.com/power-platform/developer/howto/install-cli-msi" rel="noopener noreferrer"&gt;Windows MSI&lt;/a&gt; alongside it. For this walkthrough, the VS Code terminal is perfectly fine.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2 — Authenticate to your dev environment
&lt;/h2&gt;

&lt;p&gt;PAC CLI uses &lt;em&gt;authentication profiles&lt;/em&gt;. Each profile is a stored connection to a specific tenant and, optionally, a specific environment. Most teams end up with a profile per environment per customer.&lt;/p&gt;

&lt;p&gt;Create a profile pointed at your dev environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pac&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;auth&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Contoso-Dev"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--environment&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://contoso-dev.crm.dynamics.com"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A browser window opens; sign in with your maker account. You can substitute the environment URL for an environment ID, a unique name, or even a partial name — PAC will resolve it.&lt;/p&gt;

&lt;p&gt;Confirm the profile is active:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pac&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;auth&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output looks something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Index Active Kind      Name         Friendly Name   Url                                       User
[1]   *      UNIVERSAL Contoso-Dev  Contoso Dev     https://contoso-dev.crm.dynamics.com/     you@contoso.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you already have multiple profiles and need to switch, use &lt;code&gt;pac auth select --index &amp;lt;n&amp;gt;&lt;/code&gt;. A quick &lt;code&gt;pac auth who&lt;/code&gt; will tell you exactly which environment is currently in play — run it before any destructive command, just to be safe.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip — find your environment ID.&lt;/strong&gt; Open the &lt;a href="https://admin.powerplatform.microsoft.com" rel="noopener noreferrer"&gt;Power Platform admin center&lt;/a&gt;, pick your environment, and copy the &lt;strong&gt;Environment ID&lt;/strong&gt; from the Details pane.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 3 — Clone the solution
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;pac solution clone&lt;/code&gt; is the right tool for this job. It pulls the solution down as a buildable project (with a &lt;code&gt;cdsproj&lt;/code&gt;) and unpacks it into source files you can read, diff, and edit. Use clone (rather than &lt;code&gt;export&lt;/code&gt;) when you want to &lt;em&gt;change&lt;/em&gt; the contents of the solution, not just deploy it.&lt;/p&gt;

&lt;p&gt;From the folder where you want the project to live:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pac&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;solution&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;clone&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ContosoIntegrations&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--name&lt;/code&gt; is the solution &lt;strong&gt;unique name&lt;/strong&gt;, not the display name. Find it under &lt;strong&gt;Solutions&lt;/strong&gt; in the maker portal — it's the column to the right of the display name.&lt;/p&gt;

&lt;p&gt;After it runs, you'll see a folder structure like this (the XML format that &lt;code&gt;clone&lt;/code&gt; emits by default):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ContosoIntegrations/
├── ContosoIntegrations.cdsproj
└── src/
    ├── Other/
    │   ├── Customizations.xml      ← connection references live in here
    │   ├── Solution.xml
    │   └── Relationships.xml
    └── Workflows/
        ├── FlowA-1A2B3C4D....json  ← flow definition (this is what you edit)
        ├── FlowA-1A2B3C4D....xml
        ├── FlowB-5E6F7G8H....json
        └── FlowB-5E6F7G8H....xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two places that matter for this refactor are &lt;code&gt;src/Other/Customizations.xml&lt;/code&gt; (where every connection reference component is defined, all in one file) and &lt;code&gt;src/Workflows/&lt;/code&gt; (one JSON file per flow, named &lt;code&gt;&amp;lt;FlowName&amp;gt;-&amp;lt;GUID&amp;gt;.json&lt;/code&gt;, with a matching &lt;code&gt;.xml&lt;/code&gt; workflow descriptor).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A note on formats.&lt;/strong&gt; If your team uses native Dataverse Git Integration — or a newer &lt;code&gt;pac&lt;/code&gt; CLI configured to emit the YAML source-control format — you'll see a different layout (&lt;code&gt;solutions/&amp;lt;name&amp;gt;/solution.yml&lt;/code&gt;, separate &lt;code&gt;connectionreferences/&lt;/code&gt; and &lt;code&gt;workflows/&lt;/code&gt; folders at the repo root, etc.). The mechanics in this post are the same; you'd just edit &lt;code&gt;connectionreferences/*.yml&lt;/code&gt; and &lt;code&gt;workflows/&amp;lt;flow&amp;gt;/&amp;lt;flow&amp;gt;.json&lt;/code&gt; instead of &lt;code&gt;Customizations.xml&lt;/code&gt; and &lt;code&gt;Workflows/&amp;lt;flow&amp;gt;.json&lt;/code&gt;. For the rest of this walkthrough I'll assume the default XML layout.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 4 — Update the flow JSON to use one connection reference
&lt;/h2&gt;

&lt;p&gt;This is the core of the change. Today, each flow has its own connection reference logical name baked into its definition. We're going to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick (or create) the single connection reference you want all flows to share.&lt;/li&gt;
&lt;li&gt;Edit each flow's definition JSON so its &lt;code&gt;connectionReferences&lt;/code&gt; block points at that shared logical name.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  4a. Pick the canonical connection reference
&lt;/h3&gt;

&lt;p&gt;Open &lt;code&gt;src/Other/Customizations.xml&lt;/code&gt; and find the &lt;code&gt;&amp;lt;connectionreferences&amp;gt;&lt;/code&gt; element. Each connection reference in the solution sits inside it as a &lt;code&gt;&amp;lt;connectionreference&amp;gt;&lt;/code&gt; node. Pick the one you want all flows to point at — say the SharePoint one with logical name &lt;code&gt;contoso_sharedsharepoint&lt;/code&gt;. It will look something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;connectionreferences&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;connectionreference&lt;/span&gt; &lt;span class="na"&gt;connectionreferencelogicalname=&lt;/span&gt;&lt;span class="s"&gt;"contoso_sharedsharepoint"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;connectionreferencedisplayname&amp;gt;&lt;/span&gt;Shared SharePoint&lt;span class="nt"&gt;&amp;lt;/connectionreferencedisplayname&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;connectorid&amp;gt;&lt;/span&gt;/providers/Microsoft.PowerApps/apis/shared_sharepointonline&lt;span class="nt"&gt;&amp;lt;/connectorid&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;description&amp;gt;&lt;/span&gt;Single connection reference for all SharePoint actions&lt;span class="nt"&gt;&amp;lt;/description&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/connectionreference&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;connectionreference&lt;/span&gt; &lt;span class="na"&gt;connectionreferencelogicalname=&lt;/span&gt;&lt;span class="s"&gt;"contoso_flowa_sharepoint"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;connectionreferencedisplayname&amp;gt;&lt;/span&gt;Flow A SharePoint&lt;span class="nt"&gt;&amp;lt;/connectionreferencedisplayname&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;connectorid&amp;gt;&lt;/span&gt;/providers/Microsoft.PowerApps/apis/shared_sharepointonline&lt;span class="nt"&gt;&amp;lt;/connectorid&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/connectionreference&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- ...the other per-flow connection references you're consolidating away... --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/connectionreferences&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the &lt;code&gt;connectionreferencelogicalname&lt;/code&gt; of the one you're keeping — you'll wire every flow to that value next.&lt;/p&gt;

&lt;h3&gt;
  
  
  4b. Update each flow's JSON
&lt;/h3&gt;

&lt;p&gt;Open one of the flow JSON files at &lt;code&gt;src/Workflows/&amp;lt;FlowName&amp;gt;-&amp;lt;GUID&amp;gt;.json&lt;/code&gt;. You're looking for the &lt;code&gt;connectionReferences&lt;/code&gt; node near the top of the definition. Before consolidation it typically looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"connectionReferences"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"shared_sharepointonline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"runtimeSource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"embedded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"connection"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"connectionReferenceLogicalName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"contoso_flowa_sharepoint"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"shared_sharepointonline"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"definition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change &lt;code&gt;connectionReferenceLogicalName&lt;/code&gt; to your canonical reference:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"connectionReferences"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"shared_sharepointonline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"runtimeSource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"embedded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"connection"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"connectionReferenceLogicalName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"contoso_sharedsharepoint"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"shared_sharepointonline"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"definition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Repeat for every flow JSON in &lt;code&gt;src/Workflows/&lt;/code&gt;. If you have a lot of flows, a careful find-and-replace across that folder works well — just make sure the &lt;em&gt;key&lt;/em&gt; under &lt;code&gt;connectionReferences&lt;/code&gt; (e.g., &lt;code&gt;shared_sharepointonline&lt;/code&gt;) matches the connector you're consolidating, and that you only replace the old logical names in &lt;code&gt;connectionReferenceLogicalName&lt;/code&gt;, not the API name in the &lt;code&gt;api.name&lt;/code&gt; field.&lt;/p&gt;

&lt;h3&gt;
  
  
  4c. Clean up the orphaned connection references
&lt;/h3&gt;

&lt;p&gt;Once nothing in any flow JSON points at the per-flow references anymore, remove their &lt;code&gt;&amp;lt;connectionreference&amp;gt;&lt;/code&gt; nodes from &lt;code&gt;src/Other/Customizations.xml&lt;/code&gt;. While you're in there, also remove their entries from the &lt;code&gt;&amp;lt;RootComponents&amp;gt;&lt;/code&gt; block in &lt;code&gt;src/Other/Solution.xml&lt;/code&gt; (look for &lt;code&gt;type="29"&lt;/code&gt; entries with the schema names of the references you're dropping — type 29 is connection references). Keeping only the canonical reference in both files is the whole point of the exercise.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5 — Pack and import the solution back
&lt;/h2&gt;

&lt;p&gt;You have two reasonable patterns here. Both work; pick the one that matches how mature your ALM is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pattern A — Import the updated solution and let the maker portal prompt for connections
&lt;/h3&gt;

&lt;p&gt;From inside the cloned project folder, build and import in one shot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pac&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;solution&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--publish-changes&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(With no &lt;code&gt;--path&lt;/code&gt;, PAC builds the current &lt;code&gt;cdsproj&lt;/code&gt; and imports the resulting &lt;code&gt;.zip&lt;/code&gt;.) When the importing user has connections that match the connector(s) in your remaining connection reference, the import wizard auto-fills them. Otherwise you'll be prompted to pick or create one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pattern B — Import with a deployment settings file (the ALM-friendly way)
&lt;/h3&gt;

&lt;p&gt;This is the path you want for CI/CD or anything reproducible. Generate a deployment settings JSON from the built solution zip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pac&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;solution&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;create-settings&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--solution-zip&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\bin\Debug\ContosoIntegrations.zip&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--settings-file&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\settings\dev.settings.json&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll get a JSON file like this, with one entry per connection reference and one per environment variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentVariables"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ConnectionReferences"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"LogicalName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"contoso_sharedsharepoint"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"ConnectionId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"ConnectorId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Grab the &lt;code&gt;ConnectionId&lt;/code&gt; from the target environment — easiest path is &lt;strong&gt;make.powerapps.com → Connections&lt;/strong&gt;, click the connection, and copy the GUID from the URL (the segment after &lt;code&gt;/connections/&amp;lt;apiName&amp;gt;/&lt;/code&gt;). Paste it into the JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentVariables"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ConnectionReferences"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"LogicalName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"contoso_sharedsharepoint"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"ConnectionId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"9f66d1d455f3474ebf24e4fa2c04cea2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"ConnectorId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then import using the settings file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pac&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;solution&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\bin\Debug\ContosoIntegrations.zip&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--settings-file&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\settings\dev.settings.json&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--publish-changes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--force-overwrite&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the connection ID is wired in up front, the import doesn't have to ask you anything interactively. This is the same shape of file Power Platform Build Tools expects in Azure DevOps pipelines, so you can re-use it.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚠️ Critical: who owns what when you import
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1vn6cijvw0c7my6uzrq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1vn6cijvw0c7my6uzrq.PNG" alt="Two side-by-side outcomes: the bad scenario where the importer has no access to the connection so every flow is imported off, and the good scenario where a service principal with shared connection access imports cleanly with all flows on" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the part everyone learns the hard way exactly once. Skim it, please.&lt;/p&gt;

&lt;p&gt;When a solution containing flows is imported, &lt;strong&gt;Power Automate validates that the importing user can use every connection referenced by every flow&lt;/strong&gt;. If they can't, the affected flows get imported in the &lt;strong&gt;off&lt;/strong&gt; state and have to be turned on manually. With a large solution that you "just" reimported, that can mean &lt;em&gt;every flow in the solution&lt;/em&gt; needs to be re-enabled by hand.&lt;/p&gt;

&lt;p&gt;Two ways to avoid this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 1 — The importer owns the connection.&lt;/strong&gt; Whoever runs &lt;code&gt;pac solution import&lt;/code&gt; should also be the owner of the connection that the (now single) connection reference points to. If you're the person doing the import, make sure you created — or have been gifted ownership of — the connection in the target environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 2 — Import as a service principal that has the connection shared with it.&lt;/strong&gt; This is the right answer for anything beyond a single-developer dev environment. The SPN owns the flows after import, doesn't churn when humans leave or change roles, and pipelines can use it without storing user credentials. Share the connection with the SPN as &lt;strong&gt;Can use&lt;/strong&gt; before you import. Setup is in the appendix.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why "all flows turn off" happens.&lt;/strong&gt; It's the same &lt;code&gt;ConnectionAuthorizationFailed&lt;/code&gt; failure mode you'd hit turning a flow on manually — Power Automate refuses to enable a flow when the activating identity doesn't have rights to every connection it touches. The solution import is just the same check applied to N flows at once.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"&lt;code&gt;pac&lt;/code&gt; is not recognized."&lt;/strong&gt;&lt;br&gt;
You're probably in a terminal outside VS Code. Either run the command in the VS Code integrated terminal (where the extension wires up the PATH) or install the &lt;a href="https://learn.microsoft.com/power-platform/developer/howto/install-cli-net-tool" rel="noopener noreferrer"&gt;.NET Tool&lt;/a&gt; so &lt;code&gt;pac&lt;/code&gt; is available everywhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;pac solution clone&lt;/code&gt; fails with "Solution not found".&lt;/strong&gt;&lt;br&gt;
You're using the display name. Switch to the unique name from the Solutions list. Also confirm &lt;code&gt;pac auth who&lt;/code&gt; is pointed at the correct environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Import succeeds but the flows are turned off.&lt;/strong&gt;&lt;br&gt;
Whoever ran the import doesn't have access to the connection. See the warning above. Either share the connection with that identity (as &lt;strong&gt;Can use&lt;/strong&gt;) and turn the flows on, or re-run the import as a user/SPN that does have access. Once enabled by the connection owner, co-owners can toggle the flow on and off as needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"ConnectionAuthorizationFailed" when activating a flow.&lt;/strong&gt;&lt;br&gt;
Same root cause — the activating user is missing access to at least one connection. Either share all connections used by the flow with that user, or have the connection owner be the one to enable the flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The deployment settings file has empty &lt;code&gt;ConnectionId&lt;/code&gt; values.&lt;/strong&gt;&lt;br&gt;
That's normal — &lt;code&gt;pac solution create-settings&lt;/code&gt; generates the file with empty slots. You fill them in per-environment. Keep one settings file per environment (&lt;code&gt;dev.settings.json&lt;/code&gt;, &lt;code&gt;test.settings.json&lt;/code&gt;, &lt;code&gt;prod.settings.json&lt;/code&gt;) and check them into source control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pack fails after editing JSON.&lt;/strong&gt;&lt;br&gt;
Make sure the JSON is still valid (a stray comma is the usual culprit) and that you didn't change any GUIDs, only the &lt;code&gt;connectionReferenceLogicalName&lt;/code&gt; values. Run &lt;code&gt;pac solution pack&lt;/code&gt; against the cloned folder before importing if you want to validate without round-tripping.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flow shows "Invalid connection" after import.&lt;/strong&gt;&lt;br&gt;
The connection reference is pointing at a connection that's in a bad state — usually expired credentials. Go to &lt;strong&gt;Connections&lt;/strong&gt; in the maker portal, edit/refresh the underlying connection, and the reference will pick it back up.&lt;/p&gt;




&lt;h2&gt;
  
  
  Appendix — Setting up a service principal for imports
&lt;/h2&gt;

&lt;p&gt;If you're moving to pipeline-driven deployments, do this once and you'll thank yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  A1. Register the application in Microsoft Entra
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;a href="https://entra.microsoft.com" rel="noopener noreferrer"&gt;Microsoft Entra admin center&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Identity → Applications → App registrations → New registration&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Give it a name like &lt;code&gt;pp-deployer-spn&lt;/code&gt;. Single tenant is fine.&lt;/li&gt;
&lt;li&gt;After registration, note the &lt;strong&gt;Application (client) ID&lt;/strong&gt; and &lt;strong&gt;Directory (tenant) ID&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Certificates &amp;amp; secrets&lt;/strong&gt;, create a new &lt;strong&gt;Client secret&lt;/strong&gt;. Copy the value immediately — you can't view it again.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  A2. Create the application user in Dataverse
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;a href="https://admin.powerplatform.microsoft.com" rel="noopener noreferrer"&gt;Power Platform admin center&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Pick your target environment → &lt;strong&gt;Settings → Users + permissions → Application users&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New app user&lt;/strong&gt;, find the registration from A1, pick the business unit, and assign a security role with enough permissions for what your pipeline does (often &lt;strong&gt;System Customizer&lt;/strong&gt; plus a custom "deployer" role).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  A3. Authenticate PAC CLI as the SPN
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pac&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;auth&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Contoso-Dev-SPN"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--environment&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://contoso-dev.crm.dynamics.com"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--applicationId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;APP-CLIENT-ID&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--clientSecret&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;CLIENT-SECRET&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;--tenant&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;TENANT-ID&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  A4. Share the connection with the SPN
&lt;/h3&gt;

&lt;p&gt;Back in the maker portal:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Connections&lt;/strong&gt; → click your shared connection (e.g., the SharePoint one).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Share&lt;/strong&gt; → search for the application user you created.&lt;/li&gt;
&lt;li&gt;Set permission to &lt;strong&gt;Can use&lt;/strong&gt; → &lt;strong&gt;Save&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Repeat for every connection your single connection reference is going to be wired to.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note.&lt;/strong&gt; OAuth connections can only be explicitly shared with a user representing a service principal — not with security groups. If you have multiple SPNs (one per environment), share with each one explicitly.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  A5. Import as the SPN
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;pac auth select&lt;/code&gt; to make the SPN profile active, then run your &lt;code&gt;pac solution import&lt;/code&gt; as in Step 5. Because the SPN owns (or has been granted access to) the connection, the flows come in enabled and stay enabled across redeployments — no more "every flow is off" Monday mornings.&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;A single shared connection reference is one of those changes that feels like a small refactor and pays you back every single deployment thereafter. The mechanical part — clone, edit JSON, import — is straightforward once you've done it once. The part that bites people is ownership: make sure the identity doing the import has access to the underlying connection, or you'll spend the next hour turning flows back on by hand.&lt;/p&gt;

&lt;p&gt;If you want to take the next step, wire the deployment settings JSON and the SPN into an Azure DevOps pipeline using the Power Platform Build Tools. At that point you've gone from "manual refactor" to "every environment is one click."&lt;/p&gt;




&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/power-platform/developer/cli/reference/auth" rel="noopener noreferrer"&gt;Microsoft Power Platform CLI — pac auth reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/power-platform/developer/cli/reference/solution" rel="noopener noreferrer"&gt;Microsoft Power Platform CLI — pac solution reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/power-platform/developer/howto/install-vs-code-extension" rel="noopener noreferrer"&gt;Install the Power Platform Tools Visual Studio Code extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/power-platform/alm/conn-ref-env-variables-build-tools" rel="noopener noreferrer"&gt;Pre-populate connection references and environment variables for automated deployments&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/power-apps/maker/data-platform/create-connection-reference" rel="noopener noreferrer"&gt;Use a connection reference in a solution with Microsoft Dataverse&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/power-automate/import-flow-solution" rel="noopener noreferrer"&gt;Import a solution (Power Automate)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/power-automate/service-principal-support" rel="noopener noreferrer"&gt;Support for service principal owned flows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/power-platform/admin/create-users#create-an-application-user" rel="noopener noreferrer"&gt;Create an application user (Power Platform admin)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>powerautomate</category>
      <category>connectionreference</category>
      <category>cleanup</category>
      <category>paccli</category>
    </item>
  </channel>
</rss>
