Monday, February 15, 2016

Create and connect to a SQL Database on Windows Azure



Azure, is one of the fastest growing cloud platform by Microsoft. In this simple post, I will create and connect to a SQL Database on Microsoft Azure.


To get started logon to the Microsoft Azure Management Portal , navitage to SQL Database and click on New.
sqldatabases_new
In the next screen, give the database a unique name and select the appropriate values.
CreateNewDatabase
The database gets created in a few seconds and it would be ready to use when the status changes to ONLINE.
DatabaseOnline
Clicking on the Database Name (in this case is is TheTestDatabase), would give the detailed information about the database including the address of the database.DatabaseProperties
Now you can use this information in the Connection String or just connect to it using SQL Server Management Studio (SSMS). But when you try to connect to this database from a different computer, it would fail with the following error.firewallerror
Error text:

Cannot open server 'ServerName' requested by the login. Client with IP address '{IPAddress}' is not allowed to access the server.
To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.
It may take up to five minutes for this change to take effect.
Login failed for user 'pradeep'.
This session has been assigned a tracing ID of '{TrackingID}'.
Provide this tracing ID to customer support when you need assistance. (Microsoft SQL Server, Error: 40615)
As seen in the error message, by default all IP addresses are not allowed to connect to a SQL Database. The requisite IP Addresses/IP Address ranges needs to explicitly configured for the server hosting the SQL Database, else the connections will fail with the above error.
To configure the Firewall rules, first we need to navigate to the server on which the SQL database is hosted.
ServerName
In the Configure screen, give the rule a name and specify the IP address range which is allowed to connect to the database.
FirewallRule
After entering the details make sure to click on the “Save” button at the bottom of the screen. Now if we try connecting to the database from the same host, the connection would succeed and the database would be listed in SSMS.
DatabaseConnected
Hope you found this post useful. Happy cloud computing!

No comments:

Post a Comment

COMMON SQL SERVER BACKUP FAILURE ERRORS AND ISSUES

  One of the most common task for a DBA’s are to perform installation of new SQL Server versions and installing patches. Most often or not e...