Script not continuing after Connect-AzAccount -UseDeviceAuthentication

Frank van Graafeiland 166 Reputation points

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 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,


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,346 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,342 questions
0 comments No comments
{count} votes

Accepted answer
  1. Siva-kumar-selvaraj 15,546 Reputation points

    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:


    Browser steps after providing code:

    Hope this helps.

    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