Share via


Migrating and Deploying a Simple Cloud App: Part 1 - Setting Up a SQL Azure Server and Database

Deploying a Simple Application_thumb[5]

The screenshots used in this series were done in preparation for the SQL event being held on February 26, 2011. You can find out more information about the event here.

  1. To get started, log in to the Windows Azure Management Portal . Once you get started with Cloud development, you’re going to be visiting this site often.  I highly suggest bookmarking it or committing https://windows.azure.com to memory.

  2. In the navigation menu on the left, you’ll find the Databases button.  Click on the Databases button.

    image

    On the left hand side, you’ll see a list of Windows Azure subscriptions that are associated with your Windows Live ID. 

  3. Click on the subscription that will host your SQL Azure server(s) and database(s) . You’ll now see a listing of all the SQL servers associated with your subscription.  We’ll come back to this screen later on and you’ll see it populated with server information.

Creating a New Server 

  1. Click on Create in the Server tab group of the toolbar (located at the top of the screen).  The Create Server dialog box will popup where you’ll configure your SQL Azure server.  The neat thing here is that you’re actually provisioning a server as if you would in your own data center, except you’re doing it through a wizard and the actual work of installing Windows Server, SQL Server, and doing all of the configuration is done for you.

    image

  2. Select a Region. Here you’re basically selecting which of the Windows Azure data centers are going to host your server. Let’s select North Central US.

  3. Click Next.

  4. Now you have to create your administrative credentials so that you can log in to the database. SQL Azure uses SQL authentication, so this process is like setting up your “sa” login on an on-premise box. Choose a login that is unique. Usernames like “admin”, “administrator”, “sa”, “root”, “guest”, “dbmanager”, and “loginmaster” are not allowed – people know these logins, so to minimize any security exposure, you’re prevented from using them.

    image

    Notice the red warning? I tried to use an easy password (“demo” – clearly not a strong password!). The red warning highlights the password rules that you have to use when crating a password to ensure that everything is kept secure. As soon as you enter a password that meets the rules, the warning will disappear and the Next button will become available.

  5. Let’s click Next. Now we have to create firewall rules so that our database can be accessible.  Typically you’ll just want your application connecting to the database, so you’ll add the IP of the server that hosts your application. For this walkthrough, the application will also be hosted on Windows Azure so we’re going to select Allow other Windows Azure services to access this server.

  6. We’ll also need access to the database from our local machine so that we can use SQL Management Studio (or the SQL management tool of your preference).  Click on Add to add a new firewall rule to the list. 

    image

  7. First things to do is to give the rule a name. The best thing to do is to give the rule a name based on the location from which you’re going to be connecting – something like “Toronto Office”. This will make it easy for you to locate the rule in the future and remember its purpose. 

    It is recommended that you add the firewall rule right before you start working and make sure to remove it when you’re done. This just makes sure that your database(s) stay secure at all times.

  8. After naming the rule, enter the starting and ending range of the IPs that will have access to the database. Notice that your IP is shown at the bottom. If you’re creating a rule for yourself (this is what we’re doing for this walkthrough), the guess work is taken out of the equation – you can simply use the IP address shown for both the start and end range.

  9. Click on Finish. You’ll notice a little green wheel spinning. This tells you that the server is being provisioned.

  10. The server is now provisioned.  

    screen

    Remember how I said we would be back to this screen? Well here we are! We can now see that we have one server provisioned. At a glance, we can see the server name, user, region, and the fully qualified server name. We’re going to need these later on when we connect to the server.

Creating the Database

  1. Now that we have a server, the next step is to put a database on that server. While still on the Subscription Home screen, click on Create in the Database group of the toolbar.  Notice the same wizard-like approach as creating a server.

  2. Give the database a name. For this walkthrough, we’ll use NerdDinner (that’s the app that’s going to use this database).

  3. Select an edition. For the purposes of this walkthrough, let’s use the Web Edition.

    For those of you who have MSDN subscriptions or are using the introductory subscription, those only come with a Web Edition database. Just something to keep in mind.

    For more information on the differences between the editions, see the SQL Azure FAQs.

  1. Select a size.   We’ll stick with 1GB for now since that’s all we need for this application.

  2. Click OK. You’ll see the green wheel spinning meaning. Like before, the provisioning process is now occurring. Once it’s done, we’ll have a database. 

  3. That’s it! We now have a database. Let’s see what that database looks like. Go over the left navigation pane, and expand the subscription and then expand the server. There’s our database. Click on it.

    image

    You’ll now see some information about the database in the right-hand side Properties pane.

If you’re interested in the onlineDatabase Manager, click on Manage from the toolbar. We won’t go into that in this walkthrough, but I just wanted to show you that you can actually manage the database online as well as with the SQL tools that you’re already familiar with.

So with the database provisioned, we’re ready to go to the next step.