Issues with Connection Reference

Posted by

What I hate the most is the issue that resolves by itself. Every issue should have a cause. If I can’t find the cause it drives me crazy.

This is what happened with this issue

Request to Azure Resource Manager failed with error: '{"error":{"code":"InvokerConnectionOverrideFailed","message":"Could not find any valid connection for connection reference name 'shared_sharepointonline' in APIM tokens header."}}'.

The Background

I had a flow that performed some basic read and update operations in Dataverse.

At some point, I decided to add a new action to Update a SharePoint list for Audit trail.

The Error appears

I have a habit of testing my flows using the Test feature in the interface and instead of creating a new instance, I always reuse the values that were passed by the previous instances of the flow.

Every time, I would choose an instance from the list it would fail with the following error

Could not find any valid connection for connection reference name 'shared_sharepointonline' in APIM tokens header.

I triple-checked the connection parameters but couldn’t get the flow working.


I had a suspicion that it could have something to do with the way I am triggering the flow.

This time instead of using the Test feature, I actually went ahead and initiated the flow naturally by performing the trigger action. In my case, the flow had a SharePoint trigger on Item created, so I created a new item in the list.

And guess what! It worked!

The Real Issue

The issue was not that when we use a previous instance of the flow run to test the feature in runs in the context of the connections it had at that time.

So what’s happening is that Flow is saying that it could not find a connection in the “context” of the previous run.

In previous runs, it did not have the SharePoint connection because it did not have an SP action.

Lesson learnt

Either trigger the flow naturally based on the trigger conditions or if you are using the Test feature, use the Manual option

This time it will ask you to create the connection, which the flow will use to execute your action.

Hope that helps!

Leave a Reply

Your email address will not be published. Required fields are marked *