terminal: Azure Cloud Shell keeps resulting in "Key not found" error

I keep seeing the following behavior:

Tenant 0: Default Directory (brillfoxyahoo.onmicrosoft.com)
Tenant 1: Microsoft (microsoft.onmicrosoft.com)
Please enter the desired tenant number.
Enter n to login with a new account
Enter r to remove the above saved connection settings.
> 1
Requesting a cloud shell instance...
Succeeded.
Key not found
[process exited with code 1]

This issue seems persistent.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 7
  • Comments: 24 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same problem. Going to https://shell.azure.com AND THEN changing from Bash to PowerShell. This seemed to set everything up so it now works when I log in via Windows Terminal.

Likely due to the shell storage hasn’t been setup yet. Login to your Azure Portal, select the Azure Shell on top to first initialize and setup the shell. Once the storage is completed, you should be able connect via Azure Cloud Shell.

@wbpluto - I have implemented a fix but was able to test it only once. Since I fixed the issue in azure portal by selecting a shell, I cannot reproduce the issue anymore. Even if I remove the user settings with an API or for new subscriptions.

My guess is that the problem happens only for “old” cloud shells, i.e., for those configured by an old versions of cloud console API (with API version lower than 2018-10-1). In such case, settings lack a “preferredShellType” field, that Terminal expects. As a result for such shells, Terminal succeeds to fetch the configuration, but then crashes trying to read this missing field.

I have added a code that prevents a crash and instead suggests to login in the browser and to set the shell. I will try to push the code and let’s see if the team likes it 😊

I’m not sure if this is useful, but I was also seeing this issue until I deleted the saved connection settings (r) and re-authenticated. I then saw a much more useful message, which led me to the actual cause:

image

same issue with version 1.16.2642.0, any idea?

Same, started happening started within last week, can’t use Windows Terminal to access Azure Cloud Shell.

This is with a Microsoft account using an Azure pass sponsorship. Things I’ve done:

  • Connected to cloud shell via browser in the portal and shell.azure.com successfully
  • run az provider register -n Microsoft.CloudShell and verified it installed via az provider show -n Microsoft.CloudShell (The warning instructions to register Microsoft.CloudShell persist.
  • Verified I only have access to single tenant and single subscription, this is supported by az account show

image

@Don-Vito

1.4.3243.0

@ChadLevy - Thanks! I was worried for a moment. The fix was introduced in 1.5.3142.0 (which is still in preview) and it will fallback to powershell without a need to go to shell.azure.com.

@yiigy thanks for the suggestion, unfortunately doesn’t appear to work. I started up the cloud shell in the portal, even ran it in interactive mode, but I still get the same result as before when using the Windows Terminal.

Here’s a screencap of me running a random command in the az portal cloud shell.

image

Attempting to connect afterwards: image