azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Login-AzureRmAccount fails with MFA error for a regular account not enabled for MFA

Open kmkumaran opened this issue 10 years ago • 5 comments

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 avatar Sep 21 '16 03:09 kmkumaran

@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

markcowl avatar Sep 24 '16 00:09 markcowl

@efridman - can you provide the required traces.

@kmkumaran @efridman You can get adal traces by setting $DebugPreference="Continue" before running the login cmdlet

kmkumaran avatar Sep 25 '16 06:09 kmkumaran

@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 avatar Oct 06 '16 15:10 efridman

@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

markcowl avatar Oct 17 '16 23:10 markcowl

Closing as no repro. Please open a new issue if you can get ADAL traces.

markcowl avatar Oct 25 '16 17:10 markcowl