Pablo
Pablo

Reputation: 2386

Azure SQL Server Firewall IP address range

Moving from Azure MySQL to SQL Server I'm required to specify a range of IP addresses that can access the Db.

Will a range of 0.0.0.0 to 255.255.255.255 be OK to enter? Is there a range of IP addresses that will give me an 'Allow All'. Its not practical for me know where requests will be coming from and be constantly updating the Database firewall rules.

Upvotes: 13

Views: 14105

Answers (4)

kevinc
kevinc

Reputation: 636

Adding to Ronald's solution, deleting existing temp rules and using the ipv4 endpoint.

#!/bin/bash

server="yourservername"
azure sql firewallrule list $server | awk '{print $2}'  | grep temp | while read line ; do azure sql firewallrule delete $server  $line -q ; done

externalIP=$(curl -s ipv4.icanhazip.com)

ruleName="temp$externalIP"


azure sql firewallrule create $server "$ruleName" "$externalIP" "$externalIP"

Upvotes: 0

Sandip Bantawa
Sandip Bantawa

Reputation: 2880

Its old but just got here, I guess there is allowed service to Yes or No under the Azure SQL Database Server (configure tab). Switch that to Yes

Upvotes: -1

Ronald Palmer
Ronald Palmer

Reputation: 121

I would advise running a script using powershell / Azure command line tools for mac (http://azure.microsoft.com/en-us/documentation/articles/command-line-tools/) each time you wish to connect from a new IP.

If using a Mac link your Azure subscription using the command line tools then:

#!/bin/bash

externalIP=$(curl -s icanhazip.com)

ruleName="temp$externalIP"

echo "$externalIP"

azure sql firewallrule create [ServerName] "$ruleName" "$externalIP" "$externalIP"

Save it as azureip.sh and run from terminal.

If using windows there are many examples of using this from PowerShell

Upvotes: 2

Gaurav Mantri
Gaurav Mantri

Reputation: 136136

Will a range of 0.0.0.0 to 255.255.255.255 be OK to enter? Is there a range of IP addresses that will give me an 'Allow All'. Its not practical for me know where requests will be coming from and be constantly updating the Database firewall rules.

Yes, this will give access to your SQL Azure databases from every IP address though it is certainly not recommended. When you mentioned that you don't know from where you'll receive requests, do you mean requests to your application or the request to connect to the database? If it is requests to your application, you don't really need to specify this range. You can just specify 0.0.0.0 which will allow your application running in Windows Azure to access this database.

Upvotes: 12

Related Questions