Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I keep getting this error Please run 'az login' to setup account. Using hyper as terminal client #4618

Closed
xtianus79 opened this issue Oct 5, 2017 · 24 comments
Assignees
Labels
Auth customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@xtianus79
Copy link

xtianus79 commented Oct 5, 2017

Description

when trying to use az login and then running a cli command I get this

I keep getting this error Please run 'az login' to setup account.

I have signed in 100 times

this might be the cause by I am using hyper


Environment summary

Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
installed via Ubuntu for windows

CLI Version: What version of the CLI and modules are installed? (Use az --version)
Answer here: 2.0.18-1

OS Version: What OS and version are you using?
Answer here: windows 10

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: Ubuntu upgraded to 16 bash.exe

@xtianus79 xtianus79 changed the title I keep getting this error Please run 'az login' to setup account. I keep getting this error Please run 'az login' to setup account. Using hyper as terminal client Oct 5, 2017
@yugangw-msft
Copy link
Contributor

yugangw-msft commented Oct 5, 2017

Are you seeing anything when run az account list? It is possible that the credential used to login has no subscriptions.
Terminal client type should not matter.

@yugangw-msft yugangw-msft added the Account az login/account label Oct 5, 2017
@yugangw-msft
Copy link
Contributor

Please reactivate with more details

@francisco-andrade
Copy link

Hi @yugangw-msft , I'm facing the same message here. Can you help me, please?
I'm trying to use the client from an Azure CentOS VM.

"az account list" outputs:

Please run "az login" to access your accounts.
[]

"az login" outputs:

To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code 10CHARCODE to authenticate.
# I go to the browser and authenticate then the cli shows:
Unexpected polling state invalid_request

The client works from my notebook, but I needed to use the cli from an Azure VM.

CLI Version: What version of the CLI and modules are installed? (Use az --version)
Answer here: azure-cli (2.0.24)

OS Version: What OS and version are you using?
Answer here: CentOS Linux release 7.4.1708 (Core)

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: bash

Thanks

@SebastianM86
Copy link

We would also be highly interested in the solution if there is one ...

thanks!

@tjprescott tjprescott reopened this Apr 12, 2018
@yugangw-msft
Copy link
Contributor

This is the same with #6095

@tjprescott
Copy link
Member

Ah, if it is a dupe I will close it again.

@yugangw-msft yugangw-msft added the Service Attention This issue is responsible by Azure service team. label Apr 12, 2018
@bytesemantics
Copy link

Same error - I signed up to Free trial subscription. I can login from browser, and Account Center indicates I have 1 subscription active ('Free trial').

But AZ Cli (installed in Opensuse Tumbleweed using sudo zypper) and using bash shell from 'portal.azure.com' - both report the same error: 'Please run az login to setup account'

@jiasli jiasli self-assigned this Jul 1, 2020
@jiasli
Copy link
Member

jiasli commented Jul 1, 2020

@bytesemantics, could you run az login --debug and share the result to me jiasli at microsoft.com?

At the same time, could you check if there is anything in ~/.azure/azureProfile.json?

@jiasli jiasli reopened this Jul 1, 2020
@bytesemantics
Copy link

I was tempted to ask for this issue to be closed. I was using Chrome, and having read a linked ticket talking about Chrome and MFA issues, I thought I'd try Firefox. Logged in successfully in Firefox and noticed the Auth flow was different to chrome.

Restarted Chrome and logged in successfully.

I can understand this may not be easy to replicate - But from an end users perspective (particularly someone who is evaluating Azure as an alternate to GCP/AWS) - this is not something we should experience and Tech team need to solve it.

@jiasli
Copy link
Member

jiasli commented Jul 1, 2020

Glad to know it is solved.

Usually, this is caused by outdated AAD cache in Chrome. In such case, az login will show a warning then continue with the next tenant or exit, instead of raising an error:

