Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Building Azure Marketplace Applications

Building Azure Marketplace Applications

|Views: 10|Likes:
Published by Herbert Leipold

More info:

Published by: Herbert Leipold on Sep 18, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less





Building Windows Azure Marketplace Applications
Building Marketplace Applications
This is a step-by-step guide to creating applications that can be published and sold on the WindowsAzure Marketplace. To get started building an application for the Windows Azure Marketplace, youneed to be familiar with Web application development basics (for example, using ASP.NET)as well as OAuth consent flow basics.
The Windows® Azure™ Marketplace supports OAuth 2.0 for authentication and authorization
. Inaddition to basic OAuth flows, a well-functioning Windows Azure Marketplace Application must be ableto react to events when users purchase a subscription to the application and cancel the subscription tothe application.In the first case, the application must provide a mechanism to associate the Windows AzureMarketplace subscription information delivered to it via the Marketplace Application Token (see below)with the user identity used within the application. This step is called subscription provisioning.In the second case, the reverse process is required
the application must provide a mechanism toreceive subscription cancellation events and de-provision access to the application for all usersassociated with the subscription in question.
Development Steps
To create Web solutions that can be purchased on the Windows Azure Marketplace, applicationdevelopers must implement the following capabilities:
Capability Description Location in SamplesOAuthConfiguration
Ability to configure OAuthendpoints and constants withWindows Azure Marketplaceinformation and application-specific informationWindows Azure Marketplace information(which is static from the application point of view) is available as Settings in the OAuthUtility. Default values should work for testing,production values should be configured inweb.configApplication-specific information is available asthe custom AzureMarketplaceConfigurationclass and in the corresponding web.configGlobal.asax contains a
callthat is crucial for the overall functionalitydescribed below.
An internet-accessibleHttp/Https (Https isThe AuthorizationResponseHandler classprovides this capability by implementing
Building Windows Azure Marketplace Applications
Page recommended) Endpointcapable of receiving OAuthAuthorization Codes andMarketplace App Tokens inGET requests.This endpoint needs to befarm-ready, meaning that itcannot rely on requests andresponses to be delivered tothe same server in the webfarm.Having received anAuthentication Code, thisendpoint must be capable of contacting the Token Endpointin order to exchange theAuthorization Code for a pairof Access and Refresh Tokens.These two tokens will besubsequently used for accessto Windows AzureMarketplace Resources.IHttpAsyncHandler. This handler, in turn, usesthe WIF Authorization Handler to perform itswork.Please note that in order to use the handler, itwill need to be registered in the
Handlers section:
<add name="AzureMarketplaceOAuthHandler"  verb="*"  path="AzureMarketplaceOAuthHandler.ashx"  type="Microsoft.AzureMarketplace.OAuthUti lity.AuthorizationResponseHandler,Microsoft.AzureMarketplace.OAuthUtility" /> 
The Absolute Url of the handler will be used onthe application registration page as the redirectUrl.
Windows AzureMarketplaceApplication TokenVerification
Ability to verify WindowsAzure Marketplace AppTokens received by theAuthorization Endpoint, inparticular:
Ensuring consistentsignatureThe SimpleWebToken class provides aSignVerify method that is invoked from theAzureMarketplaceProvider class to validate thetoken signature based on the Client Secret (thatis known only to the application and theMarketplace).
Ability to extract subscription-specific claims from WindowsAzure Marketplace AppTokens and associate/dis-associate subscriptioninformation with useridentities.The AzureMarketplaceWebTokenExtensionclass provides a series of extension methods toextract claims of interest from the Simple WebToken. TheAzureMarketplaceProvider.HandleSubscriptionmethod shows how to ensure that subscriptioninformation gets recorded in the applicationdatabase.
Access TokenRenewal
When performing operationsthat require access toWindows Azure MarketplaceResources on behalf of theuser, the application needs anability to renew access tokens(which expire) using refreshtokens (which do not expire)by communicating with theThe TokenRenewalScope class provides anIDisposable abstraction for token renewal. Thisclass also has methods to execute an action (forexample, retrieve data from the DataMarket)after token has been successfully renewed.For applications that use DataMarket data, the
classprovides a convenient wrapper around the
Building Windows Azure Marketplace Applications
Page Windows Azure MarketplaceToken Endpoint.Data Service Context for access to Data MarketData Offers with access token used forauthentication on behalf of the user. Forapplications that do not use data, this is notneeded.
Windows AzureMarketplace AccessVerification
When rendering pages tousers, the application needsthe ability to detect whetheror not the currently logged inuser has access to theWindows Azure Marketplace(i.e. has an activesubscription).The AzureMarketplacePage class provides basicaccess verification in the form of TheDetectMarketplaceAccess method. This, inturn, uses the
VerifyAccessToAzureMarketplace method toensure that access and refresh tokens stillrepresent a valid subscription.
We are working on a separate endpointthat will allow solutions to explicitly requestsubscription status data. We will release anupdate to this document as soon as thatendpoint is ready.
Sequence Diagrams
See separate document
Enclosed Samples
Sample FunctionalitySolutionWithData.sln
Implemented as an ASP.NET WebForms application that uses theEnhanced WIF OAuth Library to showcase a solution that:
Uses the SQL Membership Provider and FormsAuthentication as a user authentication mechanism
Accesses the Weather Bug Historical Data Offer
Uses a local application Database and the Entity Frameworkwith POCO generation template to store and manageWindows Azure Marketplace subscription information
Implemented as a ASP.NET WebForms application that uses theEnhanced WIF OAuth Library to showcase a solution that:
Uses the SQL Membership Provider and FormsAuthentication as a user authentication mechanism
Does not use DataMarket Data
Uses a local application Database and the Entity Frameworkwith POCO generation template to store and manageWindows Azure Marketplace subscription information

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->