How to connect Azure SQL Database with Sequelize on Localhost
Sometimes simple things turn out to be heavy. In this short guide I want to show you how to connect an Azure SQL Database to Sequelize.
- You need to create your SQL Database.
- Open the SQL Server Overview (not the SQL-Database itself). You can find it under “All Resources”.
- Click under “Security” on “Firewalls and virtual networks” and turn “Allow Azure services and resources to access this server” on.
- Click on “Add client IP”. Now you are allowed to connect to the server from your local machine.
Setup a short database connection with sequelize:
- First you need to install sequelize.
npm i -S sequelize
2. Create a file named sqltest.js and copy paste this basic sequelize connection code:
Node that every […] needs to be replaced by your personal database access data.
3. Run the code:
Hopefully “Connection successful” appears in your console.