Power Automate is one of my favorite options for automating GIS workflows. Getting started using Power Automate with ArcGIS is a breeze by using the pre-made templates for basic workflows using the ArcGIS connector or the ArcGIS Survey123 connector to interact with feature layers, geocoding, and survey forms. Over the last year as I’ve been using Power Automate for myself and our clients, a recurring issue kept Popping up with connections to ArcGIS. The maximum time a token used for connecting is valid for ArcGIS Online is 14 days. This time limit for the token is typically not a problem if a Flow runs at least every 13 days, because as a Flow runs it allows the token used for the connection to get refreshed. The issue rears its ugly head when a flow hasn’t been used in over 14 days, which will cause a Flow to fail because it cannot connect to ArcGIS Online anymore. Since the goal of automation is to, well, automate things, it was very frustrating having to go in every two weeks and make sure my ArcGIS connection was active and my flow could run if triggered.
While at the Esri Dev Summit this spring, I visited the Power Automate booth to ask the experts what, if anything, can be done to alleviate this issue. While discussing the topic with the experts, one of them posed a potential solution to the 14-day token limit: In theory, there could be a flow that runs on a schedule every week that would just be executing the built-in action of either the Survey123 or the ArcGIS connector, which would prompt a token refresh for the connector.
For Survey123, a possible action to use would be the ‘Get Surveys’ action. When the connector gets a list of surveys for the user, the token will get refreshed for another 14 days. For the ArcGIS connector, a possible action would be to query a feature layer. As long as the designated feature layer exists, the query action will refresh the token for that connector.
After a few months of implementing these automated scheduled flows for all of my various Survey123 and ArcGIS connections in Power Automate, I’m happy to report that I have not had to refresh any tokens for Flows that did not run for over 14 days.
I hope this information is helpful to all who stumble upon this blog post while frustrated with failed Flows due to expired tokens.
Happy Automating!
For assistance automating your GIS workflows, reach out to our team!