<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>simonguest.com &#187; Azure</title>
	<atom:link href="http://simonguest.com/category/azure/feed/" rel="self" type="application/rss+xml" />
	<link>http://simonguest.com</link>
	<description>The only person allowed to login as &#039;guest&#039;</description>
	<lastBuildDate>Fri, 20 Jan 2012 15:10:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Extracting and Using Facebook OAuth Token from ACS</title>
		<link>http://simonguest.com/2011/11/11/extracting-and-using-facebook-oauth-token-from-acs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extracting-and-using-facebook-oauth-token-from-acs</link>
		<comments>http://simonguest.com/2011/11/11/extracting-and-using-facebook-oauth-token-from-acs/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 13:23:39 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Neudesic]]></category>

		<guid isPermaLink="false">http://simonguest.com/2011/11/11/extracting-and-using-facebook-oauth-token-from-acs/</guid>
		<description><![CDATA[A couple of my previous blog posts have shown how AppFabric ACS (Access Control Service) can be used as part of the Windows Azure Toolkit for iOS to enable federated authentication with Facebook, Google, Yahoo, and other providers. I was recently asked whether it’s possible to extract an OAuth token as part of the ACS [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of my previous blog posts have shown how AppFabric ACS (Access Control Service) can be used as part of the Windows Azure Toolkit for iOS to enable federated authentication with Facebook, Google, Yahoo, and other providers.</p>
<p>I was recently asked whether it’s possible to extract an OAuth token as part of the ACS sign in process that can then be presented to Facebook’s Graph API in order to access details such as friends lists, photos, etc. In this post, I&#8217;ll cover how this can be done.</p>
<p>The first step is of course to display the authentication page. As you&#8217;ve seen in previous posts, this can be achieved using the following:</p>
<pre>WACloudAccessControlClient *acsClient = [WACloudAccessControlClient accessControlClientForNamespace:@“iostest-walkthrough” realm:@“uri:wazmobiletoolkit”];

[acsClient showInViewController:self allowsClose:NO withCompletionHandler:^(BOOL authenticated) { if (!authenticated) { NSLog(@"Error authenticating"); } else { WACloudAccessToken *token = [WACloudAccessControlClient sharedToken]; NSString *securityToken = [token securityToken]; ... }
}];</pre>
<p>In the application, this will display the federated login dialog, and prompt the user to enter their Facebook credentials.</p>
<p><img src="http://simonguest.com/wp-content/uploads/2011/11/myWPEdit_Image_1321045984.jpg" alt="myWPEdit Image" /></p>
<p>You&#8217;ll notice that the ACS client returns a cloud access token, of which a security token can be extracted. This security token is a set of claims returned from ACS. Here’s an example:</p>
<pre>http://schemas.microsoft.com/ws/2008/06/identity/claims/expiration=2011-11-11T22:00:00.3593475Z&amp;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress=me%40simonguest.com&amp;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name=Simon+Guest&amp;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier=677830765&amp;http://www.facebook.com/claims/AccessToken=AAADWLwgHWSUBABBXdxbhJB0ZBtA3VOfPSsqzKKwObAtW2rb8EGGTQ8EvnvAdNOcZAGpKfV2gSGbNg7f0gxk4BhI1rhzKEn17VLw343gZDZD&amp;http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider=Facebook-235497486506277&amp;Audience=uri:wazmobiletoolkit&amp;ExpiresOn=1321044986&amp;Issuer=https://iostest-walkthrough.accesscontrol.windows.net/&amp;HMACSHA256=bnvyPmX4/PcWhiImgVVIvSqwHpc4cfi0vI6%2b/BSDK0Q%3d</pre>
<p>If we want to make follow on calls to Facebook’s Graph API, we are going to need to present the Facebook User ID and an OAuth Token. Fortunately both of these can be extracted from the token.</p>
<p>To extract this, we first HTTP encode the token:</p>
<pre>NSMutableArray *httpEncoding = [NSMutableArray arrayWithObjects:[NSArray arrayWithObjects:@"%3a",@":",nil], [NSArray arrayWithObjects:@"%2f",@"/",nil], nil]; 

while ([httpEncoding count] &gt;= 1) { securityToken = [securityToken stringByReplacingOccurrencesOfString:[[httpEncoding objectAtIndex:0] objectAtIndex:0] withString:[[httpEncoding objectAtIndex:0] objectAtIndex:1]]; [httpEncoding removeObjectAtIndex:0]; }

NSError *error = NULL;</pre>
<p>Using a simple RegEx search we can extract the Facebook User ID:</p>
<pre>NSRegularExpression regex = [NSRegularExpression regularExpressionWithPattern:@“http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier=([0-9])” options:0 error:&amp;error];
NSTextCheckingResult *match = [regex firstMatchInString:securityToken options:0 range:NSMakeRange(0, [securityToken length])]; firstRange = [match rangeAtIndex:1]; fbuserId = [securityToken substringWithRange:firstRange];</pre>
<p>And the required OAuthToken:</p>
<pre>regex = [NSRegularExpression regularExpressionWithPattern:@“http://www.facebook.com/claims/AccessToken=([A-Za-z0-9]*)” options:0 error:&amp;error];

match = [regex firstMatchInString:securityToken options:0 range:NSMakeRange(0, [securityToken length])];
NSRange firstRange = [match rangeAtIndex:1];
oauthToken = [securityToken substringWithRange:firstRange];
</pre>
<p>Now it’s just a case of calling the Graph API using these credentials:</p>
<pre>NSString *graphURL = [NSString stringWithFormat:@“https://graph.facebook.com/%@/friends?access_token=%@”,fbuserId,oauthToken];</pre>
<p>For the purposes of this post, let’s take a quick look at my list of friends.</p>
<pre>NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:graphURL]];
NSURLResponse *response = NULL;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error];
NSString *friendsList = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
regex = [NSRegularExpression regularExpressionWithPattern:@“id” options:0 error:&amp;error];
NSUInteger friendCount = [regex numberOfMatchesInString:friendsList options:0 range:NSMakeRange(0, [friendsList length])];</pre>
<p>Displaying the friend count in a UIAlertView on the screen shows how popular (or not!) I am:</p>
<p><img src="http://simonguest.com/wp-content/uploads/2011/11/myWPEdit_Image_1321046009.jpg" alt="myWPEdit Image" /></p>
<p>A simple example, but hopefully this shows not only that you can authenticate against Facebook using AppFabric ACS, but also how the returned Facebook User ID and OAuth Token can be used to make further calls to Facebook using the user’s credentials.</p>
]]></content:encoded>
			<wfw:commentRss>http://simonguest.com/2011/11/11/extracting-and-using-facebook-oauth-token-from-acs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with the Windows Azure Toolkit for Android</title>
		<link>http://simonguest.com/2011/10/21/working-with-the-windows-azure-toolkit-for-android/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=working-with-the-windows-azure-toolkit-for-android</link>
		<comments>http://simonguest.com/2011/10/21/working-with-the-windows-azure-toolkit-for-android/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 15:16:18 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Neudesic]]></category>

		<guid isPermaLink="false">http://simonguest.com/2011/10/21/working-with-the-windows-azure-toolkit-for-android/</guid>
		<description><![CDATA[At the end of August, Microsoft published the Windows Azure Toolkit for Android. At Neudesic, the partner behind developing the both toolkits for iOS and Android, we&#8217;ve been working with customers that use the toolkit to connect mobile applications to the cloud. One of the recent requests however has been to provide a walkthrough of [...]]]></description>
			<content:encoded><![CDATA[<p><small>At the end of August, Microsoft </small><a href="http://www.zdnet.com/blog/microsoft/microsoft-rolls-out-windows-azure-toolkit-for-android/10503"><small>published</small></a><small> the Windows Azure Toolkit for Android. At Neudesic, the partner behind developing the both toolkits for iOS and Android, we&#8217;ve been working with customers that use the toolkit to connect mobile applications to the cloud. One of the recent requests however has been to provide a walkthrough of getting started with the toolkit. The current build on </small><a href="http://github.com/microsoft-dpe"><small>GitHub</small></a><small> was released for a specific version of Eclipse and the Android tools, and as a result, can be a little challenging getting the library and sample code up and running.<br />
</small> <small> </small><br />
<small>In this post, I&#8217;ll explain what it takes to download the toolkit, create a brand new environment in Eclipse, and get started quickly with the toolkit.<br />
</small> <strong><small> </small></strong><br />
<strong><small>Getting Started – What You&#8217;ll Need</small></strong><small><br />
</small> <small> </small><br />
<small>Firstly, there is a list of tools that you&#8217;ll need to download.<br />
</small> <small> </small><br />
<small>1. </small><strong><small>Eclipse.</small></strong><small> Download from http://eclipse.org – we&#8217;ll be using Helios in this tutorial.<br />
</small><br />
<small>2. </small><strong><small>JDK. </small></strong><small> We&#8217;ll be using the default that ships with Mac OSX, but if you are on a PC, you&#8217;ll need JDK 1.6 or higher.<br />
</small><br />
<small>3. </small><strong><small>Android SDK and Eclipse Tooling.</small></strong><small> Download the Android SDK from http://developer.android.com (we are using r14 for this walkthrough). Also follow the instructions for configuring the Android tooling within Eclipse. After you have installed everything, use the AVD manager to setup a new AVD for an Android 2.3.3 device.<br />
</small> <small> </small><br />
<strong><small>Setting Up the Library in Eclipse<br />
</small></strong> <strong><small> </small></strong><br />
<small>To import and build the library in Eclipse, perform the following steps.<br />
</small> <small> </small><br />
<small>1. Download the Windows Azure Toolkit for Android from GitHub. If you have the Git client installed, you can use this command:<br />
</small> <small> </small><br />
<small>git clone https://github.com/microsoft-dpe/wa-toolkit-android<br />
</small> <small> </small><br />
<small>Otherwise, go to the site and pull down the zip file of the repo.<br />
</small> <small> </small><br />
<small>2. Create a new directory for your Eclipse workspace:<br />
</small> <small> </small><br />
<small>mkdir wa-toolkit-android-workspace<br />
</small> <small> </small><br />
<small>3. Launch Eclipse, and point the default workspace to this newly created directory:<br />
</small> <small> </small><br />
<small><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234031.jpg" alt="myWPEdit Image" /></small><small>￼</small></p>
<ol>
<li>Create a new Android project called <strong>AzureLibrary</strong>, set the target to Android 2.3.3, use <strong>com.microsoft.cloud.android</strong> as the package name, but do not create an activity or test project.</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234174.jpg" alt="myWPEdit Image" /></p>
<ol>
<li>Right click on the AzureLibrary project and select <strong>Import</strong>. Choose <strong>General</strong> / <strong>File System</strong> as the import source, and click on <strong>Next</strong>.</li>
<li>Browse to the /library/src/com folder in the toolkit folder that you downloaded from GitHub.</li>
<li>Click on the <strong>Browse (into folder) </strong>button and select the src folder under your project. Expand the <strong>src</strong> folder, and check the <strong>com </strong>folder as shown in this screenshot:</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234318.jpg" alt="myWPEdit Image" /></p>
<ol>
<li>Click on the Finish button. The import will complete.</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234368.jpg" alt="myWPEdit Image" /></p>
<ol>
<li>Right click on the project, select properties, and change the Java compiler version from 1.5 to 1.6. (The default is 1.5, yet the toolkit uses many constructs only supported in 1.6)</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234440.jpg" alt="myWPEdit Image" /></p>
<ol>
<li>Click OK, and say <strong>yes</strong> to rebuilding the project. The project should now build with no errors.</li>
<li>Assuming everything builds correctly, right click on the project, and select Properties again. Go to the Android setting, and click on the <strong>Is Library</strong> check box.</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234507.jpg" alt="myWPEdit Image" /></p>
<p><strong>Setting Up the Sample Application in Eclipse<br />
</strong></p>
<p>To import and build the sample application in Eclipse, perform the following steps:</p>
<ol>
<li>Create a new Android project called <strong>AzureSample</strong>. Select Android 2.3.3, set the namespace to <strong>com.windowsazure.samples.sample</strong>, and choose not to create an activity.</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234644.jpg" alt="myWPEdit Image" /></p>
<ol>
<li>As you did with the library, right click on the project, and select <strong>Import</strong>. Select the <strong>/samples/simple/src</strong> as the source and import into the <strong>AzureSample/src</strong> folder.</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234748.jpg" alt="myWPEdit Image" /></p>
<ol>
<li>Right click on the project, select <strong>Properties</strong>, select <strong>Android</strong> and add a reference to the <strong>AzureLibrary</strong> project:</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234806.jpg" alt="myWPEdit Image" /></p>
<ol>
<li>Right click on the project, select <strong>Import</strong>. Import from the <strong>/samples/simple/res</strong> folder into the <strong>AzureSample/res</strong> folder. This will import the resources required for the sample application.</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234884.jpg" alt="myWPEdit Image" /></p>
<p>Answer <strong>yes </strong>when prompted to overwrite the <strong>main.xml</strong> file.</p>
<ol>
<li>Right click on project, select <strong>Import</strong> and select the file system again. Select the <strong>AndroidManifest.xml</strong> from the root of the source directory and import into the root of the destination project.</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319234988.jpg" alt="myWPEdit Image" /></p>
<p>The Sample project should now build with no errors.</p>
<p><strong><br />
</strong><br />
<strong>Configuring your Windows Azure Account Name and Key<br />
</strong></p>
<p>In order to setup the sample project, you need to supply your account name and key, as provided by Windows Azure. You can obtain this by logging into the Windows Azure Portal (http://windows.azure.com) and navigating to Storage Accounts to obtain the details.</p>
<p>When you have the name and key, perform the following:</p>
<ol>
<li>In the sample project, open <strong>ProxySelector.java</strong> from the <strong>src/com.windowsazure.samples.sample</strong> package.</li>
<li>At the top of the file replace the <strong>ACCOUNT</strong> and <strong>ACCESS_KEY</strong> values with the account name and access key for your Azure storage account.</li>
</ol>
<p>&nbsp;</p>
<p><strong>Running the Sample</strong><strong><br />
</strong><br />
1. To run the sample, right click on the sample project, select <strong>Run As / Android Application.</strong></p>
<ol>
<li>Once the emulator is up and running, unlock the device.</li>
<li>Refer to the LogCat/Console window in Eclipse if there are any errors.</li>
<li>Click on the Start button in the sample application.</li>
<li>Select either table, blob, or queue storage and browse the storage associated with your Windows Azure account.</li>
</ol>
<p><img src="http://simonguest.com/wp-content/uploads/2011/10/myWPEdit_Image_1319235204.jpg" alt="myWPEdit Image" /></p>
<p>That’s it! Your sample application is now up and running, and you are able to browse Windows Azure storage!</p>
]]></content:encoded>
			<wfw:commentRss>http://simonguest.com/2011/10/21/working-with-the-windows-azure-toolkit-for-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Federated Identity for iOS Applications</title>
		<link>http://simonguest.com/2011/08/01/using-federated-identity-for-ios-applications/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-federated-identity-for-ios-applications</link>
		<comments>http://simonguest.com/2011/08/01/using-federated-identity-for-ios-applications/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 08:45:42 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://simonguest.com/2011/08/01/using-federated-identity-for-ios-applications/</guid>
		<description><![CDATA[Last week, Microsoft released v1.2 of the Windows Azure Toolkit for iOS.&#160; As development partner for the toolkit, Neudesic has been working with several customers on implementing ACS for iPhone and iPad applications.&#160; Due to popular demand, I wanted to share a short overview of how simple it is to get this up and working [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, Microsoft released v1.2 of the Windows Azure Toolkit for iOS.&#160; As development partner for the toolkit, <a href="http://www.neudesic.com">Neudesic</a> has been working with several customers on implementing ACS for iPhone and iPad applications.&#160; Due to popular demand, I wanted to share a short overview of how simple it is to get this up and working for your own iOS projects.</p>
<p><b>First, some background…</b></p>
<p>Many iPhone and iPad applications have a need to authenticate.&#160; Maybe it&#8217;s to access sensitive information or record a particular high score against your name.&#160; Implementing an authentication scheme for iOS can however be time consuming and tricky – you often have to create an authentication service, host it, expose the service through REST, and consume it on the device.&#160; And afterwards you are responsible for backing up the user database and dealing with lost passwords, etc.</p>
<p>To help overcome this many applications are now turning to external providers.&#160; For example, to identify yourself when playing Zynga Poker, instead of creating a new account, you simply sign into Facebook (when launching the application for the first time) and the game uses these credentials as you play. This type of sign in method is called federated identity. This prevents Zynga from having to maintain a complex and large set of user accounts and passwords, and also prevents the player from having to remember yet another username and password.&#160; </p>
<p>Adding federated identity to your iPhone or iPad application can be difficult, requiring knowledge of exchange secure tokens with a set of providers, and creating and sending the right OAuth headers in your application.&#160; Removing this difficultly is exactly what we are trying to address in v1.2 of the Windows Azure Toolkit for iOS.&#160; </p>
<p><b>Sounds great – how do I use it?</b></p>
<p>To implement ACS in your application, you&#8217;ll first need to access the Windows Azure portal by navigating to <a href="http://windows.azure.com/">http://windows.azure.com</a> and signing in with your credentials. </p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image002.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image002_thumb.png" width="209" height="244" /></a></p>
<p>Click on the <b>Service Bus, Access Control &amp; </b>Caching menu item and select the <b>Access Control</b> menu item under the <b>AppFabric</b> folder.&#160; Select an active Windows Azure subscription and click on the <b>New</b> button in the toolbar.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image004.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image004_thumb.png" width="216" height="244" /></a></p>
<p>The new service namespace dialog will open.&#160; Ensure that <b>Access Control</b> is selected, and enter a unique namespace and country/region for the service.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image006.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image006_thumb.png" width="244" height="117" /></a></p>
<p>The ACS namespace will now be created.&#160; This might take a few minutes.&#160; Wait until the namespace is showing in an <b>Active</b> state.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image008.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image008_thumb.png" width="244" height="16" /></a></p>
<p>Once this is complete, highlight the newly created service and click on the <b>Access Control Service</b> button in the toolbar.&#160; This will launch the Access Control Service portal. </p>
<p>Within the portal, click on<b> Identity Providers </b>and add the identity providers you would like to use for your application.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image010.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image010_thumb.png" width="244" height="111" /></a></p>
<p>The default is Windows Live ID, but you can add other preconfigured providers (such as Google and Yahoo!) as well as external identity systems configured to use WS-Federation.</p>
<p>Once you have added the required providers, click on the <b>Relying Parties</b> section of the portal.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image012.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image012_thumb.png" width="244" height="76" /></a></p>
<p>Click on the <b>Add</b> button and enter the following information for the relying party application:</p>
<p><b>Name</b> – a given name for your application</p>
<p><b>Realm</b> – a unique ID for your application.&#160; For this walkthrough, we’ll be using uri:wazmobiletoolkit</p>
<p><b>Return URL</b> – you can leave this blank</p>
<p><b>Error URL</b> – you can leave this blank</p>
<p><b>Token Format</b> – select SWT</p>
<p><b>Token Lifetime</b> – Feel free to change the default from 600 seconds. </p>
<p>Select the identity providers that you would like to use, and then under the <b>Token Signing Settings</b> section, click on the <b>Generate</b> button to create a new symmetric key that will be used for this application.</p>
<p>Finally, click on the <b>Save</b> button.&#160; This will create the Relying Party Application.</p>
<p>Next, go into the <b>Rule Groups</b> section of the portal and select the default rule group that was created for the application.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image014.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image014_thumb.png" width="244" height="85" /></a></p>
<p>Click on the <b>Generate</b> link in order to generate a set of default rules for this rule group.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image016.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image016_thumb.png" width="244" height="39" /></a></p>
<p>Select the providers that you wish to use, and click on the <b>Generate</b> button.&#160; Once this is complete, you should see a set of rules.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image018.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image018" border="0" alt="clip_image018" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image018_thumb.png" width="244" height="82" /></a></p>
<p>After this step is complete, ACS has now been configured correctly to be used with your iOS application.&#160; Make a note of your Service Namespace (found at the top of the portal) and Realm.</p>
<p><b>Ok, the service is now setup.&#160; How do I use it in my Xcode project?</b></p>
<p>To start, launch Xcode (4.02 or higher) and create a new project.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image020.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image020" border="0" alt="clip_image020" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image020_thumb.png" width="244" height="167" /></a></p>
<p>From the project template dialog, select a <b>View-based application</b> and click on the <b>Next</b> button.&#160; Enter a <b>Product Name</b> and <b>Company Identifier</b> and click on the <b>Next</b> button to continue.&#160; Select a directory to use for the project file and return to the IDE.</p>
<p>Next, download the latest version of the Windows Azure Toolkit for iOS library from <a href="http://github.com/microsoft-dpe/watoolkitios-lib">http://github.com/microsoft-dpe/watoolkitios-lib</a>. In the download will be a zip file containing two versions of the library (one for the device, one for the simulator) and some header files for the project.</p>
<p>Right click on your project and select the <b>Add Files to…</b> menu option.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image022.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image022" border="0" alt="clip_image022" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image022_thumb.png" width="244" height="204" /></a></p>
<p>Locate the .a file (for the simulator) and header files and add them to your project.&#160; You may want to create a new group (called lib) to store these in.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image024.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image024" border="0" alt="clip_image024" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image024_thumb.png" width="244" height="198" /></a></p>
<p>Now we need to add a reference to a library required for XML parsing.&#160; To do this, click on the top most project file, click on the target in the 2nd column of the IDE, and select <b>Build Phases</b> from the tab menu. </p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image026.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image026" border="0" alt="clip_image026" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image026_thumb.png" width="244" height="44" /></a></p>
<p>In the main window, expand the <b>Link Binary with Libraries</b> option.</p>
<p>Ensure that the libwatoolkitios.a file has been automatically added as a reference, click the + button to add a new library, and select the libxml2.dylib library from the drop down list.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image028.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image028" border="0" alt="clip_image028" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image028_thumb.png" width="171" height="244" /></a></p>
<p>Click on the <b>Add</b> button to add a reference to this library for your project.</p>
<p>Before we start adding any code, we need to add a couple of required linker flags to the project.&#160; To do this, click on the <b>Build Settings</b> tab (next to Build Phases).</p>
<p>In the search box, type “other linker” to filter the settings.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image030.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image030" border="0" alt="clip_image030" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image030_thumb.png" width="244" height="36" /></a></p>
<p>You should see a setting called <b>Other Linker Flags</b>.&#160; Double click on the right side of this row to add new flags.</p>
<p>Click on the + button to add two flags.&#160; The first is <b>–ObjC</b> and the second is <b>–all_load</b>.&#160; Once complete, your linker flags should look like the following screenshot:</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image032.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image032" border="0" alt="clip_image032" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image032_thumb.png" width="244" height="58" /></a></p>
<p>Click on the <b>Done</b> button to save these settings.&#160; The project is now configured correctly to reference the Windows Azure Toolkit library.</p>
<p>To test that the library works, click on the project’s <b>[ProjectName]AppDelegate.m</b> file.&#160; Add the following #import statement at the top of the class:</p>
<p>#import &quot;WACloudAccessControlClient.h&quot;</p>
<p>Next, search for a method called <b>didFinishLaunchingWithOptions </b>and after the <b>[self.window makeKeyAndVisible]</b> line, enter the following code.</p>
<pre class="brush:c">

NSLog(@&quot;Intializing the Access Control Client...&quot;);

WACloudAccessControlClient *acsClient = [WACloudAccessControlClient accessControlClientForNamespace:@&quot;iostest-walkthrough&quot; realm:@&quot;uri:wazmobiletoolkit&quot;];

[acsClient showInViewController:self.viewController allowsClose:NO withCompletionHandler:^(BOOL authenticated) {

if (!authenticated)

&#160;&#160;&#160; {

NSLog(@&quot;Error authenticating&quot;);

&#160;&#160;&#160; }

else

&#160;&#160;&#160; {

NSLog(@&quot;Creating the authentication token...&quot;);

WACloudAccessToken *token = [WACloudAccessControlClient sharedToken];

/* Do something with the token here! */

&#160;&#160;&#160; }

}];
</pre>
<p>Replace the namespace and realm in the first line with the service namespace and realm for your own service.</p>
<p>As you can see from the above, the code creates a new instance of the access control client, requests that the client shows itself in the current view controller, and then extracts a token. </p>
<p>Build and run the application in the iOS Simulator. </p>
<p>Once the application starts, you should be prompted to select an identity provider from the list that you configured in your ACS service.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image034.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image034" border="0" alt="clip_image034" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image034_thumb.png" width="132" height="244" /></a></p>
<p>Pick one of the providers, and enter a valid set of credentials.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image036.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image036" border="0" alt="clip_image036" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image036_thumb.png" width="132" height="244" /></a></p>
<p>Click on the <b>Remember me</b> checkbox if you want to skip this step when running this application again, and click on the <b>Sign in</b> button.</p>
<p>The first time the application is run, you’ll be prompted to authorize the application to access your provider data.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/08/clip_image038.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image038" border="0" alt="clip_image038" src="http://simonguest.com/wp-content/uploads/2011/08/clip_image038_thumb.png" width="132" height="244" /></a></p>
<p>Click on the <b>Allow</b> button to continue.&#160; The login window will now disappear and you’ll be returned to your application.</p>
<p>In the debug window, you should see the following two logs:</p>
<p>2011-07-22 10:12:26.284 iostest-walkthrough[25838:207] Intializing the Access Control Client&#8230;</p>
<p>2011-07-22 10:12:36.359 iostest-walkthrough[25838:207] Creating the authentication token&#8230;</p>
<p>If you are seeing this, congratulations!&#160; You&#8217;ve successfully setup federated identity for your application.&#160; The final message indicates that the access token was retrieved and can be used for further use.&#160; The <b>WACloudAccessToken</b> (derived from <b>[WACloudAccessControlClient sharedToken]</b>) contains an NSDictionary of claims and other properties that can be stored within your application.&#160; Using these properties on future calls can be used to identify returning users to your application.</p>
]]></content:encoded>
			<wfw:commentRss>http://simonguest.com/2011/08/01/using-federated-identity-for-ios-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing iPhone and iPad apps that leverage Windows Azure</title>
		<link>http://simonguest.com/2011/04/18/developing-iphone-and-ipad-apps-that-leverage-windows-azure/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=developing-iphone-and-ipad-apps-that-leverage-windows-azure</link>
		<comments>http://simonguest.com/2011/04/18/developing-iphone-and-ipad-apps-that-leverage-windows-azure/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 17:41:41 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Neudesic]]></category>

		<guid isPermaLink="false">http://simonguest.com/2011/04/18/developing-iphone-and-ipad-apps-that-leverage-windows-azure/</guid>
		<description><![CDATA[Thanks to all that came to my session at MIX11 last week – it was a lot of fun to put together despite a couple of demo glitches!&#160; You can now view the recording of this online, as well as browse and download the slides below.&#160; I’ll be sharing the source code for the demos [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to all that came to my session at MIX11 last week – it was a lot of fun to put together despite a couple of demo glitches!&#160; You can now <a href="http://channel9.msdn.com/events/MIX/MIX11/EXT18" target="_blank">view the recording</a> of this online, as well as browse and download the slides below.&#160; </p>
<p>I’ll be sharing the source code for the demos in the next couple of posts. </p>
<div style="width: 425px" id="__ss_7666104"><strong style="margin: 12px 0px 4px; display: block"><a title="Ext18 guest" href="http://www.slideshare.net/simonguest/ext18-guest">Ext18 guest</a></strong><object id="__sse7666104" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=ext18guest-110418123055-phpapp01&amp;stripped_title=ext18-guest&amp;userName=simonguest" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed name="__sse7666104" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=ext18guest-110418123055-phpapp01&amp;stripped_title=ext18-guest&amp;userName=simonguest" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding-bottom: 12px; padding-left: 0px; padding-right: 0px; padding-top: 5px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/simonguest">Simon Guest</a>.</div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://simonguest.com/2011/04/18/developing-iphone-and-ipad-apps-that-leverage-windows-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vote For Me!</title>
		<link>http://simonguest.com/2011/01/26/vote-for-me/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=vote-for-me</link>
		<comments>http://simonguest.com/2011/01/26/vote-for-me/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 05:07:20 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://simonguest.com/2011/01/26/vote-for-me/</guid>
		<description><![CDATA[No, I&#8217;m not running for President&#8230;! Instead, I&#8217;m asking for your help in voting for my session at MIX11 this year: Using iPhone, iPad and Android devices with Windows Azure You have invested a lot learning how to build applications on Microsoft&#8217;s Windows Azure platform. But your customers are asking for solutions that target iPhone, [...]]]></description>
			<content:encoded><![CDATA[<p>No, I&#8217;m not running for President&#8230;!</p>
<p>Instead, I&#8217;m asking for your help in voting for my session at MIX11 this year:</p>
<p><strong>Using iPhone, iPad and Android devices with Windows Azure</strong></p>
<p><em>You have invested a lot learning how to build applications on Microsoft&#8217;s Windows Azure platform. But your customers are asking for solutions that target iPhone, iPad, and Android devices. Now What? How do you leverage your Microsoft skills, while supporting this new user base? How do you connect these devices to services hosted on Windows Azure? What strategies do you need for data sync between the two? Is it possible to develop applications using Microsoft technology that spans all devices? In this session you&#8217;ll learn how to integrate iPhone, iPad, and Android platforms into an existing Windows Azure infrastructure. You&#8217;ll walk away confident in knowing how to extend your existing applications to take advantage of this new wave of mobile devices, working together with the cloud.</em></p>
<p>If you would like to see me present this at MIX this year, click <a href="http://live.visitmix.com/OpenCall/Vote/Session/69" target="_blank">here</a> and follow the cats (you&#8217;ll see what I mean!)</p>
<p>My esteemed colleagues at Neudesic also have submitted sessions.&#160; If you would like to know about <em>Black Belt Windows 7 Development</em>, follow Steve Saxon&#8217;s link and click <a href="http://live.visitmix.com/OpenCall/Vote/Session/162" target="_blank">here</a>.&#160; If you would prefer to hear our UX director Chris McCurry talk about <em>How to build a Showcase Windows Phone 7 Application</em>, click <a href="http://live.visitmix.com/OpenCall/Vote/Session/111" target="_blank">here</a>.</p>
<p>We are doing some great work in the mobility practice here at Neudesic, and we hope that you&#8217;ll vote us in!&#160; Voting ends on February 4th, so cast your ballots now!</p>
<p><a href="http://simonguest.com/wp-content/uploads/2011/01/clip_image002.gif"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://simonguest.com/wp-content/uploads/2011/01/clip_image002_thumb.gif" width="135" height="161" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://simonguest.com/2011/01/26/vote-for-me/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaOne Tutorial: Apache Tomcat on Windows Azure</title>
		<link>http://simonguest.com/2010/09/18/javaone-tutorial-apache-tomcat-on-windows-azure/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javaone-tutorial-apache-tomcat-on-windows-azure</link>
		<comments>http://simonguest.com/2010/09/18/javaone-tutorial-apache-tomcat-on-windows-azure/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 15:00:00 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[JavaOne]]></category>

		<guid isPermaLink="false">http://simonguest.com/2010/09/20/javaone-tutorial-apache-tomcat-on-windows-azure/</guid>
		<description><![CDATA[As I mentioned in my previous post, I’ll be participating in a panel at JavaOne on Monday.  With a similar format to last year, each panelist is given 5 – 10 minutes before it opens up for general discussion. Rather than showing a bunch of marketing slides, I thought it would be more interesting to [...]]]></description>
			<content:encoded><![CDATA[<p><html xmlns="">As I mentioned in <a href="http://simonguest.com/2010/09/08/speaking-at-javaone-2010/">my previous post</a>, I’ll be participating in a <a href="http://www.eventreg.com/cc250/sessionDetail.jsp?SID=313962">panel</a> at JavaOne on Monday.  With a similar format to last year, each panelist is given 5 – 10 minutes before it opens up for general discussion. Rather than showing a bunch of marketing slides, I thought it would be more interesting to put together a short tutorial for running Apache Tomcat on Windows Azure.  When I speak with Java developers interested in Windows Azure, this is often the #1 request.</p>
<p>Here is an overview of what I will be showing:</p>
<p><strong>Step 1 – What you’ll need to get started</strong></p>
<p>As you might imagine, you are going to first need a Windows Azure account.  I would recommend going to <a href="http://www.microsoft.com/windowsazure/offers">www.microsoft.com/windowsazure/offers</a> and signing up for the introductory special, which will allow you to test your application for free.  The introductory offer gives you the first 25 hours at no cost, which should be more than enough time to get up and running.</p>
<p><strong>I</strong><strong>f you are at JavaOne however, </strong>I have a limited quantity (100) of tokens that give you 30 days worth of access with no need to submit any registration or credit card information.  See me at the end of the panel session or throughout the conference, and in exchange for a business card, I’ll be happy to give you one at no cost!</p>
<p>After you have your account, you’ll want to download and install the <a href="http://go.microsoft.com/fwlink/?LinkID=130232">Windows Azure SDK</a>.  After installation, set your PATH environment to include the location of the SDK binaries (typically <em>C:Program FilesWindows Azure SDKv1.1bin</em>).  This is important to ensure that the SDK is accessible from the command line.</p>
<p>Finally, you’ll need to install the <a href="http://code.msdn.microsoft.com/winazuretomcat">Windows Azure Tomcat Solution Accelerator</a>.  Feel free to install this in any directory you’d like – I’m using <em>c:devjavaone2010tomcatazure</em> for the purposes of this tutorial.</p>
<p$1$2$3$4$5$6>
<p><strong>Step 2 – Building and running your site</strong></p>
<p>With all of the pre-requisites downloaded and installed, it’s time to build and test your site.  To do this, open a command prompt, and navigate to the directory that you chose for the solution accelerator.  From this directory, run <strong>buildme.cmd</strong>.  You’ll be prompted to provide the installation path of your Tomcat installation and a JRE on your machine.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb.png" border="0" alt="image" width="244" height="138" /></a></p>
<p>After a successful build, run the <strong>runme.cmd</strong> file. This will run Tomcat using the Windows Azure Desktop Execution Tool – also known as the local development fabric.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image1.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb1.png" border="0" alt="image" width="244" height="138" /></a></p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image2.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb2.png" border="0" alt="image" width="244" height="125" /></a></p>
<p>This is a great way to test that your application is going to work when deployed to production.  Navigate to the URL provided at the end  (replace the tcp with http) to ensure that the Tomcat instance is working correctly on your local machine.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image3.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb3.png" border="0" alt="image" width="244" height="197" /></a></p>
<p>You can open the development fabric tool (found running in your system tray) if you want to stop and/or investigate the service.</p>
<p$1$2$3$4$5$6>
<p><strong>Step 3 – Packaging and deploying your site</strong></p>
<p>Once you are satisfied that everything looks good, it’s time to package the application ready for deployment to the cloud.  To do this, run the <strong>packme.cmd </strong>script.  This will invoke the Windows Azure Packaging Tool, and pull together everything needed into one package file for deployment.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image4.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb4.png" border="0" alt="image" width="244" height="138" /></a></p>
<p>When this has completed, you should see a <strong>Tomcat.cspkg </strong>file and a <strong>ServiceConfiguration.cscfg </strong>file in the directory.  The .cspkg file is quite large as it contains your application, the Tomcat instance, and JRE binaries.  Despite the size, this format makes it convenient if you prefer to use a different version of Tomcat or a different JRE in the future.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image5.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb5.png" border="0" alt="image" width="244" height="138" /></a></p>
<p>To deploy to the cloud, log on to the portal (<a href="http://windows.azure.com">http://windows.azure.com</a>) and create a new hosted service.  Walk through the wizard to specify the name, description, URL, and location where you want the service to be deployed.  Next, hit the “Deploy” button and specify the location of the previous package and configuration file.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image6.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb6.png" border="0" alt="image" width="244" height="197" /></a></p>
<p>You have two options when it comes to deploying – either a file from your local storage (i.e. your local disk) or a file from an Azure storage account (blob storage).  If you have issues with the local storage (many http connections timeout before the package can be uploaded in time), I would recommend using <a href="http://azurestorageexplorer.codeplex.com/">Neudesic’s Azure Storage Explorer</a> to upload your files to a blob storage container.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image7.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb7.png" border="0" alt="image" width="244" height="192" /></a></p>
<p>Hit <em>Deploy</em>, and your package will be uploaded to Windows Azure – this will likely take a few minutes because of the size of the deployment.</p>
<p>Once this has been completed, hit the <em>Run</em> button to bring your site to life.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image8.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb8.png" border="0" alt="image" width="244" height="205" /></a></p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/09/image9.png"><img title="image" style="display: inline; border-width: 0px;" src="http://simonguest.com/wp-content/uploads/2010/09/image_thumb9.png" border="0" alt="image" width="244" height="205" /></a></p>
<p>Once you have a site up and running, feel free to explore some of the ways that you can either scale your application to multiple nodes or explore some of the <a href="http://www.windowsazure4j.org">other features</a> on Windows Azure available to Java developers.</p>
<p$1$2$3$4$5$6>
<p>There are many ways that this could be improved by integrating with existing build environments (I think Maven integration would be fascinating), but hopefully this short tutorial gives you a starting point for getting a simple Tomcat site up and running on Windows Azure.</p>
]]></content:encoded>
			<wfw:commentRss>http://simonguest.com/2010/09/18/javaone-tutorial-apache-tomcat-on-windows-azure/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>QCon San Francisco talk now available online</title>
		<link>http://simonguest.com/2010/05/29/infoq-talk-now-available-online/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=infoq-talk-now-available-online</link>
		<comments>http://simonguest.com/2010/05/29/infoq-talk-now-available-online/#comments</comments>
		<pubDate>Sat, 29 May 2010 01:57:17 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Events]]></category>

		<guid isPermaLink="false">http://simonguest.com/?p=233</guid>
		<description><![CDATA[This is from November 2009, but I&#8217;ve just noticed that my &#8220;Patterns for Cloud Computing&#8221; session recording from QCon San Francisco has been posted online. You can find the recording and slides here.]]></description>
			<content:encoded><![CDATA[<p>This is from November 2009, but I&#8217;ve just noticed that my &#8220;Patterns for Cloud Computing&#8221; session recording from <a href="http://qconsf.com">QCon San Francisco</a> has been posted online. You can find the recording and slides <a href="http://www.infoq.com/presentations/Patterns-for-Cloud-Computing" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://simonguest.com/2010/05/29/infoq-talk-now-available-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving VHDs to the Cloud</title>
		<link>http://simonguest.com/2010/04/22/moving-vhds-to-the-cloud/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=moving-vhds-to-the-cloud</link>
		<comments>http://simonguest.com/2010/04/22/moving-vhds-to-the-cloud/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 22:25:49 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Interoperability]]></category>

		<guid isPermaLink="false">http://simonguest.com/?p=211</guid>
		<description><![CDATA[When I speak with customers about cloud computing, a common question is often “how do I migrate an application to the cloud?&#8221;  While this is a multi-part answer, one of the hurdles for migration is often storage.  Many applications store data using the file system (e.g. read / write a file to d:dataconfig.xml).  Moving these [...]]]></description>
			<content:encoded><![CDATA[<p>When I speak with customers about cloud computing, a common question is often “how do I migrate an application to the cloud?&#8221;  While this is a multi-part answer, one of the hurdles for migration is often storage. </p>
<p>Many applications store data using the file system (e.g. read / write a file to d:dataconfig.xml).  Moving these types of applications to the cloud can be difficult as the storage mechanisms in the cloud are somewhat different. </p>
<p>To help address this problem, in Feb 2010 we released v1.1 of the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5664019e-6860-4c33-9843-4eb40b297ab6&amp;DisplayLang=en">Windows Azure SDK</a> which supports a new feature call Cloud Drives.  A Cloud Drive is the ability to mount a virtual drive in the cloud so that applications can write to it as they would a local drive.  This cloud drive is persisted so that even if the machine goes down, the data is not lost.</p>
<p>What many people don’t realize however is that the format that the Cloud Drive uses is interchangeable with the VHD (Virtual Hard Drive) format used by virtualization products such as Hyper-V, Virtual PC, Windows Server, and Windows 7.  What this means is that you can create a single VHD, use it locally on a Windows PC, attach it to a virtualized image, and now copy it to the cloud and access it there also.  As you can imagine, for anyone looking to migrate applications to the cloud, this opens up a world of possibilities.</p>
<p>In this post, I’ll walk through a series of steps that show creating a VHD from scratch, copying it to the cloud, and accessing it from a web role running in Azure.</p>
<p><strong>Before you begin</strong></p>
<p>You’ll of course need an Azure account.  If you don’t have one, you can go <a href="http://www.microsoft.com/windowsazure/account/">here</a> to sign up.</p>
<p>Once you have your account, you’ll need to setup two new services. </p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb.png" border="0" alt="image" width="425" height="220" /></a> </p>
<p>You’ll need to create a storage account – this is where the VHDs will be stored – and a hosted service to run your application from.  When you set them up, make sure that they are created in the same geography (i.e. don’t have your storage account in Asia, and your hosted service in the US as the drive mounting has to be in the same region).</p>
<p>Once you have your storage account and service created, you are ready to create and upload your VHD. </p>
<p><strong>Step 1.  You’ll need a VHD</strong></p>
<p>If you already have a VHD file that you would like to use, you can skip to Step 2.  You’ll be copying this VHD to the cloud, so you may want to choose a smaller VHD file for test purposes.</p>
<p>If you are running Windows 7, creating a new VHD is easy. </p>
<p>Firstly, go to the start menu and type <strong>disk management</strong>. </p>
<p>From the start menu click on <strong>Create and format hard disk partitions</strong></p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image1.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb1.png" border="0" alt="image" width="344" height="92" /></a></p>
<p>This will open up the disk management tool.  From the <strong>Action</strong> menu, select <strong>Create VHD</strong>.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image2.png"><img style="display: inline; border: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb2.png" border="0" alt="image" width="341" height="326" /></a></p>
<p>Enter a location for the VHD file and a size.  The minimum is 16Mb and the maximum is likely the amount of free disk space on your machine. </p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image3.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb3.png" border="0" alt="image" width="244" height="200" /></a> </p>
<p>When your disk appears in the management tool, right click on the disk name and select <strong>Initialize Disk</strong>.  Select the default (MBR) and select OK.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image4.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb4.png" border="0" alt="image" width="244" height="154" /></a></p>
<p>After initialization, right click on the disk and create a <strong>New Simple Volume</strong>.  Walk through the wizard, accepting the defaults and assign a drive letter to the VHD.  Finally, format the disk using NTFS (a quick format is fine).  If a dialog box appears asking you to format the disk (sometimes the disk gets detected just before formatting has begun), just hit cancel.</p>
<p>After this is done, you can open the drive and access it as you would any other drive. Add some files and folders, etc.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image5.png"><img style="display: inline; border: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb5.png" border="0" alt="image" width="438" height="219" /></a> </p>
<p>When you are ready to upload to the cloud, you’ll need to detach the drive.  To do this, go back in to the disk management tool, right click on the disk name and select <strong>Detach VHD</strong>.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image6.png"><img style="display: inline; border: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb6.png" border="0" alt="image" width="354" height="201" /></a></p>
<p>(Do not select the Delete the virtual hard disk file checkbox – otherwise, they’ll be nothing to upload!)</p>
<p><strong>Step 2.  Upload it to Azure Storage</strong></p>
<p>The next step is to upload the VHD to the cloud.  The VHD will be stored in something called Blob (Binary Large OBject) storage.  You may have heard of blob storage if you’ve seen any of the introductory Azure presentations.  It’s the type of storage that is used for binary data such as images, videos, and the like.</p>
<p>In February we enabled support for Page Blobs.  Page Blobs are binary objects stored in the cloud that support random read/writes through pages.  This makes them ideal for dealing with VHD type of access, and this is the format that we’ll be using to upload our VHD to the cloud.</p>
<p>The one caveat of this is that you must use a tool that supports page blobs (most of the tools available today only support regular blobs).  The tool I would recommend is <a href="http://www.cerebrata.com/Products/CloudStorageStudio/Default.aspx">Cloud Storage Studio</a> by Cerebrata as it supports page blobs through a nice interface.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image7.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb7.png" border="0" alt="image" width="448" height="211" /></a></p>
<p>Open the tool and access the storage account that you created in the “Before you begin” section earlier in this post. </p>
<p>I would recommend creating a new container for your VHD images to keep them separate from other content.  As shown in the screenshot above, I’ve created a container called vhd.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image8.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb8.png" border="0" alt="image" width="416" height="90" /></a></p>
<p>Select the container, and click on the <strong>Upload Page Blob</strong> button.  There are two upload buttons – you need the one with the icon that includes the page and the up arrow.</p>
<p>Point to the location of your VHD file and click on the <strong>Upload</strong> button.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image9.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb9.png" border="0" alt="image" width="428" height="290" /></a></p>
<p>This might take a little way depending on the size of your VHD and the speed of your network.</p>
<p>Once you have uploaded the file, validate that it exists by hitting the refresh button.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image10.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb10.png" border="0" alt="image" width="505" height="71" /></a></p>
<p>With the VHD uploaded, we can now move on to creating the cloud application that accesses it.</p>
<p><strong>Step 3.  Accessing the VHD from Windows Azure </strong></p>
<p>I’m going to assume that you have some knowledge of creating an ASP.NET application and uploading it to Windows Azure.  If you haven’t done this before, I would recommend checking out the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78&amp;displaylang=en">Windows Azure Training Kit</a>.</p>
<p>To access the VHD in the cloud, we create a webrole and use the following code.</p>
<p>Add reference to the <strong>Microsoft.WindowsAzure.CloudDrive </strong>DLL that can be found in the GAC (assuming that you have the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=dba6a576-468d-4ef6-877e-b14e3c865d3a&amp;displaylang=en">v1.1 SDK</a> installed).  Then, in your webrole, you’ll need to add the following using statements:</p>
<pre class="brush:c-sharp">
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient;
</pre>
<p>Here is the code that you should run in your web role.  (You can place this behind a button or something…)</p>
<pre class="brush:c-sharp">
// Setup the account details
String accountName = "";  // insert your storage account name here
String accountKey = "”;  // insert your storage account primary key here

StorageCredentialsAccountAndKey credentials = new StorageCredentialsAccountAndKey(accountName, accountKey);

CloudStorageAccount storageAccount = new CloudStorageAccount(credentials, new Uri(String.Format("http://{0}.blob.core.windows.net",accountName)),
                                                                            new Uri(String.Format("http://{0}.queue.core.windows.net", accountName)),
                                                                            new Uri(String.Format("http://{0}.table.core.windows.net", accountName))
                                                                            );

// initialize the local cache - need to trim the end backslash otherwise, HRESULT=D0000033
LocalResource localCache = RoleEnvironment.GetLocalResource("LocalCache");
CloudDrive.InitializeCache(localCache.RootPath.TrimEnd('\'), localCache.MaximumSizeInMegabytes);

// Create and mount the drive
CloudDrive c = storageAccount.CreateCloudDrive("vhd/myvhd.vhd");
String driveLetter = c.Mount(localCache.MaximumSizeInMegabytes, DriveMountOptions.None);

// do regular System.IO.File and System.IO.Directory operations here against driveLetter
Response.Write(System.IO.Directory.GetFiles(driveLetter + "\").Count() + " files found on the root of the mounted drive.");

// unmount the drive
c.Unmount();
</pre>
<p>There are five main pieces to the code.</p>
<p>Firstly, the storage account reference is created using the account name and key that you retrieve when you setup your Azure account.</p>
<p>After that we need to initialize a local cache used by the cloud drive.  To create this, insert the following code into your ServiceDefinition.csdef file on your webrole.</p>
<pre class="brush:xml">
&lt;LocalResources&gt;
  &lt;LocalStorage name="LocalCache" cleanOnRoleRecycle="false" sizeInMB="100" /&gt;
&lt;/LocalResources&gt;
</pre>
<p>We then create and mount the drive using the <strong>CreateCloudDrive</strong> and <strong>Mount</strong> methods.  Make sure that the path and name to your VHD matches what you uploaded in Step 2.</p>
<p>Once the drive is mounted we get a drive letter (as a string – e.g. “f:\”).  You can then make calls to that drive letter using the regular calls (e.g. <strong>System.IO.File</strong> and <strong>System.IO.Directory</strong>).  In a worker role you can even launch applications from the VHD by spawning a new process. </p>
<p>Finally, to unmount the drive, just call the <strong>Unmount</strong> method to release the VHD image.</p>
<p><a href="http://simonguest.com/wp-content/uploads/2010/04/image11.png"><img style="display: inline; border-width: 0px;" title="image" src="http://simonguest.com/wp-content/uploads/2010/04/image_thumb11.png" border="0" alt="image" width="427" height="198" /></a> </p>
<p>There are a lot of details behind the scenes that I’m not going to go into here (e.g. read and read/write access to the VHD)  &#8211; if you want to learn more, I would recommend checking out <a href="http://microsoftpdc.com/Sessions/SVC14">this PDC session</a> by Brad Calder</p>
<p><strong>Appendix.  Running this in a local development environment.</strong></p>
<p>You should note that uploading a VHD only works using a live deployment in the cloud.  In the local development fabric, you’ll find that you cannot access a remote VHD (you’ll get a HRESULT = 80070003 error).  Also, you can’t upload a page blob to local development storage.</p>
<p>However, you can still duplicate the same functionality in the local development environment by using this code:</p>
<pre class="brush:c-sharp">
// Setup the account details
CloudStorageAccount storageAccount = CloudStorageAccount.DevelopmentStorageAccount;
// initialize the local cache - need to trim the end backslash otherwise, HRESULT=D0000033
LocalResource localCache = RoleEnvironment.GetLocalResource("LocalCache");
CloudDrive.InitializeCache(localCache.RootPath.TrimEnd('\'), localCache.MaximumSizeInMegabytes);

// Create and mount the drive
CloudDrive c = storageAccount.CreateCloudDrive("vhd/myvhd.vhd");

// try creating the drive if it doesn't exist
try
{
        c.Create(16);
}
        catch (Exception)
{
         // ignore - VHD folder already exists
}

String driveLetter = c.Mount(localCache.MaximumSizeInMegabytes, DriveMountOptions.None);

// do regular System.IO.File and System.IO.Directory operations here against driveLetter
Response.Write(System.IO.Directory.GetFiles(driveLetter + "\").Count() + " files found on the root of the mounted drive.");

// unmount the drive
c.Unmount();
</pre>
<p>There are a couple of differences from the live environment.</p>
<p>Firstly, instead of using the public account details, we can just make a call to <strong>CloudStorageAccount.DevelopmentStorageAccount</strong>. </p>
<p>Secondly, just before we mount the drive we actually try to create it using the <strong>c.Create(16)</strong> command.  If it already exists, then it throws an exception that we just ignore.</p>
<p>It’s important to know that this doesn’t actually create a VHD file. Instead, it creates a new directory in this folder:</p>
<p><strong>c:users[username]AppDataLocaldftmpwadddevstoreaccount1vhd</strong></p>
<p>You can now access this folder through Windows Explorer, go into the .vhd folder and add/remove files as you wish.  Once you are ready to move to a production environment you simply copy the files from this directory in to a new VHD (as created in Step 1), upload, and switch to the production code.</p>
]]></content:encoded>
			<wfw:commentRss>http://simonguest.com/2010/04/22/moving-vhds-to-the-cloud/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

