Skip to main content

How to List Connections with pac connection list

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

pac connection list prints every connection in a Power Platform environment, with the ID that tools such as a deployment settings file ask for. One command, no clicking through the portal.

A connection is a signed-in link from an environment to a service, such as SharePoint or Office 365 Users. Apps and flows use them, usually through connection references. When you install a solution from the command line, you have to name the connection for each reference by its ID, and this command shows those IDs.

Syntax​

Syntax
pac connection list [--environment <environment>]
PartWhat it is
pac connection listThe command. Microsoft's pac connection reference describes it as "List all Connections."
--environment <environment>Optional, short form -env. The environment to list, "a Guid or absolute https URL." Without it, the CLI uses "the active organization selected for the current auth profile."

It needs a signed-in profile (How to Sign In to the Power Platform CLI with pac auth create). In my run it listed only my own connections, although three other people had opened an app in that environment and allowed its connections.

The example lists the connections in a trial environment called Overtime Timesheet Demo, the environment my profile has selected.

Step 1: Check Which Environment Your Profile Uses​

pac connection list doesn't print the environment's name, so check it first:

Terminal
pac env who
Output (first lines)
Connected as admin@example.com
Connected to... Overtime Timesheet Demo

If it's the wrong one, select another with pac env select, or add --environment to the command in the next step.

Step 2: List the Connections​

Terminal
pac connection list
Output
Connected as admin@example.com
Id Name API Id Status
shared-sharepointonl-00000000-0000-0000-0000-000000000000 admin@example.com /providers/Microsoft.PowerApps/apis/shared_sharepointonline Connected
shared-excelonlinebu-00000000-0000-0000-0000-000000000000 admin@example.com /providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness Connected
shared-office365grou-00000000-0000-0000-0000-000000000000 admin@example.com /providers/Microsoft.PowerApps/apis/shared_office365groups Connected
shared-office365user-00000000-0000-0000-0000-000000000000 admin@example.com /providers/Microsoft.PowerApps/apis/shared_office365users Connected
shared-office365-00000000-0000-0000-0000-000000000000 admin@example.com /providers/Microsoft.PowerApps/apis/shared_office365 Connected
shared-approvals-00000000-0000-0000-0000-000000000000 Standard approvals /providers/Microsoft.PowerApps/apis/shared_approvals Connected

A Terminal window with pac connection list and its six rows: SharePoint, Excel Online (Business), Office 365 Groups, Office 365 Users and Office 365 Outlook connections named admin@example.com, and an Approvals connection named Standard approvals, all Connected

Step 3: Read the Columns​

ColumnWhat it holdsIn the example
IdThe connection's ID: shared-, the start of the connector's name, and a unique IDshared-office365user-… for Office 365 Users
NameThe connection's display name, usually the account it signed in withadmin@example.com; the Approvals one is called Standard approvals
API IdThe connector the connection is for/providers/Microsoft.PowerApps/apis/shared_office365users
StatusWhether the connection worksAll six Connected

The API Id is the same value a deployment settings file calls ConnectorId, which is how you match a connection to a connection reference (How to Set Connection References in a Deployment Settings File).

Step 4: Find One Connector's Connection​

With many connections, filter the output for the connector's name:

Terminal
pac connection list | grep office365users
Output
shared-office365user-00000000-0000-0000-0000-000000000000 admin@example.com /providers/Microsoft.PowerApps/apis/shared_office365users Connected

grep and Select-String keep only the lines that contain the text. PowerShell printed the same line, wrapped over three lines here. The first part, up to the first space, is the connection ID.

Common Mistakes​

MistakeWhat happensDo this instead
Running it against the wrong environmentYou get IDs that mean nothing in the environment you're installing intoCheck with pac env who, or add --environment
Copying the Name instead of the IdA display name isn't an IDCopy the whole value from the Id column
Using a connection that isn't ConnectedFlows that use it won't runFix or recreate the connection first

Troubleshooting​

SymptomLikely causeFix
No connection for a connectorNobody has created one in this environmentCreate it in Power Apps under Connections, then list again
No active environment set for the current auth profileThe profile has no environmentpac env select, or --environment on the command
Connections you know exist are missingThey belong to someone else and aren't shared with youAsk the owner to share them, or use your own

FAQ​

Is this the ID Power Apps shows?​

Microsoft's deployment settings article suggests reading the connection ID from the address of the connection's page in Power Apps. The Id column gives it without opening each connection, and a settings file filled with these IDs imported without errors.

Does it show the password or token?​

No. It shows the ID, display name, connector and status, nothing that signs in.

Conclusion​

pac connection list shows each connection's Id, Name, connector (API Id) and Status. Check the environment with pac env who, list, and filter for the connector you need.

Additional Resources​