This is the fifth in a series I’ve been writing on learning Microsoft Windows Azure. In this post, you’ll deploy the application created earlier; see Windows Azure Training Series – Creating Your First Azure Project.
With your Square a Number Azure project open in Visual Web Developer (or Visual Studio), go to the Solution Explorer window. Remember, there will be two projects, the Web role project and the service project. Expand the Roles branch of the service project’s tree. Right-click on the Web role, in this case SquareANumber.Web, and select Properties.
The properties Window will open as shown below. You need to set instance count and VM size. For this example, set the size to ExtraSmall and the count to 2. Then, save your project.
In Solution Explorer, double-click the ServiceConfiguration.cscfg file and you will see where the instance count was set. Double-click on the ServiceDefinition.csdef file, and you will see where the instance size was set. That’s it!
Again in Solution Explorer, right-click on the service project, not the Web role, and select Publish. The following window will open. Select the Create Service Package Only option, and then click OK.
The deployment package is created and the configuration file is copied into the same folder. A Windows Explorer instance will open at that path. Make note of where the folder is, you’ll need it in a minute. (You might want to copy the full path to the clipboard to make finding it easier.)
To upload the deployment package you need to go to the Windows Azure Management portal. The easiest way to get there is to again right-click on the service project, and select Browse to Portal. You will need to log in using your Windows Live ID.
In the management portal, click on the New Hosted Service button at the top left. The following window will open. Fill it out similar to what is show below. You’ll need to have a subscription before doing this. See the first article in this series, Windows Azure Training Series – Understanding Subscriptions and Users.
When filling out this form, you’ll need a URL prefix that is not already used. The URL prefix is used to determine the location of your Web application. You can deploy to staging or production. In a real project, you’d deploy to staging first for testing, but for this example just go directly to production. Click the Browse Locally button and find the package and configuration file you just created. Click the OK button and the files will be uploaded.
You’ll have to wait a few minutes for the instances to start. Once started, you should see two extra-small instances running. See the screenshot below.
When the management portal says it’s ready, test it in the browser. The URL will be, “http://<your URL prefix>.cloudapp.net”. You’re spending money now, so don’t forget to Stop and then Delete the deployment when you are finished.
To learn more about Windows Azure, come to Learning Tree course 2602, Windows Azure Platform Introduction: Programming Cloud-Based Applications.