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

az webapp create-remote-connection: SSH is not enabled for this app while it's actually enabled #30256

Closed
jaliyaudagedara opened this issue Nov 4, 2024 · 4 comments
Assignees
Labels
app-service-networking Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team. Similar-Issue Web Apps az webapp

Comments

@jaliyaudagedara
Copy link

jaliyaudagedara commented Nov 4, 2024

Describe the bug

I am trying to create a SSH connection to my Azure App Service (that is running a Linux container) through az webapp create-remote-connection.

I can SSH using the browser.
Image

However, I am getting an error when I do az webapp create-remote-connection:
Image

SSH is not enabled for this app. To enable SSH follow this instructions: https://go.microsoft.com/fwlink/?linkid=2132395

Related command

az webapp create-remote-connection

Errors

cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 666, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 733, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 725, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/commands.py", line 46, in _ex_handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 703, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 336, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 6789, in create_tunnel
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 6784, in get_tunnel
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 7147, in _wait_for_webapp
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 6753, in is_webapp_up
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/tunnel.py", line 104, in is_webapp_up
knack.util.CLIError: SSH is not enabled for this app. To enable SSH follow this instructions: https://go.microsoft.com/fwlink/?linkid=2132395

Issue script & Debug output

az webapp create-remote-connection --debug.log

Expected behavior

Since SSH is enabled, the SSH tunnel should start.

Environment Summary

azure-cli                         2.65.0

core                              2.65.0
telemetry                          1.1.0

Extensions:
durabletask                      1.0.0b1
log-analytics                      0.2.2

Dependencies:
msal                              1.31.0
azure-mgmt-resource               23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\Jaliya\.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb  6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

SSH is enabled in the docker image (Note: Using the same Dockerfile in another app service, I could az webapp create-remote-connection successfully)

SSH is enabled in App Service.
Image

Dockerfile

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base

RUN apt-get update -y \
    # Install SSH Server
    && apt-get install -y --no-install-recommends openssh-server

# Setup SSH
RUN mkdir -p /run/sshd && echo "root:Docker!" | chpasswd
COPY sshd_config /etc/ssh/  

WORKDIR /app
EXPOSE 8080
EXPOSE 8081
EXPOSE 2222

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["NuGet.Config", "."]
COPY ["src/SomeApp/", "workspace/SomeApp/"]

COPY . .
WORKDIR "workspace"
RUN dotnet build "SomeApp/SomeApp.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SomeApp/SomeApp.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["/bin/bash", "-c", "/usr/sbin/sshd && dotnet SomeApp.dll"]
@jaliyaudagedara jaliyaudagedara added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Nov 4, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 4, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Web Apps az webapp Service Attention This issue is responsible by Azure service team. Auto-Assign Auto assign by bot app-service-general labels Nov 4, 2024
@jaliyaudagedara jaliyaudagedara changed the title az webapp create-remote-connection: SH is not enabled for this app while it's actually enabled az webapp create-remote-connection: SSH is not enabled for this app while it's actually enabled Nov 4, 2024
Copy link

github-actions bot commented Nov 4, 2024

Here are some similar issues that might help you. Please check if they can solve your problem.

@jaliyaudagedara
Copy link
Author

jaliyaudagedara commented Nov 4, 2024

Updated the Dockerfile as follows:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base

RUN apt-get update -y \
    # Install SSH Server
    && apt-get install -y --no-install-recommends dialog \
    && apt-get install -y --no-install-recommends openssh-server

# Setup SSH
COPY sshd_config /etc/ssh/
COPY init_container.sh /opt/

RUN echo "root:Docker!" | chpasswd && chmod u+x /opt/init_container.sh

WORKDIR /app
EXPOSE 8080
EXPOSE 8081
EXPOSE 2222

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["NuGet.Config", "."]
COPY ["src/SomeApp/", "workspace/SomeApp/"]

COPY . .
WORKDIR "workspace"
RUN dotnet build "SomeApp/SomeApp.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SomeApp/SomeApp.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["/opt/init_container.sh"]

init_container.sh

#!/bin/sh

echo "Starting SSH ..."
service ssh start

# Run the application
dotnet SomeApp.dll

Still the same issue.

@jaliyaudagedara
Copy link
Author

This started working suddenly without no changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-service-networking Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team. Similar-Issue Web Apps az webapp
Projects
None yet
Development

No branches or pull requests

4 participants