Quick Tip: Keeping the ArcGIS Connectors for Power Automate Refresh Token Valid

4963
12
06-30-2024 01:27 PM
SeanKMcGinnis
Esri Contributor
14 12 4,963

Power Automate allows us to automate a variety of tasks. But some flows don't run every day, they may only run once or twice a month. If the connection isn’t used by triggers or actions in other flows, the infrequent execution can introduce an issue. The refresh token that allows us to get a new token is only valid for two weeks. Here is a tip I use to keep my connections valid – create a flow that runs on a weekly basis and queries a feature layer. This uses the connection and will get a new refresh token and prevents it from timing out.

Steps

1. Build a scheduled clod flow that runs once a week at a specific time

Setting up a scheduled flow that will run once a week.Setting up a scheduled flow that will run once a week.

2. Add a ‘Get data from feature layer’ action and set it up to query a feature layer using the ‘Where’ advanced parameter with the query of ‘1=1’ and not return the geometry to reduce the size of the result set. The ‘1=1’ query will return all the records in the feature layer.

NOTE:  You can use whatever query you would like. I use the ‘1=1’ query, it will run against any feature layer without knowing any information about the data structure of the feature layer.

Querying a feature layer will use the connection and get a new refresh token.Querying a feature layer will use the connection and get a new refresh token.

 

In the end, you will have a simple two-step flow that keeps the connection valid and allows the flow to keep running and not throwing an error due to an invalid connection.

Simple flow to keep your connections valid.Simple flow to keep your connections valid.

 

12 Comments
Krocha
by
Frequent Contributor

Doesn't matter what feature layer we use?

NateHollenbeck
Emerging Contributor

@SeanKMcGinnis Thank you for the helpful post! Do I need to do something similar for a Survey123 connection?

*No need to answer my question. I swapped out my Survey123 triggers with the ArcGIS Connector trigger "When a survey response is submitted".

JenniferBorlick
Frequent Contributor

Thanks for the tip! I set mine up to have it email me when the flow runs so I know it ran successfully.

rmcooper_wcpss
Occasional Contributor

It should be noted, this flow requires a Premium subscription to use the "Get data from feature layer" action.

WilliamW
Occasional Contributor

@NateHollenbeck Did swapping away from the Survey123 Connector to the ArcGIS Connector "When a survey response is submitted" work for you? This is an issue I've been battling with my Survey123 connectors every 13 days.

MelissaD1
Occasional Explorer

Thank you for this tip; however, I've found that my Survey123 connection needs refreshing after 14 days even if the flow successfully ran during that time. Would this trick help, or is there something else going on?

WilliamW
Occasional Contributor

Hi @MelissaD1,

That's the mystery I'm trying to solve as well. It would be nice if the Survey123 Connector authentication issue could just be updated to allow for longer times, but it seems this issue has been ongoing for a while. Unfortunately, I created about 12 complex flows using the Survey123 Connector before becoming aware it was an ongoing issue.

SeanKMcGinnis
Esri Contributor

@Mekeke - unfortunately, this tip will not work with the Survey123 Connector. That connector  does not update the refresh token in the same way the ArcGIS Connectors for Power Automate and will always timeout when the token expires, which by default is 14 days.

@WilliamW -The Survey 123 connector is no longer being maintained and all new capabilities will be included in the other ArcGIS connectors. The Survey123 Connector was ported over to the ArcGIS Connectors for Power Automate and that is where it was updated and the issue was addressed. 

WilliamW
Occasional Contributor

@SeanKMcGinnis Thank you for the response. I'll start replacing Survey123 Connectors on my flows with the ArcGIS Connectors.

MichellePatton
New Explorer

Does this work for the ArcGIS Enterprise connectors as well?

McKinneyPatrick_PA
Occasional Contributor

Does the same logic apply to the "Get data from feature layer" for the ArcGIS Enterprise action?

That is, can you use this trick to keep ArcGIS Enterprise connections refreshed automatically?

SeanKMcGinnis
Esri Contributor

Good Day @McKinneyPatrick_PA - yes it will.

Contributors