External Providers / Multiple Azure AD Tenants
I am trying to work out how we can support multiple external providers of authentication using IdentityServer4. I will illustrate my thinking with some pictures. We currently have a set of applications, some of which use Identity Server and some which use their own built in login process. The authentication relationships would look like Figure 1:

The seperate apps with their own built in authentication are seperate by customer, we provide a whole new instance to each customer. We now have a requirement where the customers are implementing Azure AD and Office 365 and they want to have automatic sign-in on those seperate apps utilizing their Azure AD service. We therefore anticipate having multiple Azure AD tentants as external providers as well as adding the usuals like facebook and google. What we were thinking was would it be sensible to put IdentityServer 4 in the middle of all authentication where it could provide authentication from either its own user tables or otherwise forward on the request to the relevant external provider as shown in Figure 2:

Problems with this approach would seem to be that how would IdentityServer4 know which external provider to check for single sign on and is sensible to configure all those external providers into the IdentityServer4 startup.
Perhaps another way would be to configure the seperate apps to authenticate directly with Azure AD via OpenIDConnect and then to have an additional OpenIDConnect authentication available against the IdentityServer4 for users like our admins to access the seperate app. Something like in Figure 3.

Is it possible to have multiple Authentication providers for an app and is there an order of preference for which they are tried. How could the users that should authenticate via Azure AD be directed there while the users that should be authenticated via IdentityServer4 be directed to it.
I guess figure2 is better. But both are ok. In my case, the solution should support existing openid solution, integrate it with default identity architecture template provides and support any other social logins in the long run. sure, It's possible to have multiple Authentication provider for an app. In my solution, the last provider will take priority.
If I was to try and implement Figure 2 I could possibly configure the web app as client and then give it a hint as to which AzureAD tenant to attempt to use. Of course it wouldn't necessarily always be that external provider who did the authentication so I would need some way of checking to see if the user was already signed in on that AzureAD domain and if there were they could be logged in, otherwise they would need to be shown the Identity Server login screen with the ability to choose an external provider. This however could be ugly if there are going to be 50 or more Azure AD domains to possibly authenticate against.
In that case perhaps the Figure 3 where Identity Server doesn't need to be aware of all these Azure AD tenants might be a better solution, and then I need to figure out how to secure the app against 2 authentications providers.
What I would want is for the app to first try the AzureAD to see if the user is logged onto that domain, failing that I would want it to try Identity Server to see if the user is logged on there, and finally if neither were already logged in the app would have to show a screen for the user to choose which one they wanted to authenticate off. Does anyone have any samples of how this could be configured using OpenIDConnect?
This seems to be a general question about IdentityServer - not a bug report or an issue.
Please use StackOverflow for that. This has the advantage that questions and answers can be easily found by search engines, and that there are more people answering questions than just us.
For IdentityServer3 https://stackoverflow.com/questions/tagged/?tagnames=identityserver3&sort=newest
For IdentityServer4 https://stackoverflow.com/questions/tagged/?tagnames=identityserver4&sort=newest
For commercial support https://identityserver.io/
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.