cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yuryk
Level: Powered On

fixing connection on a schedule

Hi,

I have many flows that connect to various 365 resources (outlook, onedrive, excel and etc...).

All those are working under my credentials, and everything's working great!

 

The problem is, that once every while, the connections is broken and I have to manually connect to the portal and fix it.

image.png

The question is - is there way that I can do it programatically on a schedule? instead of having to connect and fix each and every (there are a lot) connections manually.

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: fixing connection on a schedule

For a flow that needs access to your information you would definitely need to give the service account access to that information. 

 

But in general MFA alone shouldn't require re-authentication of the connection just because the MFA has expired.  The MFA is used at the point where you establish the OAUth connection.  But wouldn't be needed again until the OAuth comes up for renewal, not the MFA. I believe the OAuth refresh token, which is used in place of the user ID and password, timesout at 90 days by default.  There are settings in Azure AD that can shorten this.  Your MFA implementation may have done that, but its not a requirement of MFA.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

6 REPLIES 6
Dual Super User
Dual Super User

Re: fixing connection on a schedule

I am not aware of any way to do this using an automated API.  Its also not a good idea since you would be embedding your user ID and password in any process that does that.  Connections will automatically refresh the OAuth connection on a timed basis.  Normally this works fine.  But some things can interfere, for example when you change your password or when the underlying connection API changes.  These are the kinds of events that make you re-authenticate manually.  Since there isn't one specific cause its hard to even predict when it will happen much less figure out a way to handle it automatically.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
yuryk
Level: Powered On

Re: fixing connection on a schedule

Thx for the quick response.

The problem is that my user has MFA enforcement, which expires.

 

lets try another angle.

Any way I can use flows such as 'When and email is flagged' (or any other O365 action) with a service account that is not set for MFA?

right now i'm working on a flow that will create a To-Do task on flagged emails (there's a template, i know).

Highlighted
Super User
Super User

Re: fixing connection on a schedule

@yuryk just over a year ago I had the same problem. In my case the connection to SharePoint was breaking every 1 hour and others would occasionally need fixing too. The fix I found (to Microsoft's surprise as they didn't suggest it) was to go into PowerApps and have a look at the Connections screen there. At the time I didn't normally go there because that screen is exactly the same as you get with Flow as they share the connections. Just for curiosity I did a "switch account" a couple of times there (I had already done it in Flow with no change in behaviour) and selected my account. An hour later I noticed back in Flow (as it then was) that the connection had refreshed after 1 hour and I was still connected successfully. I have had no problems since.

So give it a go and see if it also works for you.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

Dual Super User
Dual Super User

Re: fixing connection on a schedule

Yes, you can do it with a service account.  The easiest way to do that is to log in as the service account, edit the connections, and publish the flow.  The service account will then be the maker and the connections will run in its context.  This will require assigning a license to the service account since it will be running the flows.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
yuryk
Level: Powered On

Re: fixing connection on a schedule

So in my case the flow needs to access my personal data on my mailbox and others like OneDrive. In that case that service account will need to have full access rights to those features... so that means that organization that work with MFA for all their users, will need to have duplicate accounts (private and a dedicated service account) for each employee...

 

am I missing anything?

Dual Super User
Dual Super User

Re: fixing connection on a schedule

For a flow that needs access to your information you would definitely need to give the service account access to that information. 

 

But in general MFA alone shouldn't require re-authentication of the connection just because the MFA has expired.  The MFA is used at the point where you establish the OAUth connection.  But wouldn't be needed again until the OAuth comes up for renewal, not the MFA. I believe the OAuth refresh token, which is used in place of the user ID and password, timesout at 90 days by default.  There are settings in Azure AD that can shorten this.  Your MFA implementation may have done that, but its not a requirement of MFA.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Coming Soon: T-shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors
Users online (6,229)