Code Focused

Selling Data in the Windows Azure Marketplace

Learn how to publish data in the Windows Azure Marketplace for a monthly income with just a few hours effort.

Making your database available for sale on the Microsoft Windows Azure Marketplace is straightforward, especially if you are publishing a SQL Azure table or exposing an OData service over HTTPS for exclusive use by the Marketplace. In just a few hours, your data can be submitted and ready to provide a monthly income without billing hassles.

In my November column, “Free Databases in the Windows Azure Marketplace,” I explored 13 low cost or free databases available for consumption via Web services and provided sample Visual Basic .NET code to access those services via an ASP.NET MVC 3 Web site. The next step is to show you how to get your own applications and data into the Windows Azure Marketplace for sale as a content provider.

Data Publishing

If you have data to publish in the DataMarket section of the Marketplace, the Data Publishing Kit is available for download here. Data can published to the Marketplace using multiple technologies: SQL Azure, a REST-based Web service, a SOAP-based Web service or an OData service.

The communication protocol tabular data stream (TDS) is supported for SQL Azure database tables. HTTP is the only supported transport protocol for REST, SOAP and OData services. The DataMarket, in conjunction with the Xbox and Zune billing system, manages all aspects of the credit card monthly billing including trial offers. Content providers are not involved in billing other than to receive payments. Microsoft retains a 20 percent commission on data subscription sales in the Marketplace.

Publishing data from SQL Azure allows you to expose selected tables and views. Note that stored procedures are not supported. Any column that can be queried needs to be included in one or more indices. Tables require a primary key. Columns can't have the same name as the table that contains them. Views can be used to present data that requires multiple tables to be logically joined. Database size is limited by SQL Azure, which currently supports a maximum of 150 GB.

End users can query the information as if they have access to the SQL Azure database. A query consists of any result set up to 100 rows. More than 100 rows in the result is split among pages; and each page represents a query for billing purposes. Multiple clones of the database can be created and the Marketplace will load balance among the clones. The IP address range 131.107.* must be whitelisted and “Allow Microsoft Services” set to true in the SQL Azure portal.

Publishing data via an OData-based Web service in ATOM format is the native format provided by the DataMarket. Content providers with an OData source pass their service through the DataMarket and the root of their service domain is replaced with the DataMarket service root to ensure proper billing. Otherwise, the data doesn't need to be present in Windows Azure. You can choose to expose service operations that limit the end user to specific information, or expose entity sets which allow flexible queries. The provider determines the number of rows to be returned and when paging is required.

Publishing data via a REST-based Web service is supported if the DataMarket service maps the REST service to an ATOM-based OData service as described above. To do this, all parameters need to be exposed as HTTP parameters. The Web service response must be in an XML format and have only one repeating element that contains the response set. Flexible query is not supported with a REST-based Web service.

Publishing data via a SOAP-based Web service is similar to a REST-based Web service. The only difference: DataMarket service call parameters can be provided in the XML body that's posted to the provider’s service.

For REST or SOAP Web services, a sample result set must be provided with specifications on how to map the data values to the strongly typed values returned by OData. A mapping of all service error codes to HTTP status codes is also required.

OData Service Sample

Providing data to the Windows Azure Marketplace via an OData service is straightforward. Create an OData service in Visual Studio and then make it available on an HTTPS Web site with basic username / password authentication required.

To demonstrate creating a simple OData service, I have created a sample SQL Server 2008 Express database with a single table containing Michigan zip code information as shown in Figure 1. The code download for this article includes a backup of the database and the scripts needed to create the database and populate it with data. Use Microsoft Visual Web Developer 2010 Express or above to create the application. You may also need to install Entity Framework 4.1 or a later version.


[Click on image for larger view.]
Figure 1. Sample data for Windows Azure Marketplace OData provider

