Could you try to make the adjustments to the connection string specified on this forum thread?
Are you allowing network traffic coming from Azure Services on Azure SQL firewall settings?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I set up a CICD pipeline to handle deploying python code to the App Service but get this screen
In the console it says "Failed to load resource: the server responded with a status of 503 (Service Unavailable)"
When I look in the logs, the main error says
pyodbc.InterfaceError: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)')
I tried to install unixODBC through the pipeline which was installed successfully but it is still not working.
The connection string used is shown below which is included in the environment variable in Azure.
"Driver={ODBC Driver 18 for SQL Server};Server=tcp:xxx.database.windows.net,1433;Database=xxx;Uid=xxx;Pwd=xxx;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
I have also tried using the ODBC installer from https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16&tabs=ubuntu18-install%2Calpine17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline:
if ! [[ "18.04 20.04 22.04 23.04" == *"$(lsb_release -rs)"* ]];
then
echo "Ubuntu $(lsb_release -rs) is not currently supported.";
exit;
fi
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
Which appears to have installed according to the pipeline logs...
Unpacking mssql-tools18 (18.2.1.1-1) ...
Setting up mssql-tools18 (18.2.1.1-1) ...
NEEDRESTART-VER: 3.5
NEEDRESTART-KCUR: 6.5.0-1021-azure
NEEDRESTART-KEXP: 6.5.0-1021-azure
NEEDRESTART-KSTA: 1
Reading package lists...
Building dependency tree...
Reading state information...
unixodbc-dev is already the newest version (2.3.9-5ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 51 not upgraded.
But when I run the app I still get pyodbc.InterfaceError: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)')
error. I tried to configure this in the SSH session of kudu but the system wouldn't let me write to it. Not sure where to go from here.
Could you try to make the adjustments to the connection string specified on this forum thread?
Are you allowing network traffic coming from Azure Services on Azure SQL firewall settings?