05-22-2018 10:47 AM
05-22-2018 10:47 AM
So I activated MFA for both of my accounts. One with my main company and one with my parent company.
My problem is this, using MS Exchange Online Powershell, it autologins when I Connect-Exopssession -UserPrincipalName <my UPN here> for my main account which I don't really think is a good thing from a security standpoint (no user/password prompt, MFA etc.), and 2, when I put the UPN from the other tenant/domain in there, it fails with "Bad request for more information" after actually doing the MFA login.
I had installed Microsoft Online Services Sign-In Assistant which I thought could be the culprit, but getting rid of it and restarting did not help. Any Ideas on how to stop this behavior and make me log in MFA every time instead of passthough and also why it might have broken logging into the other.
Win 10 1709. Azure AD "Connected" not joined to main account, if that matters.
05-22-2018 11:20 AM
Are you connecting to the two accounts within the same PowerShell session? I just did the same, and it works without errors. As expected, just the latest tenant is accessible.
I have MFA enabled on the one account (#1). The first time I log into it I have to MFA as expected. I then switch to the other account (#2) without MFA, and then switch back to the first account (#1). On the reconnection to the first account (#1), the Modern Auth form appears briefly, but automatically disappears. This is because I still have a valid refresh token, and nothing has caused it to expire. So it seamlessly gets a new access token to load PowerShell.
You could look at this article to change the validity of the tokens: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-configurable-token-lifetime...
05-22-2018 01:05 PM
For powershell(Microsoft Exchange Online Powershell to be specific) it didn't even ask once for my main account the first time right after I downloaded it, and I can't get into the second account at all.
I'm thinking it might have something to do maybe that my Win 10 install is "Connected" to Azure AD, it must pass it to things all over the system, including Powershell. I might try disconnecting. This machine is on-prem domain joined, but I also "connected" it to 365 Azure AD since it asked me. (We keep them separate and don't do any sync between on-prem AD and Azure) I don't think it will really break anything and more of a convenience deal + if I had intune policies.
05-23-2018 12:04 AM
That's the new "accounts" feature in W10, you might have noticed the "add this account to Windows" prompts. You can think of it as the Outlook/Office auto-login features, connecting to ExO PowerShell or any other O365/AzureAD service works the same.
And yes, it can definitely cause issues when trying to switch accounts. I'd advise opening a new PS window.
05-23-2018 01:11 PM
It wasn't any of that preventing me getting into the other account. I couldn't get in on my Windows 7 machine either(why I didn't try this when I first had a problem, I don't know) with none of those auto-login things, and even after I turned off MFA and tried the old way. It said "Bad Request for more information" and -2144108173,PSSessionOpenFailed but none of that said Access Denied anywhere.
Still, they could have been a little heavy handed as they were removing power shell access for all the regular users, they might have forgot to remove me from the CSV they used to script removing access.
05-24-2018 01:30 AM
When you say they, do you refer to your security department?
I had a very similar issue yesterday. Received a "Bad Request... Access Denied" error. In our case it was due to new proxy servers added to the farm, but the public IP addresses not being added the the skip MFA for trusted network locations. Once added, the Microsoft Exchange Online PowerShell Module connected without issues again.
05-28-2018 01:05 AM
Would you consider white listing your offices so that you are not prompted for MFA when using Powershell from the office ?