CHAPTER 16 WINDOWS AZURE 422 Deployment To deploy your application to the cloud you will need a Windows Azure account. If you do not have one yet, what are you waiting for? Go and sign up for one now at http://www.microsoft.com/ windowsazure/account/. Deploying Hello Azure Application Before you deploy your application, check whether you have reset the instance count in the .cscfg file of the Hello Azure application from five to one, as depending on your price plan; otherwise, you may receive an error when you upload your application. OK, let’s deploy the project we created earlier by right-clicking on the HelloAzure project and selecting Publish. VisualStudio will build the application, open the publish directory folder in Windows Explorer and send you to the Windows Azure platform login page. The Windows Azure Portal allows you to deploy, configure and manage your applications. Once you have logged into the services portal and you should see a screen similar to Figure 16-9: Figure 16-9. Azure Services Portal CHAPTER 16 WINDOWS AZURE 423 This page lists all the projects associated with this user. If you haven’t created a project yet, click the adding services to the project link. In the previous example, I have a project called PDC08CTP; click this and you will then be taken to the project services screen (Figure 16-10). Here, if you haven’t already, click the New Service link and add a new hosted service (in the screen shot mine is called Introducing VS2010). Then click on it. Figure 16-10. Project services screen You should then be taken to a screen that shows the current status of your Azure roles (Figure 16-11). CHAPTER 16 WINDOWS AZURE 424 Figure 16-11. Inactive web role Notice at the moment this screen shows only the production instance (see the following section for how to upload to staging instance). We want to upload our application to Windows Azure, so click the Deploy button beneath the staging cube and you will be taken to the Staging Deployment screen. We now need to upload our application itself and its service configuration file. CHAPTER 16 WINDOWS AZURE 425 Application Package Section On the Application Package section, click the Browse button and select the compiled application’s cspkg file (by default this is built at: ~\bin\Debug\Publish\). See Figure 6-12. Figure 16-12. Uploading ServiceConfiguration files Configuration Settings Section On the Configuration Settings section, click the Browse button and select the S Se rviceConfiguration file (default location: ~ ~\HelloAzure\ bin\Debug\ Publish\Servic eConfigu ration.cscfg ). Now give the deployment a descriptive label (e.g., v1.0.0) and click Deploy. Your service will now be deployed to the cloud (Figure 16-13). This is not the quickest process so you may want to go and do something else for five minutes. Once your application has been uploaded, a number of new options will appear beneath the cube enabling you to configure and run it (Figure 16-14). CHAPTER 16 WINDOWS AZURE 426 Figure 16-13. Screen after uploading an application Figure 16-14. Screen after role has been uploaded CHAPTER 16 WINDOWS AZURE 427 Click the Run button to start your Azure application up. Azure will chug away for a bit and then your application should be running (Figure 16-15). Notice that beneath the cube is a URL that you can click to be taken to your running application. Figure 16-15. Our web role running in the cloud Staging Normally you will want to test your changes before moving them to production (or you probably should), so Windows Azure allows you to deploy applications to a staging deployment as well. To access the staging deployment, click the arrow on the right of the manage project screen to show the staging options and upload in a similar manner similar to what we just did. When you want to promote your staging application to production, click the blue sphere with the two white arrows in the middle. After accepting a confirmation that you really want to do this, Windows Azure will then move your staged application into production. CHAPTER 16 WINDOWS AZURE 428 Figure 16-16. Azure allows production and staging environments Production URLs Obviously you will want to configure your application to run at your own domain name. At the time of writing there was no easy facility to do this (apart from by domain forwarding), so please consult the Azure online documentation for details of how to do this. Analytical Data A big omission in my opinion is the current lack of analytical data available in Azure, which is crucial given its pay-per-use pricing model. In the future it is likely Microsoft will add this (indeed earlier previews contained an analytical tab). . and add a new hosted service (in the screen shot mine is called Introducing VS 201 0). Then click on it. Figure 16- 10. Project services screen You should then be taken to a screen that shows. (Figure 16- 14) . CHAPTER 16 WINDOWS AZURE 42 6 Figure 16-13. Screen after uploading an application Figure 16- 14. Screen after role has been uploaded CHAPTER 16 WINDOWS AZURE 42 7 Click. project we created earlier by right-clicking on the HelloAzure project and selecting Publish. Visual Studio will build the application, open the publish directory folder in Windows Explorer and