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.


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;
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

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

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.