This section walks through some of the procedures that are necessary to deploy the application manually, including creating the hosted service and storage accounts, in addition to a SQL Azure server. You will also find instructions on how to generate the service package in Visual Studio and upload it to the Windows Azure Management Portal. Note that you do not need to execute any of these tasks if you use the automated deployment script provided with the sample and described in the Deployment section.

Creating a New Windows Azure Hosted Service

To deploy the sample, you require a hosted service in Windows Azure. To create the hosted service, proceed as described in the following steps.

  1. Log on to the Windows Azure Management Portal.
  2. On the ribbon, click New Hosted Service.
  3. In the Create a New Hosted Service dialog, select the subscription where you wish to create the service from the drop down list labeled Choose a subscription.
  4. Enter a service name in the textbox labeled Enter a name for your service and then choose its URL by entering a prefix in the textbox labeled Enter a URL prefix for your service.
  5. Select a region from the drop down list. Pick the same region where your storage account will be located.
  6. For the Deployment options, make sure that the option labeled Do not Deploy is checked.
  7. Finally, click OK to create the Service.

    76b420c3-0034-46ee-931a-7d0bae2b463d

    Figure 40 - Creating the Windows Azure hosted service

    To complete the setup of the hosted service, you will need to upload the certificate used for the SSL binding. To do this:

  8. In the list of hosted services, expand the hosted service you have just created and select its Certificates folder.
  9. Click Add Certificate on the ribbon and, in the Upload an X.509 Certificate dialog, click Browse to locate the folder were you installed the package. Inside the Setup\Resources folder, select the certificate named blobshare.cloudapp.net.pfx.
  10. Type abc!123 as the certificate password and then click Create.

    b856a24f-8f3b-4ca1-9734-04230903b504

    Figure 41 - Uploading the certificate for the SSL connection

    noteNote:

    When using the certificate provided in the package to secure the SSL binding, be aware that it is a self-signed certificate and that it was issued for a subject named blobshare.cloudapp.net. When you visit the site, the browser will show a warning indicating that the certificate is not trusted.
    If needed, you may replace the certificate with one that is appropriate to the hosted service name that you choose. To avoid the security warning, the certificate must be issued by a trusted root authority and issued to a subject that matches the authority of your hosted service URL.
    If you replace the certificate, you must update its thumbprint in the service configuration file. To do this, expand the Roles node of the BlobShare project and double-click the BlobShare.Web role to open its properties window. Switch to the Certificates tab, select the certificate named “ssl” and replace its thumbprint with the one from your replacement certificate. You will also need to update the certificate thumbprint in the Web.config file of the BlobShare.Web project. To do this, locate the section named microsoft.identityModel/service/serviceCertificate, and update the thumbprint value in the certificateReference element. Note that this is different from the thumbprint in the trustedIssuers section.


Creating a Windows Azure Storage Account

This sample requires a Windows Azure Storage account. To create an account, proceed as described in the following steps.

  1. In the Windows Azure Management Portal, select Storage Accounts in the navigation pane and then click New Storage Account on the ribbon.
  2. In the Create a New Storage Account dialog, pick your subscription from the drop down list labeled Choose a subscription.
  3. Enter a valid name for your storage account in the textbox labeled Enter a URL.
  4. Finally, select a region where the account will be hosted and click Create to register your new storage account. Wait until the account provisioning process completes and updates the Storage Accounts tree view.

    0373b835-90e0-46f1-98c9-a4d2032b7a60

    Figure 42 - Creating a new storage account

    note[1]Note:

    Make sure to pick the same region for the hosted service, the AppFabric Access Control Service namespace, the storage account, and the SQL Azure server.

  5. Select the newly created storage account and, in the Properties pane, click the View button next to Primary access key. In the View Storage Access Keys dialog, click Copy to Clipboard next to the Primary Access Key. You will use this value as well as the storage account name later on to configure the sample application.

    5e1c0f82-a8d7-4005-9ed3-cd045b153d12

    Figure 43 - Retrieving the storage access keys


Creating a SQL Azure Server

