Running HealthVault Apps On Windows Azure

HealthVault SDK 1.0 introduces an interesting capability by which an HealthVault application can read their application certificate from a file. Eric has some details about this on his blog.

I’m going to describe how this capability of reading an application’s certificates from the file store could be used to run HealthVault application on Windows Azure. Here are the steps to get a simple HealthVault application (which I call HelloHV) running on Windows Azure:

  1. Install the Azure SDK and HealthVault SDK. Create your HealthVault application as a Web Role.
  2. Configure and create an HealthVault application using the application manager utility in HealthVault SDK. Make sure you set the Action-Url to http://<yourapp&gt;  using the Application Configuration Center.
  3. Copy the Redirect.aspx & Redirect.cs from HealthVault samples (HelloWorld in HealthVault SDK) in to your application and add reference to HealthVault assemblies (you can find them in C:Program FilesMicrosoft HealthVaultSDKDotNetAssemblies)
  4. Add the HealthVault related config settings to your WebRole’s Web.Config, the easiest way to do this would be copy the relevant key(s) from a sample in HealthVault SDK. Here is an illustration :
      <add key="ApplicationId" value="01e21bd1-cb13-40d6-8f01-596286827d6d"/>
      <add key="ShellUrl" value=""/>
      <add key="HealthServiceUrl" value=""/>
      <!-- when we call the SignOut() method on HealthServicePage, 
           it redirects us to the page below -->
      <!--<add key="NonProductionActionUrlRedirectOverride" value="Redirect.aspx" />-->
      <!-- The redirect page (specified above) uses these keys below to redirect to different
           pages based on the response from the shell -->
      <add key="WCPage_ActionHome" value="default.aspx"/>
      <add key="WCPage_ActionAppAuthSuccess" value="HelloHV.aspx"/>
      <add key="ApplicationCertificateFileName" 

  5. While testing on your local machine uncomment the following line in the Web.Config, this will allow HealthVault to communicate with your local machine. However make sure that this is commented when you publish the application.  Alternatively the following key can also be stored in UserApplicationConfigs.xml, if you maintain one for your development.
    <!--<add key="NonProductionActionUrlRedirectOverride" value="Redirect.aspx" />—->

    Gotacha1: Windows Azure changes the port numbers for your application so its hard to make it work without using the action-url configured for your application in Application Configuration Center.

  6. In your Default HealthVault Page Make sure you read the certificate for your application from a local file (you can also use Azure Storage).

    Gotacha2: HealthVault SDK expects the ApplicationCertificateFileName to be absolute filename, this is impossible to determine for a cloud system like Azure. However we can get the absolute path by changing the value of the key at run-time.

    public partial class HelloHV : HealthServicePage { protected void Page_PreInit(object sender, EventArgs e) { ConfigurationSettings.AppSettings["ApplicationCertificateFileName"] = MapPath(@"~certWildcatApp-01e21bd1-cb13-40d6-8f01-596286827d6d.pfx"); } protected void Page_Load(object sender, EventArgs e) {


  7. Hit Run and see your Hello HealthVault  application in action!!

Now the show time:

Check out a simple (HelloHV application) running on Windows Azure here.


The associated code for this application is shared here.

Remember to switch to SSL and secure your application certificate (using password or Azure Storage) before you consider taking an application running on Windows Azure live as a production HealthVault application.

2 thoughts on “Running HealthVault Apps On Windows Azure

  1. First, thanks for a Great article.

    I found Gotcha 2a – When you want to modify the application to use your own cert modify the properties of the cert in Visual Studio so that the Build Action is Content and the Copy to Output Directory is either Copy Always or Copy if Newer. You won’t notice this debugging the web site locally but when you try to run the packaged service, even in the development environment it will fail.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.