try:
temp_credentials = temp_context.acquire_token(resource, self.user_id, _CLIENT_ID)
except adal.AdalError as ex:
# because user creds went through the 'common' tenant, the error here must be
# tenant specific, like the account was disabled. For such errors, we will continue
# with other tenants.
msg = (getattr(ex, 'error_response', None) or {}).get('error_description') or ''
if 'AADSTS50076' in msg:
# The tenant requires MFA and can't be accessed with home tenant's refresh token
mfa_tenants.append(t)
else:
logger.warning("Failed to authenticate '%s' due to error '%s'", t, ex)
continue

As it is hard to reproduce, it is also difficult for us to get the server-side error. It'll be great if you can share the warning message when you see it. It will help us refine the client-side message. Thanks!

@lilyjma lilyjma added Service Attention This issue is responsible by Azure service team. and removed ServiceAttn labels Sep 15, 2020
@azure-sdk azure-sdk added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Sep 24, 2020
@JCCChris
Copy link

I get this error and using firefox does not fix it. I also am not allowed to share logs.

@jiasli
Copy link
Member

jiasli commented Nov 24, 2020

@JCCChris, could you try cleaning the browser cache? If the issue persists, do you mind sharing the --debug log to jiasli at microsoft.com?

@JCCChris
Copy link

Using incognito mode worked. It seems like a problem with microsoft identity with cacheing unrelated to chrome or firefox. Both were affected. On previous attempts in both browsers, it did not ask for multifactor authentication.

@jiasli
Copy link
Member

jiasli commented Nov 25, 2020

Hi @JCCChris, does clearing the browser cache fix this issue? I believe clearing the cache does the same thing as using incognito mode.

@siluok3
Copy link

siluok3 commented May 12, 2021

In my case after logging in with az login --allow-no-subscriptions I was able to log in successfully and see my users details with az account list

@yonzhan yonzhan closed this as completed May 12, 2021
@simran8282
Copy link

I was tempted to ask for this issue to be closed. I was using Chrome, and having read a linked ticket talking about Chrome and MFA issues, I thought I'd try Firefox. Logged in successfully in Firefox and noticed the Auth flow was different to chrome.

Restarted Chrome and logged in successfully.

I can understand this may not be easy to replicate - But from an end users perspective (particularly someone who is evaluating Azure as an alternate to GCP/AWS) - this is not something we should experience and Tech team need to solve it.

@simran8282
Copy link

Yes. This works. I tried it on Firefox incognito mode.

@bkoprivica
Copy link

Is there a normal solution to this bug?

@bkoprivica
Copy link

This is a showstopper, a red flag item. Everything depends on this, IaaC everything.

@jiasli
Copy link
Member

jiasli commented Jan 28, 2022

@bkoprivica, please open a new issue and share more info by filling the issue template.

@Strongpikin
Copy link

It's surprising how after more than 4 years, microsoft has still not fixed this issue/bug. I've lost 3 hours of work time tonight and the issue has still not gone away. I have cleared my cache and tried all the other "fixes" suggested, yet here I still am like Groundhogs Day. Lawd!!!!!

@oliviermbida
Copy link

Petition to stop someone closing an issue unless they have clearly posted the steps to resolve the issue. (In the same issue tracker)
The commentary on these sorts of issues is always someone posting I will escalate to who ever and then coming back to post I will close the issue.
Long gone are the days when it was customary for the user who reported the issue to be the one to confirm that it has been fixed.
This bug is still there today using az cli version 2.39.0 , after so many years yet someone has put a close badge on it and probably got paid to do so.

@mjqlawson
Copy link

FWIW -- I was having the same problem in an Azure VM. Turned out it was user error. I was using Ctrl+C to copy the device code from my ssh session which, of course, stops the az login process while copying the code. So, az login wasn't listening for the response and the login process didn't complete.

@JRisp1
Copy link

JRisp1 commented Mar 1, 2024

Im having this issue as well. When I attempt to run 'dotnet run --interactive' I am receiving the error "Could not run xxx. Maybe your Azure credential needs a refresh with 'az login'". I then input 'az login' which redirects me to the azure login page on my browser, I login and my az account list runs in the terminal. I then run 'dotnet run -interactive' again and am met with the same error "Could not run xxx. Maybe your Azure credential needs a refresh with 'az login'".

Any recommendations would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests