Azure DataMarket– Writing Code to Consume DataMarket Data


  Introduction Windows Azure Marketplace DataMarket
This blog is based on a lab exercise in the Windows Azure Platform training Kit.

The lab is called Introduction to Windows Azure Marketplace DataMarket.

I ran through the lab to see if I could get it to work. And it does work.

The basic first steps in the lab:

Step 1 -Signing Up Navigate to and use your Windows Live ID to sign up.
Step 2 - Fill in Account Details Name, email address, etc. Agree to DataMarket privacy policies. Click the Continue button.
Step 3 -Explore your account keys The lab instructs you to go to My Account to get account keys. Your account key is used to access the data from client applications.
Step 4 - Browsing the data sources You can navigate the DataMarket to find the data that makes sense to you.

If you haven’t done so, download the free kit now:

Windows Azure Platform Training Kit Download

Sign up to Gender Info

The lab has you sign up for Gender Information from the United Nations database. Note that not all data sources are free.

Once you sign up, you can begin to explore the data:

Note the query that is setup for you. You can modify the query as needed:

Query for Italy Note the query now has been modified to include results for just Italy.$filter=CountryName%20eq%20%27Italy%27&$top=100

  Consuming the Data from Visual Studio
  Some basic steps to consume data

Step 1 Start Visual Studio and open the starter project
Step 2 Add a service reference to the data
Step 3 Add using statements
Step 4 Add the Account Key to your code so you can access the data
Step 5 Create a LINQ query to get to the data
Step 6 Run the code and see the results displayed

At a high level, here are the changes we will need to make:

Here is the class we added:

Service Reference for UN Gender Data
Service Reference Name UNData
Using Statements to add using System.Net;
using ConsumingDataMarketData;


Here are the results:

Intellisense is available – notice that as soon as we hit the period (.) we get information about our data source, making the coding less error-prone.



It is very easy to consume DataMarket data. It is in atom pub format. Also notice that we did not need to worry about putting the OData syntax. Just execute the LINQ query and the tooling takes care of the rest.

Comments (0)

Skip to main content