Search code examples
sql-serverazureazure-sql-databasevpnubuntu-server

MSSQL Timeout error on Azure Ubuntu VM when AnyConnect is on


hope you can help me to solve that issue:

I've written an NodeJS app, it connects to Azure MSSQL and receive requests from VPN AnyConnect client, it works well when I run entire system on my dev machine which is an Ubuntu server 18.04, the trouble comes when I try to deploy it on Azure VM (Ubuntu server 18.04 too) The NodeJS throws timeout to azure MSSQL when the vpn client is connected, if I disconnect the vpn, NodeJS works well again.

I've configured the azure VM ports to allow vpn, ssh and https connections and the NodeJS library I'm using is node-msql

Any sugestions to make work MSSQL connection an AnyConnect client?


Solution

  • Is great to face with troubles that no one has face it, I want to share how did I solve this. I hope this helps if somebody have the same trouble.

    My issue was the connection policy on SQL Server, in my case, the DB is hosted on Azure, so, using the az command line tools (you can install it or use on Azure portal) I fixed this:

    //Check policy connection
    $ az sql server conn-policy show -g myResourceGroup -s mySQLServer
    
    //This displayed next:
    
    {
        "connectionType": "Default",
    
        "id": "/subscriptions/{mySusbcriptionId}",
    
        "kind": null,
    
        "location": "East US",
    
        "name": "default",
    
        "resourceGroup": "MyresourceGroup",
    
        "type": "Microsoft.Sql/servers/connectionPolicies"
    
    }
    

    In AZ docs sais there are 3 types of policies : Default, Redirection and Proxy I did try all of them but which works for me was Proxy, you can change the policy with this command:

    $ az sql server conn-policy update -g myResourceGroup -s mySQLServer -t Proxy
    

    After this, the VM could make connections with SQL Server and the existing connections was not affected.