Script not continuing after Connect-AzAccount -UseDeviceAuthentication

Frank van Graafeiland 166 Reputation points
2021-06-26T09:05:12.527+00:00

Hi Guys,

For about two weeks now, I'm experiencing that my scripts using "Connect-AzAccount -UseDeviceAuthentication" are not continuing after entering the given code at https://microsoft.com/devicelogin. I've also noticed that an extra step has been added at the end of the authentication procedure. Perhaps that has something to do with it?

Anyway, the way the cmdlet operates, or the way Azure CloudShell deals with the cmdlet, has probably been changed in some way, which now prevents scripts from continuing.
I'm using Azure CloudShell; invoking the "Connect-AzAccount" without parameters doesn't work there.

Am I the only one experiencing this issue recently or is it a common problem that Microsoft is aware of? Does anybody know a workaround or an alternative I can implement?

Thank you.

Kind regards,

Frank

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,390 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,691 questions
0 comments No comments
{count} votes

Accepted answer
  1. Siva-kumar-selvaraj 15,561 Reputation points
    2021-06-28T18:17:59.74+00:00

    Hello Frank,

    Thanks for reaching out.

    I have tried accessing it from Cloud Shell in my subscription and did not find any issues with DeviceAuth ("Connect-AzAccount -UseDeviceAuthentication") see below screenshot for your reference.

    Are you getting any error ? there could be chances that your account might have access to multiple AAD directory and one of which require/enforcing to complete Multi-factor authentication due to which failing also did you try accessing it from local PowerShell and experiencing same behavior ? if so please run 'Connect-AzAccount' with additional parameter '-TenantId <YourTenantID>

    Can you try using Connect-AzAccount -UseDeviceAuthentication -Verbose -Debug this may help you with more insight for troubleshooting.

    Outcome from my subscription:

    CLoudShell:
    109973-image.png

    Browser steps after providing code:
    109937-image.png

    Hope this helps.

    Regards,
    Siva Kumar Selvaraj

    ------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful