PowerApps — Canvas app connection with custom connector not mapped correctly with Solution Import

I recently came across an issue while deploying a canvas app developed by me which utilizes custom connector.

Everything worked well till deploying custom connector in target environment. Once custom connector is deployed, you deploy the managed solution containing canvas app and no errors on import are reported. Looks like everything is good, but wait when you try to play the canvas app it is not successful.

Culprit is the connection to custom connector inside canvas app ,which is not refreshed automatically to point to the custom connector on target environment.

Problem Background: In order to utilize custom connector method, my canvas app needs to add connection to custom connector in ‘Data Sources’.

When you export this package as a Managed solution and try to import in the target environment , this connection is not updated accordingly. Since canvas app supports only the connection references for implicit connections (like SQL server) , this connection is no where created as Connection Reference in the solution and there is no way to select it while importing the solution to point to new custom connector on target environment

Root Cause: Upon checking the exported solution zip, you still see the reference in <Solution zip> / customizations.xml to point to the old connection id.

How to check connection id: Extract solution zip file and Navigate to Solution zip> / customizations.xml. Search for the tag <ConnectionReferences>

It lists all the connections made inside app and search the one used for custom connector. Type in your custom connector name and you can find it under “id” attribute .

When imported as it is on target environment, it is expected to break since connection id for custom connector connection id will be different on each environment.

Resolution:

Update the customizations.xml for the new connection id of target envt and import the updated zip file. This resolved the connection mapping issue.

To update the connection id, search for you specific custom connector and update the highlighted value below .This is the connection id being used inside app.

Screenshot for customizations.xml file under connectionReferences tag. My app is utilizing demo_TestAPI custom connector :

How to find connection id for target envt:

Prerequisite is connection needs to be created on target envt .Navigate to dataverse>connections

Click on connection existing to point to your custom connector,If not create one for your custom connector.

Click on the connection and look at the URL in browser window. It contains the connection id for this new connection. URL will look like below :

Values after connections/<> is our connection id. Update this in customizations.xml file and replace the updated file in solution zip.

Now , you can import the updated zip file for solution on new environment and canvas app will have automatically pointing the new connection on target envt.

This blog is part of Power Platform Week.

About the Author

Microsoft Power Platform Enthusiast

Reference

Jeena, P., 2023, PowerApps — Canvas app connection with custom connector not mapped correctly with Solution Import, Available at: PowerApps — Canvas app connection with custom connector not mapped correctly with Solution Import | by Preeti Jeena | Jan, 2023 | Medium [Accessed on 19 January 2023]

Share this on...

Rate this Post:

Share: