2 out of 4 rated this helpful - Rate this topic

Setting Up Services Required to Publish a Cloud Service from Visual Studio

Before you can publish a cloud service project, you must set up the following services:

  • A cloud service in the Windows Azure Management Portal

    Runs your roles in the Windows Azure environment.

  • A storage account

    Provides access to the Blob, Queue, and Table services.

Use the following procedures to set up these services and configure your application:

Create a Cloud Service in the Management Portal

To publish a cloud service to Windows Azure, you must first use the Windows Azure Management Portal to create a cloud service, which runs your roles in the Windows Azure environment.

To create a cloud service by using the Management Portal

  1. Sign in to the Windows Azure Management Portal on the Microsoft website.

  2. (optional) To display a list of cloud services that you've already created, choose the Cloud Services link on the left side of the page.

  3. Choose the + icon in the lower-left corner, and then choose Cloud Service on the menu that appears.

    Another screen with two options, Quick Create and Custom Create, appears. If you choose Quick Create, you can create a cloud service just by specifying its URL and the region where it will be physically hosted. If you choose Custom Create, you can immediately publish a cloud service by specifying a package (.cspkg file), a configuration (.cscfg) file, and a certificate. Custom Create isn’t required if you intend to publish your cloud service by using the Publish command in a Windows Azure project. The Publish command is available on the shortcut menu for a Windows Azure project.

  4. Choose Quick Create to later publish your cloud service by using Visual Studio.

  5. Specify a name for your cloud service.

    The complete URL appears next to the name.

  6. In the list, choose the region where most of your users are located.

  7. At the bottom of the window, choose the Create Cloud Service link.

Create a Storage Account

A storage account provides access to the Blob, Queue, and Table services.

To create a storage account by using the Management Portal

  1. Sign in to the Windows Azure Platform Management Portal on the Microsoft website.

  2. (optional) To view your storage accounts, choose the Storage link in the panel on the left side of the page.

  3. In the lower-left corner of the page, choose the + icon.

  4. In the menu that appears, choose Storage, and then choose Quick Create.

  5. Give the storage account a name that will result in a unique URL.

  6. Give your cloud service a name.

    The complete URL appears next to the name.

  7. In the list of regions, choose a region where most of your users are located.

  8. Specify whether you want to enable geo-replication.

    If you enable geo-replication, your data will be saved in multiple physical locations to reduce the chance of loss. This feature makes storage more expensive, but you can reduce the cost by enabling geo-location when you create the storage account instead of adding the feature later. For more information, see Geo-replication.

  9. At the bottom of the window, choose the Create Storage Account link.

After you create your storage account, you will see the URLs that you can use to access resources in each of the Windows Azure storage services, and also the primary and secondary access keys for your account. You use these keys to authenticate requests made against the storage services.

noteNote
The secondary access key provides the same access to your storage account as the primary access key and is generated as a backup should your primary access key be compromised. Additionally, it is recommended that you regenerate your access keys on a regular basis. You can modify a connection string setting to use the secondary key while you regenerate the primary key, then you can modify it to use the regenerated primary key while you regenerate the secondary key.

Configure Your Application to Use Services Provided by the Storage Account

You must configure any role that accesses storage services to use the Windows Azure storage services that you have created. To do this, you can use multiple service configurations for your Windows Azure project. By default, two are created in your Windows Azure project. By using multiple service configurations, you can use the same connection string in your code, but have a different value for a connection string in each service configuration. For example, you can use one service configuration to run and debug your application locally using the Windows Azure storage emulator and a different service configuration to publish your application to Windows Azure. For more information about service configurations, see Configuring a Windows Azure Project.

To Configure Your Application to Use Services That the Storage Account Provides

  1. In Visual Studio open your Windows Azure solution. In Solution Explorer, open the shortcut menu for each role in your Windows Azure project that accesses the storage services and choose Properties.

    A page with the name of the role is displayed in the Visual Studio editor. The page displays the fields for the Configuration tab.

  2. In the property pages for the role, choose Settings.

  3. In the Service Configuration list, choose the name of the service configuration that you want to edit.

    If you want to make changes to all of the service configurations for this role, you can choose All Configurations. For more information about how to update service configurations, see Manage Connection Strings for Storage Accounts.

  4. To modify any connection string settings, choose the button next to the setting.

    The Create Storage Connection String dialog box appears.

  5. Under Connect using, choose the Your subscription option.

  6. In the Subscription list, choose your subscription.

    If the list of subscriptions doesn't include the one that you want, choose the Download Publish Settings link.

  7. In the Account name list, choose your storage account name.

    Windows Azure Tools obtains storage account credentials automatically by using the .publishsettings file. To specify your storage account credentials manually, choose the Manually entered credentials option, and then continue with this procedure. You can get your storage account name and primary key from the Management Portal. If you don’t want to specify your storage account settings manually, choose the OK button to close the dialog box.

  8. Choose the Enter storage account credentials link.

  9. In the Account name box, enter the name of your storage account.

    noteNote
    Log into the Management Portal, and then choose the Storage button. The portal shows a list of storage accounts. If you choose an account, a page for it opens. You can copy the name of the storage account from this page. If you are using a previous version of the Management Portal, the name of your storage account appears in the Storage Accounts view of the Management Portal. To copy this name, highlight it in the Properties window of this view, and then choose the Ctrl-C keys. To paste the name into Visual Studio, choose the Account name text box, and then choose the Ctrl+V keys.

  10. In the Account key box, enter your primary key, or copy and paste it from the Management Portal.

    To copy this key from the Management Portal:

    1. At the bottom of the page for the appropriate storage account, choose the Manage Keys button.

    2. On the Manage Keys Access page, select the text of the primary access key, and then choose the Ctrl+C keys.

    3. In Windows Azure Tools, paste the key into the Account key box.

  11. You must select one of the following options to determine how the service will access the storage account:

    • Use HTTP. This is the standard option. For example, http://<account name>.blob.core.windows.net.

    • Use HTTPS for a secure connection. For example, https://<accountname>.blob.core.windows.net.

    • Specify custom endpoints for each of the three services. You can then type these endpoints into the field for the specific service.

      noteNote
      If you create custom endpoints this allows you to create a more complex connection string. When you use this string format, you can specify storage service endpoints that include a custom domain name that you have registered for your storage account with the Blob service. Also you can grant access only to blob resources in a single container through a shared access signature. For more information about how to create custom endpoints, see How to Configure Connection Strings.

  12. To save these connection string changes, choose the OK button and then choose the Save button on the toolbar.

    After you save these changes, you can get the value of this connection string in your code by using GetConfigurationSettingValue. When you publish your application to Windows Azure, choose the service configuration that contains the Windows Azure storage account for the connection string. After your application is published, verify that the application works as expected against the Windows Azure storage services

See Also

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.
facebook page visit twitter rss feed newsletter