Get an alert before connections expire and flows fail

Have you had flow connection expire? For example when your flow owners use MFA and it is time to re-authenticate?

Broken connections

Fix connection in Power Automate

Would you like to get alerted before you get to the Fix Connection situation?

PowerApps and Flow PowerShell might be able to help you.

(Get-AdminPowerAppConnection).Internal.properties

The above command gives you all your connections.

apiId : /providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness
displayName : Pieter.Veenstra@company.co.uk
iconUri : https://az818438.vo.msecnd.net/icons/onedriveforbusiness.png
statuses : {@{status=Error; target=token; error=}}
connectionParameters : @{sku=Enterprise}
keywordsRemaining : 38
createdBy : @{id=e41a2ef4-3c91-4d41-a2ee-5baa222baafe; displayName=Pieter Veenstra; email=Pieter.Veenstra@company.co.uk; type=User; tenantId=c9bb0321-d7ee-4269-93cc-935cbfef6278;
userPrincipalName=Pieter.Veenstra@company.co.uk}
createdTime : 2017-12-08T16:17:07.6285488Z
lastModifiedTime : 2018-09-24T14:29:58.7781845Z
expirationTime : 2018-03-12T17:37:13.1183723Z
testLinks : {@{requestUri=https://europe-001.azure-apim.net/apim/onedriveforbusiness/b7da6808a2923cda91e94760a6a670fa/testconnection; method=get}}
environment : @{id=/providers/Microsoft.PowerApps/environments/Default-c9bb0321-d7ee-4269-93cc-935cbfef6278; name=Default-c9bb0321-d7ee-4269-93cc-935cbfef6278}

All your connections will show as connected except for the failed one. But we want to catch the problems before they happen.

To make sure that you only get the failed connections you could even go for something like this:

(Get-AdminPowerAppConnection -EnvironmentName "Default-c9bc0321-d7ee-4269-93cc-935cbfef6278").Internal.properties | Where { $_.statuses -like "*Error*"}

Once you’ve got the list of connections that need to be fixed, sending out an alert should be easy.

Ok, So I didn’t get to the BEFORE a connection expires but at least I can get fairly close to the connection having expired.

Using Power Automate instead

Would you like to use Power Automate instead of Powershell? Have a look at the following post:

Broken Connections Using Power Automate


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Avatar of Pieter Veenstra

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/ Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/ You can contact me using contact@sharepains.com

Related Posts

2 thoughts on “Get an alert before connections expire and flows fail

  1. Hi good morning. I used this powershell admin command with a service account but I didn’t get any values returned. Do you know why? Thanks!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading