Easiest Way to Get Started in Windows Azure Cloud Development


Exercise 1: Easiest Way to Get Started in Windows Azure Cloud Development

I do a lot of cloud boot camps and presentations throughout the US and elsewhere. I want to give you my elevator pitch on the fastest way to get knowledge.

What I show you here is the getting started through code.

You don't need to see PowerPoints first – Let’s learn through code

Code is the best teacher for some. We will focus on code with some graphics interspersed.

But the Guest Book is hard because it uses everything (web roles, queues, blobs, tables, ASP.NET) and then some.

We will build up incrementally. We’ll do Guestbook later.

I want to run through some walkthroughs (pun intended) and get you up and running.

ASP.NET and MVC Developers will be right at home

This demo is the simple scenario - static content to support browsers. You could have chosen an MVC approach.

  1. A hosted service allows you to reserve a VM and host IIS as well as installing and running your web application.
    • You are essentially hosting your web site in a Microsoft Data Center.
  2. We are NOT using Azure Table storage in this example. We will in a future exercise.

zhmifmr4
The hello world is important because it validates everything is working before you to to the more complex labs. It is very important to get things working early on and not stampede directly to the complex labs.

  1. In this section we will:
    • Make sure you're tooling and SDKs are installed
    • Download the Windows Azure Training Kit
    • Understand the Hello World Demo

Download for Azure SDK


Exercise 2: Installing Tooling, Downloading the Windows Azure Training Kit
There are 2 goals here: (1) make sure your dev tooling is good to go; (2) download and start using the almighty Windows Azure Platform Training Kit.


Exercise 2: Task 1 - Install Visual Studio 2010 and related tooling

Make sure you have Visual Studio 2010, Azure SDK and related-tooling installed

  1. I've covered this extensively in the past. It is covered here.
    hyperlink2  

    My post on getting setup


Exercise 2: Task 2 - Installing Windows Azure Training Kit

Let's get started by downloading the kit. I give very detailed instructions on how to setup your Windows Azure SDK and tooling here.

  1. Downloading the Windows Azure Platform Training Toolkit

    hyperlink2  

    Download the Windows Azure Platform Training Kit


Exercise 2: Task 3 - Accessing the Demos Page

This is the first part of the tutorial where we can find the Hello World application. This is an excellent first demo. It really is.

  1. Open the folder c:\watk
    • This is the default installation location
    • The full path is C:\WATK\Demos.htm
      3sqh1zuy
      ifknu0ux
      ** Important Note **
      The demos section of the kit is a great place to start. From Hello World to blobs, queues, tables, web roles, worker roles - it is a great starting point.

 

u04jwcvm

 

  1. Navigate to the folder
    • C:\WATK\Demos\HelloWindowsAzureVS2010
  2. Open the following document
    • Document Name = Demo Script - Hello Windows Azure.docx
  3. The purpose of this document
    • Setup documentation to run your ASP.NET Application
    • Step-by-step instructions
  4. Build, Debug, and Deploy simple Hello World
    • This document will highlight the important points

bi2akouw


Exercise 2: Task 4 - Getting ready for the main event - the first tutorial

Are you ready? This is where we are finally ready to write some code. The preparation work is now done.
z3aun1wz

  1. Prepare to do all this:
    • Create a new project
    • Add a label to it
    • Set the label text
    • Change the instance count
    • Run in emulator
    • Set a breakpoint
    • Hit breakpoint while running in emulators

 

 

** Important Note **
Instance Count is what let's you scale. You can change the quantity of deployments of your cloud application just by changing this one number.

 

  1. To programmatically find out number of instances running under a specific Role, you want to use Azure Service Management API, provide your certificate and call this REST API method:
  2. You can change your storage accounts and hosted services, your service deployments, and your affinity groups
    1. All API operations are performed over SSL and mutually authenticated using X.509 v3 certificates
  3. This is way beyond the scope of this Hello World blog post.

Exercise 3: Running and Explaining Hello World - The best bits
This next section is about understanding the Hello World Step-by-step Walkthrough .


Exercise 3: Task 1 - Creating the Hello Windows Azure Application

Here are the key skills that you will learn.

  1. How to create a new cloud project
  2. What is an ASP.NET Web Role?
    • Understanding an ASP.NET Web Role is crucial.
    • It provides the Web Service or Web Application hosting.
    • Web Roles are hosted inside of Internet Information Server.
  3. One Windows Azure Cloud Solution has two projects
    ** Important Note **
    Configuration is completely separate from your application code
    - Configuration Project - ASP.NET Web Project
  4. How to use the toolbox
    • To drag a control
  5. Understanding the Page_Load event
    • Writing code behind
  6. Understanding the configuration files
    • It represents the location where we can change the instance count
    • Changing the Instance Count

Exercise 3: Task 2 - The debugger and emulators

Being able to use a debugger while developing cloud applications is essential. This section will illustrate some basic debugging techniques, such as setting and hitting breakpoints. You will also learn about the storage and compute emulators.

  1. Knowing the callback address (https://127.0.0.1:81/)
  2. Understanding the Compute and Storage Emulators
  3. How to set a breakpoint
  4. How to hit a breakpoint

Exercise 4: Deploying your application to a MS data center
Now that you’ve created, edited and debugged your application locally, you’re ready to deploy it to the cloud.

** Important Note **
A hosted service allows you to reserve a VM and host IIS as well as installing and running your web application. All this happens in a Microsoft Data Center.

Exercise 4: Task 1 - Packaging your application - Working with the Windows Azure Portal

The skills in this section are about getting your application up and running in a MS data center.

  1. Creating a package
    qveuhdke

    • Your application assemblies in one file
    • The configuration settings in the other file
  2. Remembering the folder (output folder)

    • You'll need it later when using the portal
  3. Creating a New Hosted Service
    tlggiobs

    • Name of service
    • URL of service
    • Region
      • Choose from numerous data centers throughout the world
  4. Viewing your application status at the portal

  5. Understanding the DNS name

    1. You will click on DNS Name when the deployment is complete.
      qj4xfwe2
  6. ** Important Note **
    You can have custom DNS name in your hosted service.
    You may not want what Azure provides When you deploy your application to Windows Azure and move it to the production environment, Windows Azure provides a friendly DNS name so can access your application at a URL like https://aexpense.cloudapp.net.
    Your own custom URL You will probably want to use your own custom URL like https://aexpense.adatumapps.com.
    You may need certificates You'll also notice that if you want to use HTTPS, you must install a certificate that matches the custom DNS name in your hosted service.

 

 


Conclusion
Here is what the big picture goals are:

1. Use the Windows Azure Management Portal to create storage accounts and hosted service components
2. Deploy service component packages using the Windows Azure Management Portal user interface
3. Change configuration settings for a deployed application
4. Test deployments in a separate staging environment before deployment to final production
5. Secure your Windows Azure application with SSL

Automating Deployment with PowerShell

There may come a time where you want to automate deployment. This section gives a brief overview on doing so.

tjbhpas4

 

Windows Azure PowerShell Cmdlets

  1. https://wappowershell.codeplex.com/
  2. The Windows Azure Service Management PowerShell Cmdlets wrap the Windows Azure Service Management API.
  3. These cmdlets make it simple to automate the deployment, upgrade, and scaling of your Windows Azure application.
  4. By pipelining commands, you compose complex scripts that use the output of one command as the input to another.

You can programmatically perform the deployment and upgrade of Windows Azure applications, change the configuration for a role, and set and manage your diagnostic configuration and diagnostic data

  1. You will need to generate a self-signed certificate
  2. To ensure that access to the Service Management API is secure, you must first associate a certificate with your subscription. The management service uses the certificate to authenticate requests. You can use a self-signed certificate or one signed by a certification authority. Any valid X.509 v3 is suitable as long as its key length is at least 2048 bits.
    • Command to make certificate
      • makecert -r -pe -n "CN=AzureMgmt" -a sha1 -len 2048 -ss My "AzureMgmt.cer"
    • Deployment with PowerShell
      • New-Deployment -serviceName <YOUR_SERVICE_NAME_LOWER_CASE> -subscriptionId <YOUR_SUBSCRIPTION_ID> -certificate (get-item cert:\CurrentUser\MY\<YOUR_CERTIFICATE_THUMBPRINT>) -slot staging –package <PACKAGE_LOCATION> -configuration <CONFIGURATION_LOCATION> -label "v2.0" –storageServiceName <YOUR_STORAGE_SERVICE_NAME_LOWER_CASE>

Download for Azure SDK