Welcome!

Think first. Code later.

Adam Grocholski

Subscribe to Adam Grocholski: eMailAlertsEmail Alerts
Get Adam Grocholski via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: PC Security Journal, Ubuntu Linux Journal, SEO Journal, Azure Cloud on Ulitzer, Security Journal, Telecom Innovation

Blog Feed Post

Azure CLI Day 48 – sql firewallrule create

bash-azure

In my previous post (http://thinkfirstcodelater.com/blog/?p=3471) I showed you how to use the Windows Azure cross platform command line tools to view the details of a specific SQL database server. In this post I’ll show you how to use the tools to add a firewall rule to a SQL database server.

Once again, just a reminder that I’m using the command line tools on a MacBook Air with OSX (Mavericks) installed, and I’m using Google Chrome as my default browser. However, the experience should be identical on Windows and Linux as well.

Before getting started, I wanted to give you a quick overview of firewall rules as they relate to SQL database servers running in Windows Azure. To help protect your data, the SQL database firewall prevents all access to your database server until you specify which computers have permission. The firewall grants access based on the originating IP address of each request. Currently our database server has no firewall rules, which means no computers can access it, making it very secure as well as very useless. In this post we’ll add a firewall rule to the server so that other computers can access it.

Open an instance of your command line (Terminal, Bash, Command Prompt, etc.) and type the following:

azure sql firewallrule create -h

Screen Shot 2013-10-23 at 4.26.58 PM

The azure sql firewallrule create command is the command to use to create a rule in a SQL database server’s firewall. There are several parameter that need to be specified

  • serverName. The name of the SQL database server to apply the firewall rule to.
  • ruleName. The name of the firewall rule.
  • startIPAddress. The starting IP address of the firewall rule. Must be a valid IPv4 address.
  • endIPAddress. The ending IP address of the firewall rule. Must be a valid IPv4 address.

To create a firewall rule that allows any computer on the internet to access your SQL database server, type the following into your CLI, substituting where appropriate:

azure sql firewallrule create ‘[YOUR SQL SERVER NAME]‘ ‘the internet’ ’0.0.0.0′ ’255.255.255.255′

Note – this is just for example purposes only and is not recommended in a production environment. In a real-world scenario you would have specific IP address range to use.

In my case I used the following:

azure sql firewallrule create ‘thbmcjr7xb’ ‘the internet’ ’0.0.0.0′ ’255.255.255.255′

Screen Shot 2013-10-23 at 4.35.32 PM

Once the command completes, you can go to the Windows Azure Management Portal and browse to the CONFIGURE page for your server to verify the rule was created.

Screen Shot 2013-10-23 at 4.36.55 PM

That’s it for now. In my next post I’ll show you how to list the firewall rules associated with your SQL database server.

Did you know you can try Windows Azure for free for 30 days? Just go to http://aka.ms/thecloud and sign up.

Read the original blog entry...

More Stories By Adam Grocholski

Hey there! My name is Adam Grocholski, and I'm a Technical Evangelist at Microsoft where I spend time focusing on Windows, Windows Phone, and Windows Azure. I live in the frozen tundra of Minnesota and run thinkfirstcodelater.com. You can also follow me on twitter at @codel8r.