In intractive mode of Azure Cloud Shell, I got the following message for any commands I execute,
yoichi@Azure:~$ az interactive
az>> vm list
Please run 'az login' to setup account.
So I tried to login by typing 'az login', however I got the message below. Then I closed the browser, opened the Azure Cloud Shell, and tried again but I got the same message.
az>> login
Azure Cloud Shell automatically authenticates the user account it was initially launched under, as a result 'az login' is disabled.
az>
@yokawasa thank you for the report. I have reproduced the issue and we will address this in an upcoming release.
We cache the account info of a user upon az login.
The problem is that interactive looks into a different folder for this cached information and thus would require another login from interactive mode to get this information.
Unfortunately, a second login is not possible in cloudshell. A workaround until our next release would be to copy over the contents of ".azure" into ".azure-shell".
https://github.com/Azure/azure-cli/pull/5442 will make interactive mode look at the .azure for this info.
@williexu what is the specific bash command you executed in the shell? That's all anyone needs to know :)
Good point. Run cp -a .azure/. .azure-shell after starting up cloudshell.