Saturday, May 6, 2023

SSH into Linux Container in Azure App Service from Local Machine

In this post, let's see how we can SSH into Linux Container in Azure App Service from our local machine. Azure Portal has an option to SSH within the browser itself, but I personally hate that experience.

SSH from Azure Portal
We can use az webapp create-remote-connection to create a remote connection using a TCP tunnel from our local machine to the Azure App Service.

az webapp create-remote-connection `
    --subscription <subscription-id> `
    --resource-group <resource-group-name> `
    --name <app-name>

Now while is this running and the connection is open, we can open up another terminal window and SSH through the tunnel using the following command.
ssh <username>@<addr> -p <port>

SSH from Local Machine
And I am connected.

Now I can even use tools like WinSCP to file transfer between the Linux Container and my local machine.
WinSCP Connection
WinSCP Connected
Hope this helps.

Happy Coding.

Regards,
Jaliya

No comments:

Post a Comment