Can't SSH in to Azure flask web services app to install required driver for for pyodbc library

Luke 1 Reputation point
2021-07-21T12:37:58.58+00:00

This is my first go at web development and I've built a flask application which accesses MSSQL data for a small production environment. Building app to Azure web service from my github repository results in a non responsive application as I need to use the pyodbc python library which is built on unixodbc. I know the solution involves running

 apt-get install unixodbc-dev

but I am totally unable to access the linux instance through the web SSH as it immediately gives

SSH CONNECTION CLOSE - Error: connect EHOSTUNREACH 172.xxx.xxx.xxxx

I'm struggling to understand where In the portal I can configure the linux instance itself, such as the root user and credentials. Although I'm not sure how this will be of much help as the web SSH doesn't ask for credentials to begin with.

I was prompted for a password when attempting to SSH through my local azure CLI, but again I'm unsure what this password would even be.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,865 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 25,661 Reputation points Microsoft Employee
    2021-07-22T04:33:58.88+00:00

    Hi anonymous user-1179,

    If you're using a custom container, that could be the reason you're getting EHOSTUNREACH error. Check https://learn.microsoft.com/en-us/azure/app-service/configure-linux-open-ssh-session which links to the instructions for how to configure SSH for a custom container.

    This, however, shouldn't prevent you from using pyodbc in your application. With the module in your requirements.txt file and SCM_DO_BUILD_DURING_DEPLOYMENT in your application settings set to true, then you shouldn't have any issue connecting to a cloud base server. I say cloud based because you will run into database lock issues if you were to use a file-based database like MySQL inside the app service. Using SCM_DO_BUILD_DURING_DEPLOYMENT app setting will allow the platform to create a virtual environment for downloading and installing your Python packages.

    1 person found this answer helpful.
    0 comments No comments