Getting error in Cloudshell: Connect-AzAccount: InteractiveBrowserCredential authentication failed

Bishwajeet Sen Sharma 6 Reputation points
2020-11-13T06:44:07.187+00:00

I have an existing paid Azure subscription. SOmehow, I failed to pay my bills and subscription got deactivated and then I paid and activated again

But after this incident, I am getting one strange error in Cloudshell as follows: a) From my Win 10 machine, I opened Chrome/ Edge browser b) Logged in to Azure Portal c) Opened Cloud shell and Opened PWSH mode d) Types in Connect-AZAccount

Getting following warning and then an error:

--> WARNING: Unable to acquire token for tenant 'organizations' --> Connect-AzAccount: InteractiveBrowserCredential authentication failed: Unable to open a web page using xdg-open. See inner exception for details. Possible causes for this error are: xdg-open is not installed or it cannot find a way to open an url - make sure you can open a web page by invoking from a terminal: xdg-open https://www.bing.com

This never happened earlier and I always used before normally. Also I tried with some other Window systems. Same error. But when I tried to use installed Powershell it works as charm. Please advise what went wrong

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
668 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Bishwajeet Sen Sharma 6 Reputation points
    2020-11-13T06:52:41.627+00:00

    39567-cloudshellissue.jpg

    0 comments No comments

  2. vipullag-MSFT 25,611 Reputation points
    2020-11-15T04:28:35.637+00:00

    @Bishwajeet Sen Sharma

    Apologies in delayed response on this.

    Based on this documentation, if you are using Azure Cloud Shell you can skip the Connect-AzAccount.

    39770-connect-azacoount-ps.png

    Please check if other commands are working by over looking the warning message.

    Based on the error, Connect-AzAccount cannot automatically launch the browser and the operation fails. So you are seeing this error.

    The workaround for this is to consider switching to devicecode authentication if you cannot launch the browser. Now try to install AZ module on you PowerShell and set your execution policy to remote signed. Once, this is done everything should work as expected.

    Please refer this document for installing Azure PowerShell module. Refer this document for setting your execution policy to RemoteSigned

    Hope this information is helpful.

    Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics.


  3. Bishwajeet Sen Sharma 6 Reputation points
    2020-11-26T07:17:28.063+00:00

    HI Vipul,

    The problem is not when I am launching Cloudshell after loggin to my Portal.

    I know I do not have to use Connect-AZ Account, because cloudshell default connects my session to my account.

    But I have two concerns then:
    a) I have been using cloud shell for last 6 months and and always able to run Connect-AZAccount without error. Then why Now suddenly it started to give me error?
    b) Sometimes while running time extensive Powershell comamnds in Cloudshell, I get following error.
    example:
    "
    ******* Invoke-AzVMRunCommand -ResourceGroupName $rg -Name webServer2 -CommandId 'RunShellScript' -ScriptPath 'vmconfig.sh'
    Invoke-AzVMRunCommand: Long running operation failed with status 'Unauthorized'.
    ErrorCode: ExpiredAuthenticationToken
    ErrorMessage: The access token expiry UTC time '11/26/2020 7:02:03 AM' is earlier than current UTC time '11/26/2020 7:02:13 AM'.*
    "
    How should I remediate this issue without COnnect-AZAccount?

    Thanks,
    BSS

    0 comments No comments