Can't connect to SQL Azure Database with sequelize, but SQL Server on localhost works fine Can't connect to SQL Azure Database with sequelize, but SQL Server on localhost works fine sql-server sql-server

Can't connect to SQL Azure Database with sequelize, but SQL Server on localhost works fine


To connect to Azure Sql server with ran tedious, we need to set additional option: encrypt: true in connection factory.In Sequelize, we can specify dialectOption in initializing function:

var Sequelize = require('sequelize');var sequelize = new Sequelize('dbname', 'username', 'passwd', {  host: 'hostname',  dialect: 'mssql',  pool: {    max: 5,    min: 0,    idle: 10000  },  dialectOptions: {    encrypt: true  }});

you can refer the similar issue in Sequelize's issues repo on GitHub


You need to Enable the SQL Azure Firewall to add Azure Services to it. in not your App will not be able to communicate with SQL Azure,