How To: Set Firewall rule to connect to Sql Azure - sp_set_firewall_rule

2 comments

When you try to connect to SQL Azure and get an error like the one below, your IP address is not configured access to the server.

Cannot connect to xxxx.database.windows.net.
Cannot open server 'xxxx' requested by the login. Client with IP address '192.168.1.1' is not allowed to access the server.  To enable access, use the SQL Azure 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 'azureuser'.
This session has been assigned a tracing ID of '41c2afa1-0097-4db8-b17a-c7bbef547287'.  Provide this tracing ID to customer support when you need assistance. (Microsoft SQL Server, Error: 40615)

For help, click:go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=40615&LinkId=20476

You need to add your IP Address to the firewall rules of the SQL Azure to get yourself connected. There are two ways to do this. One using the UI and the other using the stored procedure - sp_set_firewall_rule.

  1. Login to the Azure management portal https://windows.azure.com by providing your Live ID credentialsClick on Database
  2. Expand subscrptions, choose your subscription, expand it and select your server

     
  3. On the main area, click on the "Firewall Rules" box.
  4. Click on "Add"
  5. Provide a name. (For example - "To Allow Me, The Azure Pro")
  6. Provide your IP Address in the start and end boxes. (Your current IP Address is displayed at this dialog box at the bottom. You might also like to provide an address range. For example from 192.168.1.0 to 192.168.1.255)
  7. You are done! Start connecting now.
Using the sp_set_firewall_rule
  1. After step #3 above, expand the server to see the databases
  2. Select MASTER and clik on MANAGE on the ribbon above
  3. Database Manager for SQL Azure opens up in a new window (https://manage-sgp.sql.azure.com/)
  4. Provide the credentials for the Database (normally a different one)
  5. Once you are in, click on "New Query" on the toolbar/ribbon
  6. Execure the SP: exec sp_set_firewall_rule N'Example setting','YOU IP ADDRESS', 'YOUR IP ADDRESS' (You might also like to provide an address range. For example from 192.168.1.0 to 192.168.1.255)
  7. Your done!


Hope this helped!

How To: Add storage accounts (blob, table, queue) to your Azure Subscription

0 comments

So you have a Windows Azure account and want to consume the azure storage services viz. Table Service, Blob Service and Queue Service. Alright. Here's how you can go and create storage accounts to your azure account.

  1. Login to the Azure Management Portal (https://windows.azure.com) with your Live ID credentials.
  2. Click on the "Hosted Services, Storage Accounts and CDN" on the left menu bar
  3. You can see the storage accounts count on the left menu bar (For example: Storage Accounts (0))
  4. Now click on the "New Storage Account" on the toolbar
  5. Provide the name for the storage account, your desired region where it should get created and click OK.
  6. Now you have a storage account with Azure Table services, Azure Blob Services and Azure Queue Services.
  7. Note the URLs of the storage services on the right toolbar.
  8. Typically the URLs will be:
    1. storage_account_name.blob.core.windows.net
    2. storage_account_name.table.core.windows.net
    3. storage_account_name.queue.core.windows.net
  9. You are done and now you can connect to these storage services using  these URLs and the "Primary Access Key" displayed at the top.
Hope this helped!