I have created a Database using SQL Server in Visual Studio. I have an Azure account where I want to store my datasabe. The problem is that I need to get the IP Address from the Azure account to write it in the code line.

This is the line I am refering to

 (SQLDriverConnect(SQLConnectionHandle, NULL, (SQLCHAR*)"DRIVER=(SQL Server); SERVER=, ; DATABASE= projectBD; UID= myID; PWD= myPW", SQL_NTS, retConString, 1024, NULL, SQL_DRIVER_NOPROMPT)) 

In the SERVER part I need to write the IP of the server but I do not really know how to get it.

Help is much appreciated

1 Answers

1
rickvdbosch On Best Solutions

By default, you use the DNS Name for the SQL Server to connect to. That's something like yourservername.database.windows.net.

For more information on Azure SQL connectivity, see Azure SQL Connectivity Architecture.

Taken from that article:

Connection Policy Proxy: all connections are proxied via the Azure SQL Database gateways. To enable connectivity, the client must have outbound firewall rules that allow only the Azure SQL Database gateway IP addresses (usually two IP addresses per region).

And

If you are connecting from outside Azure, your connections have a connection policy of Proxy by default. A policy of Proxy means that the TCP session is established via the Azure SQL Database gateway and all subsequent packets flow via the gateway.

The article also holds a list of all Azure SQL Database gateway IP addresses you could use to determine the IP address to use.