Because you are deploying the application to the cloud, instead of a local SQL Server, you will now create and use a SQL Azure server.

  1. In the Windows Azure Management Portal, select the Home in the navigation pane, and then click New Database Server on the ribbon.
  2. Select your subscription on the left pane and then, click Create on the ribbon.
  3. Select a region from the Region drop down list, and then click Next. The location determines which datacenter the database will reside in. Choose the same location as the hosted service, the storage account, and the AppFabric Access Control Service namespace.
  4. Enter an administrator account name and password and then click Next.

    note[2]Note:

    An administrator account is a master account used to manage the new server. You should avoid using this account in connection strings where the username and password may be exposed.
    The password policy requires that the password follow certain rules.
    2b8a352d-c555-484d-8695-7dcf8051228a

  5. Click Finish to create the new server. You will configure firewall rules later on, in this walkthrough.
  6. Once created, the new server information, including its Fully Qualified Server Name, is shown.

    0408c9e3-1efa-4a4c-8922-f9f823bae96d

    Figure 44 - SQL Azure projects list showing available servers

  7. Expand the subscription node located on the left pane, and then click the server name you have created. The ServerInformation page allows you to perform basic administration of the database server.

    4c8525ea-7d39-46c4-b158-f82d8cc0ddd2

    Figure 45 - SQL Azure server information page

  8. The Firewall Rules allows you to specify a list of IP addresses that can access your SQL Azure Server. Click to select the option labeled Allow other Windows Azure services to access this server. This will add a new rule named MicrosoftServices to the list of rules.
  9. The firewall will deny all connections by default, so be sure to configure your allow list so that existing clients can connect to the server.
  10. To set up the database used by Blob Share, your own computer will need to connect to the SQL Azure server, so add a rule that grants access to the IP address of your computer. To do this, click Add and, in the Add Firewall Rule dialog, create a rule that uses your current IP address as both the IP range start and IP range end values. You can retrieve your current IP address from the same dialog, from a label located in its lower half.

    ce8a88d0-fa17-4e71-9082-b9b882938a95

    Figure 46 - Configuring the firewall settings for SQL Azure

    note[3]Note:

    Please notice that changes to your firewall settings can take some time to become effective. For more information on this step, visit http://msdn.microsoft.com/en-us/library/ee621783.aspx.


Updating the Configuration and Creating the Database

Before you continue, you must update the Configuration.xml file to provide the names of the hosted service, the storage account, and the SQL Azure server that you created. Once you define all the settings required to deploy the application to Windows Azure, you need to execute the setup scripts once again. This creates the application database in the configured SQL Azure server and ensures that the Web.config and ServiceConfiguration.cscfg files are updated with the necessary settings.

  1. Before running the setup script, you must update the configuration file to specify the correct settings to deploy the application to the Windows Azure environment, providing the names of the hosted service, storage account, and SQL Azure server that you create manually. For instructions on how to update the configuration file, see Preparing the Application for Deployment in the Deployment section.
  2. Once the configuration file is ready, run the Setup.cmd command script located in the Setup directory where you extracted the sample package. Go through all the steps as you did when running the sample for the first time; this will re-execute the configuration scripts, but using the updated values that you provided.

    ee3b767c-aa27-4bf2-9806-11daf29f614a

    Figure 47 - Running the configuration scripts for deploying to Windows Azure


Deploying the Application Manually

Finally, to deploy the sample to Windows Azure, you need to generate a deployment package using Visual Studio and then upload it to the Windows Azure Management Portal.

  1. Open the BlobShare.sln solution located under the code folder of this package.
  2. In Solution Explorer, right-click the BlobShare cloud project and select Package.
  3. Select the Default Service configuration and the Debug Build configuration, and then click Package.
  4. Once publication succeeds, a Windows Explorer window will open pointing to the folder that contains the deployment package and the service configuration file. Make a note of the folder where Visual Studio generated these files.

    fd380ccb-24ff-4f5b-a5e1-ca37a56bb686

    Figure 48 - Creating the deployment package in Visual Studio

    note[4]Note:

    Windows Azure provides the ability to specify an instance size in the Service Definition file (csdef) that is deployed as part of the Windows Azure service package. The instance size specifies the amount of memory, CPU, local storage, and network performance for the underlying virtual machine image. By default, the application is configured to use two small instances. For more information about instance sizes, please review the MSDN documentation on this subject located here. Each instance size also has different pricing. You can find more information about pricing here.

  5. Go to back to the Windows Azure Management Portal.
  6. Select Hosted Services, Storage Accounts & CDN in the lower half of the navigation pane, and then the Hosted Services subarea.
  7. Now, from the list of available hosted services, select the service that you created previously to deploy the sample and then click New Production Deployment on the ribbon.
  8. In the Create a new Deployment dialog, enter a suitable name in the text box labeled Deployment Name.
  9. Click Browse Locally next to the text box labeled Package location and select the .cspkg file generated by Visual Studio. Do the same for the Configuration file and select the .cscfg file. Both files should be located in the folder where Visual Studio generated them when you published the application.

    e1e056fa-4b63-401f-ab95-875d87510a48

    Figure 49 - Creating a new hosted service deployment

  10. Click OK to start the deployment.

    note[5]Note:

    Wait until the deployment process finishes and for the application to start, which may take several minutes. At this point, its status should be displayed as Ready in the portal.

  11. Browse to https://{yourHostedService}.cloudapp.net to verity that the sample is running successfully. You may sign in and use the application.

    fd359b4e-b95e-483b-9dcd-195d2175daee

    Figure 50 - Blob Share sample running on the cloud

Last edited Oct 21, 2011 at 5:58 PM by wwegner, version 2

Comments

No comments yet.