Create a Visual Studio ASP.NET Empty Web Application project. Add an ADO.NET Entity Data Model item to the project and follow the wizard prompts to add the USZipCodes table from the USZipInfo database. Next add a WCF Data Service item to the project. Update USZipCodes.svc.vb to initialize your Entity Data Model as shown below. It is acceptable to set the EntitySetRights to AllRead because security will be provided by Internet Information Services and not the application. I recommend that you set your entity PageSize to 100 rows to match the standard return set size in the Windows Azure Marketplace.

 Public Class USZipCodes
      Inherits DataService(Of USZipCodeInfo.USZipInfoEntities)

      Public Shared Sub InitializeService(ByValconfig As DataServiceConfiguration)
config.SetEntitySetAccessRule("USZipCodes", EntitySetRights.AllRead)
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2
config.SetEntitySetPageSize("USZipCodes", 100)
      End Sub
  End Class

Set the start page of the site to your USZipCodes.svc file and run to display the browser screen shown in Figure 2.


[Click on image for larger view.]
Figure 2. Default response from the USZIPCodes.svc OData service


To verify the collection, add /USZipCodes to the URL to display the browser page as shown in Figure 3. Lastly make the service available to the DataMarket team by deploying the service to an HTTPS Web site with basic authentication enabled. Provide the OData site password to the team in a separate email as instructed in the Data Market application.


[Click on image for larger view.]
Figure 3. The USZipCodes collection from the sample OData service
Security

All communication between the DataMarket and the client is encrypted. If the provider’s data source is exposed to the Internet, as most will be, it must implement security to allow access by the DataMarket but not general public access to ensure all requests for data are routed through the DataMarket for billing purposes. If data is published via one of the approved Web service methods, proper credentials must be provided to the DataMarket to authenticate the provider’s Web service. This can be done with an API key or authentication token and needs to be provided either as an HTTP parameter, in a HTTP header as a key-value pair, or via basic authentication. These credentials will be passed with each service call.

Paid Subscriptions

Pricing is per monthly subscription only. Multiple pricing levels can be defined based on the number of transactions. On the low-end, a certain number of transactions may optionally be permitted at no charge. The maximum number of transactions can be a fixed number or unlimited. When the subscriber reaches the maximum number of transactions for the subscribed level, no further transactions are permitted until the subscription is updated or the next monthly billing period begins.
Optional trial offers provide one month free at a certain transaction limit. The trial automatically converts to a paid subscription at the (potentially different) specified transaction level if the trial is not cancelled within the trial period.

Geographic Regions

Provider data can be made available in any of the following countries: Australia, Austria, Canada, France, Germany, Italy, Spain, the United Kingdom and last but not least, the United States. These are the only countries for which paid subscriptions are available. If the data is provided at no charge, it can optionally be extended to the rest of the world.

Submit for Publishing

Additional information required for publishing includes company name and description, logo, business contact, financial contact, technical contact, production support contact, privacy policy, end-user license, official uniquename, both a short and long description, between three and six screen shots or data visualizations, which categories to list the offering in, and your desired global geographical distribution regions.
For SQL Azure databases, the DataMarket team needs the connection string(s) to the content, and which table or views and columns to expose. Identify which columns, if any, are not query-able and only returned within the results. Finally, for all data sources provide a set of sample queries that the DataMarket team can use for testing against the provider database.

Monthly Income

In a few hours, your data can be submitted and ready to provide a monthly income. Even though Microsoft retains 20 percent of revenue as a sales commission, this opportunity is certainly worth a little time and consideration of what data you can generate that others might be willing to purchase by subscription. Good luck!

About the Author

Joe Kunk is a Microsoft MVP in Visual Basic, three-time president of the Greater Lansing User Group for .NET, and developer for Dart Container Corporation of Mason, Michigan. He's been developing software for over 30 years and has worked in the education, government, financial and manufacturing industries. Kunk's co-authored the book "Professional DevExpress ASP.NET Controls" (Wrox Programmer to Programmer, 2009). He can be reached via email at [email protected].

comments powered by Disqus

Featured

Subscribe on YouTube