Login-AzureRmAccount fails with MFA error for a regular account not enabled for MFA
We notice that Login-AzureRMAccount for a regular account for which MFA is not enabled, ends up failing with a MFA error.
[error]AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access 'XXX'.
The issue was reported in VSTS task which is consumer of this command. Refer - https://github.com/Microsoft/vsts-tasks/issues/2290.
Issue reported by customer: •we have MFA only for Azure admins •the account we use in the Azure service endpoint in VSTS is not an admin and does not have MFA enabled •this error is intermittent, it appears haphazardly in release tasks, and disappears after a retry without any changes
@kmkumaran This issue comes from AAD and not PowerShell. Please include more details of an actual ADAL stack trace during a failure, and we may be able to provide some guidance. Otherwise, I will have to close as no repro
@efridman - can you provide the required traces.
@kmkumaran @efridman You can get adal traces by setting $DebugPreference="Continue" before running the login cmdlet
@kmkumaran The login cmdlet is run as part of the VSTS task, before our script starts executing, so we can't add this trace before it. Is there any other way to enable an ADAL trace when using the Azure PowerShell VSTS task?
@efridman You can use powershell profiles to set up the powershell environment for every session, see: https://technet.microsoft.com/en-us/library/bb613488(v=vs.85).aspx
Closing as no repro. Please open a new issue if you can get ADAL traces.