Introduction to SQL Azure
Overview

Collapse All Expand All Language Filter: All Language Filter: Multiple Language Filter: Visual Basic Language Filter: C#

Visual Basic Usage
C#

SQL Azure makes the power of Microsoft SQL Server available in a Cloud Hosted offering. Working with SQL Azure should be a familiar experience for most developers because, for the most part, it supports the same tooling and development practices currently used for on premise SQL Server applications.

However, there are some small differences between working with SQL Azure and working with on-premise SQL Server. Some of these differences are inherent in the way that SQL Azure has been architected and some will only apply during the Community Technical Preview phase.

This hands-on lab will walk through a series of simple use cases for SQL Azure such as provisioning your account, creating, and using a database. You will create a simple Windows Azure application to allow you to manipulate the data in the Contact table of a database running in SQL Azure.

# Objectives

In this hands-on lab, you will:

- Use SQL Azure as a cloud hosted database platform for your applications.
- Learn how to:
  - Provision a new account in SQL Azure
  - Create new databases within the context of your account
  - Create new users and grant them appropriate permissions
- Work with SQL Azure to:
  - Execute Data Definition Language statements to create tables and indexes
  - Execute Data Manipulation Language to insert and query rows
- Build a simple data driven ASP.NET page using the graphical controls in Visual Studio.
- Connect to SQL Azure Database via Client Libraries.

# Prerequisites

The following is required to complete this hands-on lab:

- Microsoft .NET Framework 4.0
- Microsoft Visual Studio 2010
- SQL Server Management Studio 2008 R2 Express Edition
- Windows Azure Tools for Microsoft Visual Studio 1.5
- Access to a SQL Azure account with a server created
  - SQL Azure Firewall enabled for machine running this lab

Note:
This hands-on lab has been designed to use the latest release of the Windows Azure Tools for Visual Studio 2010 (version 1.5) and the new Windows Azure Platform Management Portal experience. To complete this hands-on lab, you need to have a SQL Azure account. To sign up, visit http://www.microsoft.com/windowsazure/sqlazure/.

# Setup

In order to execute the exercises in this hands-on lab you need to set up your environment.

1. Open a Windows Explorer window and browse to the lab’s Source folder.
2. Double-click the Setup.cmd file in this folder to launch the setup process that will configure your environment and install the Visual Studio code snippets for this lab.
3. If the User Account Control dialog is shown, confirm the action to proceed.

Note:
Make sure you have checked all the dependencies for this lab before running the setup.

# Using the Code Snippets

Throughout the lab document, you will be instructed to insert code blocks. For your convenience, most of that code is provided as Visual Studio Code Snippets, which you can use from within Visual Studio 2010 to avoid having to add it manually.

If you are not familiar with the Visual Studio Code Snippets, and want to learn how to use them, you can refer to the Setup.docx document in the Assets folder of the training kit, which contains a section describing how to use them.

# Exercises

This hands-on lab includes the following exercises:

1. Preparing Your SQL Azure Account
2. Basic DDL and DML - Creating Tables and Indexes
3. Build a Windows Azure Application that Accesses SQL Azure
4. Connecting via Client Libraires

Estimated time to complete this lab: 60 minutes.

Note:
When you first start Visual Studio, you must select one of the predefined settings collections. Every predefined collection is designed to match a particular development style and determines window layouts, editor behavior, IntelliSense code snippets, and dialog box options. The procedures in this lab describe the actions necessary to accomplish a given task in Visual Studio when using the General Development Settings collection. If you choose a different settings collection for your development environment, there may be differences in these procedures that you need to take into account.