azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

[SSH] - Unable to connect to App Service SSH through "az webapp ssh" command

Open garimpeirodouniverso opened this issue 6 years ago • 14 comments

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug Cannot connect to App Service SSH using "az webapp ssh" command. It states "Connection is not ready yet, please wait", and waits until times out.

To Reproduce

  • log into our tenant in Azure Portal
  • open cloud shell
  • type the command "az webapp ssh --name [our-app-service-name] -g [our-resource-group-name]-rg -t 30"

Expected behavior Connection on our App Service through SSH.

Environment summary We are using Azure portal own CLI (azure-cli 2.1.0) and also DevOps task "AzureCLI@2", both failing to reach our App Services.

Additional context We have several App Services into the same App Service Plan, none of which can be connected through the "az webapp ssh" command. We are able to connect the SSH via Azure Portal > App Service > SSH normally. Until last week we could (although not consistently) connect using this command. Now we just cannot.

garimpeirodouniverso avatar Feb 21 '20 13:02 garimpeirodouniverso

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI @antcp

ghost avatar Feb 22 '20 03:02 ghost

webapp

yonzhan avatar Feb 22 '20 03:02 yonzhan

Hi, any news? All connections set using "az webapp ssh" command are highly unstable, we just cannot rely on this command to connect to our App Service.

garimpeirodouniverso avatar Mar 06 '20 23:03 garimpeirodouniverso

@btardif can you please check with the Linux folks on this command please. Thanks.

panchagnula avatar Mar 10 '20 06:03 panchagnula

I see the same behavior as @garimpeirodouniverso, both running the CLI locally on my machine, and from Cloud Shell. I hadn't tried az webapp ssh before today, so I've never seen successful behavior. I also get a timeout error with az webapp create-remote-connection.

amasover avatar Mar 12 '20 19:03 amasover

Has anybody had any insight regarding this topic?

dasumner avatar Mar 30 '20 15:03 dasumner

I met the same issue. I was using CLI on VM machine. I could not access ssh from the terminal or from the website.

PandaonMars avatar Apr 18 '20 01:04 PandaonMars

Currently seeing this in Web App for Containers.

siljemda avatar Apr 23 '20 07:04 siljemda

having the same issue when I use "--slot slotname" , I'm using osx.

Acadomia avatar May 28 '20 14:05 Acadomia

any update yet?

santhoshraj2960 avatar Mar 10 '21 03:03 santhoshraj2960

Unable to reproduce bug. I was able to SSH via portal and CLI - insufficient details for further reproduction. closing this issue. FYI, this command is planned to be deprecated and replaced, timeline TBD.

seligj95 avatar Jul 07 '21 14:07 seligj95

@seligj95 I cannot connect on Web Apps from the portal neither from the CLI. It's a real bug. You can ask form extra information, but closing it like that is absurd.

What information do you need? I try to run this command:

$ az webapp create-remote-connection --subscription XXX --resource-group XXX -n XX --debug

It fail with:

....
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: Body is streamable
urllib3.connectionpool: Starting new HTTPS connection (1): baloise-middleware.scm.azurewebsites.net:443
urllib3.connectionpool: https://baloise-middleware.scm.azurewebsites.net:443 "GET /api/settings HTTP/1.1" 200 None
urllib3.connectionpool: Starting new HTTPS connection (1): baloise-middleware.scm.azurewebsites.net:443
urllib3.connectionpool: https://baloise-middleware.scm.azurewebsites.net:443 "GET /AppServiceTunnel/Tunnel.ashx?GetStatus&GetStatusAPIVer=2 HTTP/1.1" 200 None
cli.azure.cli.command_modules.appservice.tunnel: Verifying if app is running....
cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
cli.azure.cli.core.util: Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 712, in _run_job
    return cmd_copy.exception_handler(ex)
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/commands.py", line 37, in _ex_handler
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 3961, in create_tunnel
    tunnel_server = get_tunnel(cmd, resource_group_name, name, port, slot, instance)
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 3956, in get_tunnel
    _wait_for_webapp(tunnel_server)
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 4210, in _wait_for_webapp
    if is_webapp_up(tunnel_server):
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 3925, in is_webapp_up
    return tunnel_server.is_webapp_up()
  File "/opt/homebrew/Cellar/azure-cli/2.26.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/tunnel.py", line 127, in is_webapp_up
    raise CLIError(
knack.util.CLIError: SSH endpoint unreachable, your app must be running before it can accept SSH connections.Use `az webapp log tail` to review the app startup logs.

cli.azure.cli.core.azclierror: SSH endpoint unreachable, your app must be running before it can accept SSH connections.Use `az webapp log tail` to review the app startup logs.
az_command_data_logger: SSH endpoint unreachable, your app must be running before it can accept SSH connections.Use `az webapp log tail` to review the app startup logs.
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x1017a2040>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 12.167 seconds (init: 0.069, invoke: 12.098)
telemetry.save: Save telemetry record of length 3291 in cache
telemetry.check: Negative: The /Users/simon/.azure/telemetry.txt was modified at 2021-07-28 14:06:35.040049, which in less than 600.000000 s

gagarine avatar Jul 28 '21 12:07 gagarine

@gagarine Thank you for the feedback. We are aware of this instability associated with these commands and are prioritizing updates. As this was an old GH issue with few details that was unable to be reproduced, it was closed.

However, if you're still experiencing issues, I am happy to help. Can you confirm if you are able to connect using the menu item in the screen shot below? That can be found by navigating to your App Service via the portal and looking under "Development Tools" in the menu on the left hand side.

image

seligj95 avatar Aug 02 '21 19:08 seligj95

I wanted to say "Yes when the server is stable and running, yes" but I just tried it again, and it fails. Apparently now i had to disconnect from other Microsoft account otherwise it fail miserably:

image

Disconnecting from all other account was not enough, i had to "forget" them. Not great.

But when a project fail to deploy, then SSH become a nightmare. Certainly because the machine shutdown when not responding to ping. But if I try to ssh in, Azure should wake up the machine and stop trying to shut it down every 230 seconds...

And certainly it is linked with Microsoft multiple account, but regularly I have problem with authorization and get red cryptic message at the bottom of the web SSH windows...

And once you are finally connected, you end up with one of the worst "web ssh" I ever experienced. Even line return is broken : image

gagarine avatar Aug 03 '21 11:08 gagarine