Open TheOnlyWei opened 4 years ago
My guess is that this code was added to "preemptively fail" the auth scenarios where the account has something like MFA enabled, and the authentication requires interactivity for some UI like a browser. However, this is only the case for accounts with those security properties enabled. For user accounts that do not require MFA, they can successfully authenticate using their username and password. Instead, the cmdlet can attempt the login flow and allow the error from AAD to be presented to the user, something like "Unable to complete the silent authentication flow. User interactivity is required. Please use a different account, a service principal, or the device login flow to proceed".
I encountered same error, in enterprise environment, we don't prefer to use service principal, any idea on support work account with password?
Description
I was advised I should create a bug report for not being able to log in using username and password in Powershell core. This makes things difficult when we port our tests from Windows Powershell to Powershell Core since we rely on authenticating in Azure Stack using username and password before we can create service principals to use. Even then, service principals are limited in privilege and cannot be used to test everything.
I have been writing work-arounds to the rule against username and password authentication in Powershell Core, but if username and password should be supported and is a simple fix, then I would rather wait for that instead of writing work-arounds that I have to change again in the future.
This is the related source code: https://github.com/Azure/azure-powershell/blob/Az.Accounts-preview/src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs#L269
But we are using modified versions of the Az modules to test with Azure Stack, so those modules would need to be changed as well.
Steps to reproduce
Simply attempt to run Connect-AzAccount in a Powershell Core session using username and password authentication such as:
Environment data
Module versions
Debug output
Error output