question

Luke-1179 avatar image
0 Votes"
Luke-1179 asked ryanchill answered

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

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-webappsazure-webapps-sshazure-webapps-migration
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
1 Vote"
ryanchill answered

Hi @Luke-1179,

If you're using a custom container, that could be the reason you're getting EHOSTUNREACH error. Check https://docs.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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.