This project is read-only.

This Toolkit is now deprecated and is now

superseded by Windows Azure Mobile Services

During the early previews of Windows 8, the Windows Azure Toolkit for Windows 8 provided developers with the first support for building backend services for Windows Store apps using Windows Azure.  The main areas of feedback we received from mobile developers was that they wanted a turn-key set of services for common functionality such as notifications, auth, and data.   Windows Azure Mobile Services directly reflects this feedback by enabling developers to simply provision, configure, and consume scalable backend services. The downloads for this toolkit will be removed on the week of Feb 1st 2013.  Future improvements will be channeled into Windows Azure Mobile Services rather than this toolkit. 

To get started with Mobile Services, sign up for a Windows Azure account and receive 10 free Mobile Services.

How to Deploy Your Services to Windows Azure

In order to deploy the toolkit services generated by the Windows 8 Cloud Application project template to a Windows Azure Hosted Service, please follow these steps:

Create a Certificate

  1. Open the Visual Studio Command Prompt as an administrator.
  2. Change the directory to the location where you want to save the certificate file.
  3. Type the following command, making sure to replace <YourDnsPrefix> with your hosted service URL:


    makecert -sky exchange -r -n "CN=<YourDnsPrefix>" -pe -a sha1 -len 2048 -ss My "<YourDnsPrefix>"


    Note: The makecert tool will both create the .cer file and register the certificate in your Personal Certificates store. For more information, check the following article:


Export the PFX File

  1. Open the Certificate Manager snap-in for the management console by typing certmgr.msc in the Start menu.


  2. The new certificate was automatically added to the personal certificate store. Export the certificate by right-clicking it, pointing to All Tasks, and then clicking Export.
  3. On the Export Private Key page, make sure to select Yes, export the private key.


  4. Choose a name and export the file to a .pfx file.


  5. Click Next to complete the wizard.

Note: You now have a copy of the certificate (.pfx) with the private key. For more information, check the following article:


Upload the PFX File to Windows Azure

  1. Open a browser, go to the Windows Azure Platform Management Portal at and log in with your credentials.
  2. Select Hosted Services, Storage Accounts & CDN and then Hosted Services.
  3. Expand your hosted service project, and select the Certificates folder.


  4. Click Add Certificate.
  5. Click Browse and select the PFX file you saved previously. Enter the password, and then click Create.


  6. Once you upload the certificate to the hosted service, copy the Thumbprint shown in the Properties pane for later use.



 Update and Deploy to Windows Azure

  1. In the Windows Azure Project, double-click the web role (e.g. WindowsCloudApp1.Web) to open its properties window.
  2. In the Service Configuration drop down list, select the Cloud configuration
  3. Select the Settings tab and update the DataConnectionString and Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString to point to your production storage account.
  4. Select the Certificates tab, and set the SslCertificate property value to the Thumbprint you recorded earlier in the Windows Azure portal. This will replace the thumbprint for the localhost certificate with the thumbprint of the certificate you uploaded to your hosted service.
  5. Add the .cer file to your Web application project. To do this, right-click the Web application project, choose Add Existing Item, select the .cer file created previously, and then add it to the project.
  6. Open the .cer file properties and make sure that the Build Action is set to Content.


  7. In the App_Start folder, open the NotificationService.cs file.
  8. Add the following using sentences to the file:


    using System.Linq; 
    using Microsoft.WindowsAzure.ServiceRuntime;
  9. Copy the following snippet into the top of the PreStart method:
    // This code sets up a handler to update CloudStorageAccount instances when their corresponding 
    // configuration settings change in the service configuration file. 
    CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => 
      // Provide the configSetter with the initial value 
      RoleEnvironment.Changed += (sender, arg) => 
        if (arg.Changes.OfType<RoleEnvironmentConfigurationSettingChange>() 
            .Any((change) => (change.ConfigurationSettingName == configName))) 
          // The corresponding configuration setting has changed, propagate the value 
          if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))) 
            // In this case, the change to the storage account credentials in the 
            // service configuration is significant enough that the role needs to be 
            // recycled in order to use the latest settings. (for example, the 
            // endpoint has changed) 

    In the same method, locate the code that assigns the endpoint repository to the c.StorageProvider property. Replace that code with the following to use the storage account defined in the configuration settings:


    c.StorageProvider = new WindowsAzureEndpointRepository(CloudStorageAccount.FromConfigurationSetting("DataConnectionString"));
  10. Now you can publish your Windows Azure project to your hosted service. You can do this from the Windows Azure Platform Management Portal or directly from Visual Studio 2010.

Update your Windows Metro Style App to Consume your Windows Azure Hosted Service

Updating your Windows Metro style app to consume your deployed services is simple. When the app is running, all you need to do is update the Server URL within the client UI to https://<YourDNSPrefix><YourDefinedNotificationEndpoint>.

In the event that you are using a self-signed certificate for testing purposes, it is important to establish a trust relationship between your client and server. This requires some additional configuration steps in the client app. Note that this would not be necessary when using a certificate from a trusted root authority.

  1. In your client project, right-click your project and select Add Existing Item.
  2. Go to the location of your self-signed certificate (e.g.
  3. Select the .cer certificate file and click Add.


  4. Open the .cer file properties and make sure that the Build Action is set to Content.


  5. Double-click the package.appmanifest and select the Declarations tab.
  6. Select Certificates in the Available Declarations drop down list and then click Add.
  7. Select AutoSelect.
  8. In the Certificates group, click Add New.
  9. In the Store Name text box, type root.
  10. In the Content text box, type <YourDNSPrefix> (e.g.


  11. Your application is now ready to build and run.

Last edited Jan 21, 2013 at 9:00 PM by nharris, version 11


No comments yet.