<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Altocumulus</title>
	<atom:link href="http://yossidahan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://yossidahan.wordpress.com</link>
	<description>My thoughts and experiences of working with customers leveraging the Windows Azure Platform</description>
	<lastBuildDate>Thu, 23 Feb 2012 09:26:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='yossidahan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Altocumulus</title>
		<link>http://yossidahan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://yossidahan.wordpress.com/osd.xml" title="Altocumulus" />
	<atom:link rel='hub' href='http://yossidahan.wordpress.com/?pushpress=hub'/>
		<item>
		<title>More on Locale in Windows Azure</title>
		<link>http://yossidahan.wordpress.com/2012/02/20/more-on-locale-in-windows-azure/</link>
		<comments>http://yossidahan.wordpress.com/2012/02/20/more-on-locale-in-windows-azure/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 13:17:40 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Globalization]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/?p=85</guid>
		<description><![CDATA[A few days ago I published a short post on controlling the locale for Windows Azure Applications, turns out that a significant piece was missing – whilst all that was written was well and true for web applications, the story for WCF services is slightly different - By default web services do not run in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=85&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A few days ago I published a short post on <a href="http://yossidahan.wordpress.com/2012/02/17/locale-on-windows-azure/" target="_blank">controlling the locale for Windows Azure Applications</a>, turns out that a significant piece was missing – whilst all that was written was well and true for web applications, the story for WCF services is slightly different -</p>
<p>By default web services do not run in ASP.net compatibility mode, and without this, many system.web settings in the web.config do not take effect, the MSDN article <a href="http://msdn.microsoft.com/en-us/library/bb332338.aspx" target="_blank">Hosting and Consuming WCF Services</a> contains the following paragraph (bold is mine) &#8211; </p>
<blockquote><h5>ASP.NET Compatibility Model</h5>
<p>When hosting your WCF services in a load-balanced or even a Web-garden environment where subsequent requests in a session can be processed by different hosts or processes in the environment, you need out-of-process persistent storage for your session state. Out-of-the box WCF doesn&#8217;t support persistent storage for session state. Instead, WCF stores all its session state in memory. When your WCF services are hosted in IIS, you can end up with recycling scenarios, as described in the previous section. Instead of building persistent storage for sessions all over again, WCF relies on the ASP.NET implementation for session state. This approach has one serious limitation: you limit your services to HTTP.
<p><strong>ASP.NET session state is not the only feature that is supported by the ASP.NET compatibility mode. It also supports features such as the HttpContext, globalization, and impersonation</strong>, just like you are used to with ASP.NET Web services (ASMX). Refer to MSDN Help for the ASP.NET–specific features to enable out-of-process session state.</p>
</blockquote>
<p>And so – if you wanted to use the &lt;globalization&gt; element to control the locale of WCF service you must ensure your services are running in ASP.net compatibility mode, as shown in the MSDN article, this can be done by adding the following attribute to the service implementation &#8211; </p>
<pre style="width:577px;height:83px;" class="code">[<span style="color:#2b91af;">AspNetCompatibilityRequirements</span>(RequirementsMode = <span style="color:#2b91af;">AspNetCompatibilityRequirementsMode</span>.Required)]
    <span style="color:blue;">public class </span><span style="color:#2b91af;">Service1 </span>: <span style="color:#2b91af;">IService1
</span></pre>
<p>But to allow that you would also need to add the following entry to the web config &#8211; </p>
<pre style="width:621px;height:80px;" class="code">  <span style="color:blue;">&lt;</span><span style="color:#a31515;">system.serviceModel</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">serviceHostingEnvironment </span><span style="color:red;">aspNetCompatibilityEnabled</span><span style="color:blue;">=</span>"<span style="color:blue;">true</span>"<span style="color:blue;">/&gt;

</span></pre>
<p>If you’d rather not run in compatibility mode, an alternative is to set the thread’s UI culture, as shown in my previous post, in the service’s constructor.</p>
<p>Note: for completeness I should add that this applies to WebServiceHost and REST services as much as it does for ServiceHost and SOAP based services, I have tested both.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=85&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2012/02/20/more-on-locale-in-windows-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>
	</item>
		<item>
		<title>End-to-end authentication and authorisation scenario for MVC+ACS</title>
		<link>http://yossidahan.wordpress.com/2012/02/19/end-to-end-authentication-and-authorisation-scenario-for-mvcacs/</link>
		<comments>http://yossidahan.wordpress.com/2012/02/19/end-to-end-authentication-and-authorisation-scenario-for-mvcacs/#comments</comments>
		<pubDate>Sun, 19 Feb 2012 17:31:22 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Access Control Service]]></category>
		<category><![CDATA[ClaimsAuthenticationManager]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Windows Identity Federation]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/?p=83</guid>
		<description><![CDATA[Background Windows Azure’s Access Control Service (ACS) enables developers of web application and services to provide a seamless single-sign-on experience for their users, easily and quickly, building on standard protocols such as OAuth, WS-Federation and SAML. ACS’ built in support for Live, Google, Yahoo and Facebook Identities as well as the easy integration with ADFS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=83&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h4>Background</h4>
<p>Windows Azure’s Access Control Service (ACS) enables developers of web application and services to provide a seamless single-sign-on experience for their users, easily and quickly, building on standard protocols such as OAuth, WS-Federation and SAML.
<p>ACS’ built in support for Live, Google, Yahoo and Facebook Identities as well as the easy integration with ADFS and AD means that authentication with the most used identities is literally done with a few clicks and a little bit of configuration.
<p>For an overview of the ACS service and a useful how-to tutorial see MSDN on &#8211; <a href="http://msdn.microsoft.com/en-us/library/gg429781.aspx">http://msdn.microsoft.com/en-us/library/gg429781.aspx</a>
<p>Using ACS with well-known identity providers, other than custom authentication solutions, as part of the application provides several benefits -
<p>From the users’ perspective it prevents the need to remember a different set of credentials for the application, instead using existing identities to sign-in; this also increases security as users tend to use the same credentials for many applications, not all are good at protecting this information.
<p>From the application’s perspective it removes some of the effort required in building scenarios such as managing credentials – storing them securely, implementing authentication functionality as well as capabilities such as reminding/resetting passwords, etc.
<p>However – whilst integrating an application with an identity provider (or several) provides two (generally trust-worthy) facts – the knowledge that the user has been authenticated by the approved identity provider(s) and a unique identifier for that user &#8211; it does not, on its own, provide a complete end-to-end solution for authentication and authorisation; several pieces are needed on top of the ACS and IP integration beyond uniquely identifying a user, such as managing the user’s profile and implementing role based authorisation.
<p>In this post I will be looking at the steps that are required to provide an end-to-end story for an ASP.net / MVC application using ACS with multiple identity providers to drive authentication and authorisation scenarios, I’ll start by discussing managing users’ profiles -<br />
<h4>Managing Users’ Profiles </h4>
<p>The Identity Providers, through ACS, will provide the application a unique identifier for the user -
<p>The initial request from the user’s browser to the application will come as unauthenticated; at this point, given the right configuration,&nbsp; Windows Identity Foundation will redirect the request to ACS which will, in turn, interact with the identity provider (as needed) before redirecting back to the application, this time with a bunch of claims regarding the details of the identity provider and the user’s identity provided through the <i>IClaimsPrincipal</i> object.
<p>It does not, at this point, give you much information about the user &#8211; some identity providers, such as Google, might provide the user’s first and last name and perhaps an email address, others, such as Live ID, will only provide a unique identifier – nor does it tell you whether the user is allowed to access <b>your application</b>. All you know is that this is <em>user x </em>as declared by identity <em>provider y</em>.
<p>This might be good enough for web sites that do not restrict access, and only need to know a unique id for a user, for example for personalisation purposes or to store data for a particular user, <a href="http://www.stackoverflow.com">http://www.stackoverflow.com</a> is an example for such site.
<p>Most web sites, however, would like to, at the very least, know some basic information about the user, such as full name, perhaps date of birth or email address; some – of course – require a much more elaborate profile.
<p>Some web sites will let anybody in, but will require updating the profile, others are membership only and so – knowing the identity of the user is one half of the story – matching it against a membership database being the other.
<p>To support either of these scenarios, the application will need to have its own store of users’ information, linked to the identity provided through ACS.
<p>As requests arrive from the ACS the application will need to be able to refer to this store to identify whether the user is known or new. Known users will be let in (subject to authorisation, discussed later in this article); unknown users will be, for example, directed to a registration page.
<p><a href="http://yossidahan.files.wordpress.com/2012/02/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2012/02/image_thumb3.png?w=294&#038;h=195" width="294" height="195"></a>
<p>This really isn’t much different from how this would be implemented without the ACS- if identity was provided by ASP.net membership, for example &#8211; the main difference is that when implementing single-sign-on the identity piece and the profile management/authorisation piece are separated.
<p>On Windows Azure, table storage is a great option for storing user’s profile – records could be stored, for example, against the identity provider (as the partition key) and user’s identity (as the row key), and given that this will generally be the only access mechanism required (I’ll be discussing a variation of that – for supporting multiple identities for the same user), it keeps the solution nice and simple.
<p>From a technical point of view – the application needs to first pick up the user’s identity, as provided by ACS, and check that against the user’s store, and it needs to do that before running the application’s code so that the user can be considered when evaluation authorisation.
<p>One way of achieving this is leveraging the Windows Identity Framework pipeline by implementing a custom authorisation manager by inheriting from <i>ClaimsAuthenticationManager</i>&nbsp;
<p>By overriding the <i>Authenticate</i> method you can get access to the identity provided by ACS, interrogate the claims provided with it and even make changes to the claim-set as needed.
<p>The first step in the authenticate method would be to extract the principal as an IClaimsPrincipal – </p>
<p><span style="color:#2b91af;"></span>
<pre style="width:624px;height:32px;" class="code"><span style="color:#2b91af;">IClaimsIdentity </span>identity = (<span style="color:#2b91af;">IClaimsIdentity</span>)incomingPrincipal.Identity;
</pre>
<p>The next step would be to ensure that the user has actually been authenticated as this method will get called twice – once for the initial unauthenticated request, before the redirection to ACS, and once when the user is redirected back to the application from ACS with the authentication token; We’re only interested in the second call and so if the user is not authenticated we do nothing. The module’s default behaviour will take care of redirecting unauthenticated users if this was the WIF configuration. </p>
<pre style="width:628px;height:72px;" class="code"><span style="color:blue;">if</span>(identity.IsAuthenticated)
{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:green;">//code goes here
<font color="#666666">}</font></span></pre>
<p>For authenticated users, we need to extract the claims we’re expecting from the token and ensure they exist &#8211; these are the nameidentifier and identityprovider claims </p>
<pre style="width:666px;height:192px;" class="code">

<span style="color:#2b91af;">Claim </span>id = identity.Claims.FirstOrDefault(claim =&gt; claim.ClaimType ==               <span style="color:#a31515;">"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"</span>);
<span style="color:#2b91af;">Claim </span>provider = identity.Claims.FirstOrDefault(claim =&gt; claim.ClaimType ==  <span style="color:#a31515;">"http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider"</span>);

<span style="color:blue;">if </span>(id == <span style="color:blue;">null </span>|| provider == <span style="color:blue;">null</span>)
   <span style="color:blue;">throw new </span><span style="color:#2b91af;">ApplicationException</span>(                  <span style="color:#a31515;">"Reuqest did not contain the necessary authenticaiton information"</span>);
</pre>
<p>It might be obvious, but to avoid any doubt it is important to note that the user’s identity has to be composed of these two – the identity is unique in the context of the identity provider, theoretically two provides might use the same identity. </p>
<p>So – now that we have the user’s unique identity we can check whether it exist in our users store, this is straight forward coding against Table storage, so there’s no point repeating all the details, I have it encapsulated in two method calls </p>
<pre style="width:662px;height:68px;" class="code"><span style="color:#2b91af;">UserLineDataServiceContext </span>context = <span style="color:#2b91af;">UserLineDataServiceContext</span>.GetContext();
<span style="color:#2b91af;">UserLine </span>user = context.FindUser(provider.Value, id.Value);
</pre>
<p>At this point <i>user</i> either hold the details of the user found or is null if the user has never been registered; if the user has been registered before I populate a bunch of claims specific to my application – </p>
<pre style="width:659px;height:289px;" class="code">

<span style="color:blue;">if </span>(user != <span style="color:blue;">null</span>)
{
    identity.Claims.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">Claim</span>(<span style="color:#2b91af;">ClaimTypes</span>.Role, <span style="color:#a31515;">"RegisteredUser"</span>));
    <span style="color:#2b91af;">Claim </span>nameClaim = identity.Claims.FirstOrDefault(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c =&gt; c.ClaimType == <span style="color:#2b91af;">ClaimTypes</span>.Name);
    <span style="color:blue;">if </span>(nameClaim != <span style="color:blue;">null</span>)
         identity.Claims.Remove(nameClaim);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; identity.Claims.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">Claim</span>(<span style="color:#2b91af;">ClaimTypes</span>.Name, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user.FirstName + <span style="color:#a31515;">" " </span>+ user.LastName));
     identity.Claims.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">Claim</span>(<span style="color:#2b91af;">ClaimTypes</span>.GivenName, user.FirstName));
     identity.Claims.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">Claim</span>(<span style="color:#2b91af;">ClaimTypes</span>.Surname, user.LastName));
}

</pre>
<p>The first claim I populate is a role claim of a ‘RegisteredUser’, I will be using this in my application to ensure that only users with this role can access pages other than the register page as part of my authorisation implementation. </p>
<p>I then populate the name-related claims; this allows me to present the user’s name as given to <b>my </b>application in the sign-out control and other areas of my application. </p>
<p><i>Note: some IPs (such as Google) will provide you with the user’s name, others might not, in either case I allow my user to override the name with the one she wishes to use in my application, and so for registered users I need to override any claims provided by the IP.</i> </p>
<p>At the end of the Authenticate method I call the base method to ensure any standard behaviour of WIF is executed – </p>
<pre style="width:655px;height:47px;" class="code"><span style="color:blue;">return base</span>.Authenticate(resourceName, incomingPrincipal);</pre>
<p>And so – by using a few lines of code in a custom <i>ClaimsAuthenticationManager</i> and utilising Windows Azure Table, we’ve enabled the application to manage it’s users, distinguishing between registered and unregistered users. </p>
<p>The next&nbsp; step would be to implement authorisation and allow unregistered users to become registered &#8211; </p>
<h4>Role Based Authorisation and the registration page</h4>
<p>You would have noticed the custom Claims Authorisation Manager added, for known users, the RegisterUser claim – a claim of type ‘<em>ClaimType.Role</em>’ – by default WIF translates claims of this type to ASP.net roles allowing familiar role based authorisation techniques to be used, in my example I’ve used this to control access to the rest of the application and to direct unknown users to the registration page. </p>
<p>In my case I’ve decided that the application can be accessed by any user, but it requires that users register with it application directly. </p>
<p>To this behaviour, preventing unregistered users access to the majority of the application, I’ve added the authorise attribute, requiring the ‘RegisteredUser’ role for access, on all my controllers other than the default controller -</p>
<pre style="width:646px;height:47px;" class="code">[<span style="color:#2b91af;">Authorize</span>(Roles=<span style="color:#a31515;">"RegisteredUser"</span>)]
</pre>
<p>By doing so, and given that this role will only be available for users that were found in the applications user’s repository, I ensure that unknown users, even if authenticated by the identity provides supported, will not be able to access any part of the application other than the home controller (which does not have this attribute) </p>
<p><i>Note: To bulletproof this approach the ClaimsAuthenticationManager should check that incoming requests do not contain the Role Claim with the text ‘RegisteredUser’</i>&nbsp;
<p>On the home controller I have two actions, Index and About, both are available for any user, the Index action has the following code – </p>
<pre style="width:646px;height:207px;" class="code"><span style="color:blue;">public </span><span style="color:#2b91af;">ActionResult </span>Index()
        {
            <span style="color:blue;">if </span>(!User.IsInRole(<span style="color:#a31515;">"RegisteredUser"</span>))
                <span style="color:blue;">return </span>RedirectToAction(<span style="color:#a31515;">"Register"</span>, <span style="color:#a31515;">"Account"</span>);
            <span style="color:blue;">else
            </span>{
                <span style="color:blue;">return </span>View();
            }
        }</pre>
<p>As you can see – as users land in the default action for the application, if they are not registered they are redirected to the Register action of the Account Controller – an action that is available to any users, this action will display the registration form asking the user for details such as name and date of birth, the post action for this form looks as follows &#8211; </p>
<pre style="width:765px;height:347px;" class="code"><span style="color:#2b91af;">UserLine </span>user = <span style="color:blue;">new </span><span style="color:#2b91af;">UserLine</span>(encodeKey(collection[<span style="color:#a31515;">"IdentityProvider"</span>]), encodeKey(collection[<span style="color:#a31515;">"Identity"</span>]));
            user.FirstName = collection[<span style="color:#a31515;">"FirstName"</span>];
            user.LastName = collection[<span style="color:#a31515;">"LastName"</span>];
            user.EmailAddress = collection[<span style="color:#a31515;">"EmailAddress"</span>];

            <span style="color:#2b91af;">UserLineDataServiceContext </span>context = <span style="color:#2b91af;">UserLineDataServiceContext</span>.GetContext();
            context.AddUser(user);
            <span style="color:#2b91af;">ClaimsIdentity </span>identity = User.Identity <span style="color:blue;">as </span><span style="color:#2b91af;">ClaimsIdentity</span>;

            identity.Claims.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">Claim</span>(<span style="color:#2b91af;">ClaimTypes</span>.Role,<span style="color:#a31515;">"RegisteredUser"</span>));
            <span style="color:green;">//add name claims according to registration information
            </span>identity.Claims.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">Claim</span>(<span style="color:#2b91af;">ClaimTypes</span>.Name, user.FirstName + <span style="color:#a31515;">" " </span>+ user.LastName));
            identity.Claims.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">Claim</span>(<span style="color:#2b91af;">ClaimTypes</span>.GivenName, user.FirstName));
            identity.Claims.Add(<span style="color:blue;">new </span><span style="color:#2b91af;">Claim</span>(<span style="color:#2b91af;">ClaimTypes</span>.Surname, user.LastName));

            <span style="color:blue;">return </span>RedirectToAction(<span style="color:#a31515;">"Index"</span>, <span style="color:#a31515;">"Home"</span>);
</pre>
<p>Admittedly not the most robust code in the world, but good enough as a sample it creates a new UserLine, populating it with the information from the form and adds it to the Table before adding all the necessary claims for this user.</p>
<p>These claims, including the RegistredUser role claim would normally be added by the <em>ClaimsAuthenticationManager</em> but in this case they are now added in this form to allow the user to be treated as a recognised user by the application.</p>
<p>With these set the user can be redirected back to the default action, this time with the correct role which would allow the default view to be returned.</p>
<h4>Supporting Multiple Identities for same user</h4>
<p>Everything that discussed so far assumes the use is only identified using one identity provider and whilst this is a fair assumption for some web sites, most of those who wish to support identity federation want to support more than one provider and to make user’s life as convenient as possible it is important to be able to recognise users using more than one identity provider.</p>
<p>Given that there’s no way for any one IP. or the ACS, to link identities, this is up for the application, or – more accurately- up for the application to allow the user to do so.</p>
<p>I haven’t fully implemented this for my sample, but the approach would be to allow the user, in the registration page, to indicate that she is already known using a different identity and then to be able to provide a token for this identity (through ACS, of course).</p>
<p>The key to this is to expand the user’s repository – every user should be given an ‘internal identity’ – managed by the application and separate table will link any IP-provided identity to the relevant internal identity, any records in the application should always be stored against the internal identity.</p>
<h4>Summary</h4>
<p>I hope that through this post I was able to demonstrate that whilst enabling ACS for an application is only a first step towards achieving a full end-to-end authentication and authorisation solution for an application, the steps required to complete the solutions are quite straight forward and lean, and that’s the whole point in identity federation – to take away the majority of the work needed, whilst leaving a good level of control in the application.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=83&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2012/02/19/end-to-end-authentication-and-authorisation-scenario-for-mvcacs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2012/02/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Locale on Windows Azure</title>
		<link>http://yossidahan.wordpress.com/2012/02/17/locale-on-windows-azure/</link>
		<comments>http://yossidahan.wordpress.com/2012/02/17/locale-on-windows-azure/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 11:51:08 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Globalization]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/?p=78</guid>
		<description><![CDATA[Two of the benefits of using the Windows Azure platform is the ability to deploy applications globally and avoiding the need to manage the hardware as well the O/S; however – like everything else in life – this comes at some ‘price’, and one element is control over the environment. In Windows Azure all instances [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=78&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Two of the benefits of using the Windows Azure platform is the ability to deploy applications globally and avoiding the need to manage the hardware as well the O/S; however – like everything else in life – this comes at some ‘price’, and one element is control over the environment.</p>
<p>In Windows Azure all instances are created with the en-US locale by default and if your application is deployed outside the US, and you’re not handling this properly, this may cause some confusion.</p>
<p><a href="http://yossidahan.files.wordpress.com/2012/02/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://yossidahan.files.wordpress.com/2012/02/image_thumb.png?w=321&#038;h=368" alt="image" width="321" height="368" border="0" /></a></p>
<p>To demonstrate this I’ve create a simple application using the ASP.net template and added a textbox, a button and  a label</p>
<p>In the Page_Load I’ve updated the label with DateTime.Now.ToString() and when I run my application on my UK laptop I get the expected result -</p>
<p><a href="http://yossidahan.files.wordpress.com/2012/02/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://yossidahan.files.wordpress.com/2012/02/image_thumb1.png?w=299&#038;h=153" alt="image" width="299" height="153" border="0" /></a></p>
<p>However, deploying and testing this on Windows Azure the result is different – the date shown is in US format (MM/dd/yyyy) rather then the UK format (dd/MM/yyyy) -</p>
<p><a href="http://yossidahan.files.wordpress.com/2012/02/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://yossidahan.files.wordpress.com/2012/02/image_thumb2.png?w=301&#038;h=122" alt="image" width="301" height="122" border="0" /></a></p>
<p>The same issue exists when trying to parse a date – entering the date 30/1/2012 into the textbox and clicking on the button which includes the logic &#8211; <em></em></p>
<pre class="code">Label2.Text = <span style="color:#2b91af;">DateTime</span>.Now.ToString(<span style="color:#a31515;">"MM/dd/yyyy"</span>);</pre>
<p>result with the correct date displayed in the label when running locally, but an exception when running in Azure (as there’s no month 30, of course)</p>
<p>So – what can one do?</p>
<p>Well – theoretically one can change the locale on the machine, either by using remote desktop (hardly a scalable and reliable approach) or, better yet, by employing a startup task to do this, but this has the potential of confusing the fabric controller and generally speaking – one should not meddle with the O/S unnecessarily.</p>
<p>So – this should be handled at the application level rather than the system level, what’s are the options?</p>
<p>Well – in my simple scenario I could have simply provided the required format in my code – if I had my Page_Load logic as DateTime.Now.ToString(“dd/MM/yyyy”)  I would have avoided the different behaviour between environments, similarly I could have provided the format when parsing the date</p>
<pre class="code"><span style="color:#2b91af;">IFormatProvider </span>cultureInfo = <span style="color:blue;">new </span><span style="color:#2b91af;">CultureInfo</span>(<span style="color:#a31515;">"en-GB"</span>,<span style="color:blue;">false</span>);
Label2.Text = <span style="color:#2b91af;">DateTime</span>.Parse(TextBox2.Text,cultureInfo).ToString();</pre>
<p>But this could be quite cumbersome for a real application.</p>
<p>Another option is to set the Culture on the thread of the application -</p>
<pre class="code"><span style="color:#2b91af;">Thread</span>.CurrentThread.CurrentCulture = <span style="color:blue;">new </span><span style="color:#2b91af;">CultureInfo</span>(<span style="color:#a31515;">"en-GB"</span>);</pre>
<p>but I would need to do this on every page load, so that might be a bit cumbersome as well (but that’s a good option when you need to set the culture based on the user request, for example)</p>
<p>For a blanket rule option, seems like the web config is the best option – simply add</p>
<pre class="code">   <span style="color:blue;">&lt;</span><span style="color:#a31515;">globalization </span><span style="color:red;">culture</span><span style="color:blue;">=</span>"<span style="color:blue;">en-GB</span>"
       <span style="color:red;">uiCulture</span><span style="color:blue;">=</span>"<span style="color:blue;">en-GB</span>"
    <span style="color:blue;">/&gt; </span></pre>
<p>to the system.web section of the web config and this culture will be applied to all requests.</p>
<p>A good summary of the options can be found <a href="http://support.microsoft.com/kb/306162" target="_blank">here</a></p>
<p>Note: turns out there&#8217;s a bit more to the story, read <a href="http://yossidahan.wordpress.com/2012/02/20/more-on-locale-in-windows-azure/">my follow up post</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=78&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2012/02/17/locale-on-windows-azure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2012/02/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2012/02/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2012/02/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Manipulating data in Windows Azure Table using PowerPivot</title>
		<link>http://yossidahan.wordpress.com/2012/01/17/manipulating-data-in-windows-azure-table-using-powerpivot/</link>
		<comments>http://yossidahan.wordpress.com/2012/01/17/manipulating-data-in-windows-azure-table-using-powerpivot/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 15:08:16 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PowerPivot]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[WCF Data Service]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/?p=70</guid>
		<description><![CDATA[A customer asked yesterday a very good question – is it possible to use PowerPivot analyse data stored in Windows Azure Table Storage. Given that Table Storage is exposed through oData, which is, as you’d expect, a data source fully supported by PowerPivot, my gut feeling was that this should not be a problem and, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=70&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A customer asked yesterday a very good question – is it possible to use <a href="http://www.microsoft.com/en-us/bi/powerPivot.aspx" target="_blank">PowerPivot</a> analyse data stored in Windows Azure Table Storage. </p>
<p>Given that Table Storage is exposed through oData, which is, as you’d expect, a data source fully supported by PowerPivot, my gut feeling was that this should not be a problem and, in fact, a very interesting scenario – many customers use Windows Azure Storage to store vast quantities of data, given how cost-effective it is and the scale that is possible, but ultimately data is there to be used, and PowerPivot is an amazing tool to process data – the two together make a powerful pair.</p>
<p>Looking at it closer, though, I stumbled into a small hurdle – whilst PowerPivot had support for working with data from Azure DataMarket out of the box for <a href="https://denglishbi.wordpress.com/2010/11/19/new-powerpivot-azure-datamarket-experience/" target="_blank">some time now</a> and it supports working with oData feeds, I don’t believe it supports, currently, working with Azure Table Storage directly, the stumbling block being the ShareKey authentication mechanism.</p>
<p>However, this is too useful to give up, so I looked at a workaround, and the most obvious one was to take the man-in-the-middle approach and to publish a WCF Data Service onto an Azure Web Role (doesn’t have to be, of course, but makes perfect sense), which would expose a ‘standard’ oData feed to be consumed by PowerPivot and would get the data from the Table Storage. simples.</p>
<p>To do that I needed some data in Azure Tables and so I decided to use <a href="http://www.cerebrata.com/Products/CloudStorageStudio/" target="_blank">Cerebrata’s Cloud Storage Studio</a> to upload the pubs database to Window Azure Storage – quite a cool and useful feature of their product if you ask me!<br />(Right click on the ‘Table&#8217;s’ node, choose ‘Upload Relational Database’ and follow the steps in the short wizard)</p>
<p>I decided to publish data from the roysched table, only because it had the most rows in it; to do that I create a class that represented a roysched entity -</p>
<pre class="code">[<span style="color:#2b91af;">DataServiceKey</span>(<span style="color:#a31515;">"RowKey"</span>, <span style="color:#a31515;">"PartitionKey"</span>)]
    <span style="color:blue;">public class </span><span style="color:#2b91af;">roysched
    </span>{
        <span style="color:blue;">public string </span>PartitionKey {<span style="color:blue;">get</span>;<span style="color:blue;">set</span>;}
        <span style="color:blue;">public string </span>RowKey {<span style="color:blue;">get</span>;<span style="color:blue;">set</span>;}
        <span style="color:blue;">public </span><span style="color:#2b91af;">DateTime </span>Timestamp {<span style="color:blue;">get</span>;<span style="color:blue;">set</span>;}
        <span style="color:blue;">public string </span>title_ID {<span style="color:blue;">get</span>;<span style="color:blue;">set</span>;}
        <span style="color:blue;">public int </span>lorange {<span style="color:blue;">get</span>;<span style="color:blue;">set</span>;}
        <span style="color:blue;">public int </span>hirange {<span style="color:blue;">get</span>;<span style="color:blue;">set</span>;}
        <span style="color:blue;">public int </span>royalty {<span style="color:blue;">get</span>;<span style="color:blue;">set</span>;}

                <span style="color:blue;">public </span>roysched()
        {
        }

        <span style="color:blue;">public </span>roysched(<span style="color:blue;">string </span>partitionKey, <span style="color:blue;">string </span>rowKey, <span style="color:#2b91af;">DateTime </span>timestamp, <span style="color:blue;">string </span>titleId, <span style="color:blue;">int </span>lorange, <span style="color:blue;">int </span>hirange, <span style="color:blue;">int </span>royalty)
        {
            PartitionKey = partitionKey;
            RowKey = rowKey;
            Timestamp = timestamp;
            title_ID = titleId;
            <span style="color:blue;">this</span>.lorange = lorange;
            <span style="color:blue;">this</span>.hirange = hirange;
            <span style="color:blue;">this</span>.royalty = royalty;
        }
    }
</pre>
<p>You will notice the DataServiceKey attribute I’ve added – this is needed for the Entity Framework to figure out which fields (or combination of keys, as is the case here) can be used as the identity of the entity as I’ve blogged <a href="http://yossidahan.wordpress.com/2012/01/17/error-in-wcf-data-service/" target="_blank">here</a></p>
<p>With that done I needed to create a context class to be used by the WCF Data Service, this class will read data from Azure and ‘re-publish’ data as the feed behind the data, this is where the majority of the logic would generally go, but as you can expect I’ve kept this to the minimum for the purpose of this demonstration. </p>
<pre class="code"><span style="color:blue;">public class </span><span style="color:#2b91af;">PubsContext
    </span>{
        <span style="color:blue;">public </span><span style="color:#2b91af;">IQueryable</span>&lt;<span style="color:#2b91af;">roysched</span>&gt; list
        {
            <span style="color:blue;">get
            </span>{
                <span style="color:blue;">var </span>account = <span style="color:#2b91af;">CloudStorageAccount</span>.FromConfigurationSetting(<span style="color:#a31515;">"DataConnectionString"</span>);
                <span style="color:blue;">var </span>context = <span style="color:blue;">new </span><span style="color:#2b91af;">AzurePubsContext</span>(account.TableEndpoint.ToString(), account.Credentials);
                <span style="color:blue;">return </span>context.AzureList;
            }
        }
    }
</pre>
<p>One thing to note is that whilst technically I could expose the TableServiceContext I’ve used to access Windows Azure Storage directly, I did not do that, following from the guidance that can be found <a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh689718(v=VS.103).aspx#republishing" target="_blank">here</a></p>
<p>Also bear in mind, as these samples often go, this is by no means the best or most efficient way of doing things, but I did want to keep things as simple as possible to focus on the concept rather than lines of code – in a real, production, code I would almost certainly not want to create the Azure TableServiceContext on every call!</p>
<p>The last ‘big’ piece in the puzzle is creating the data service itself – adding a WCF Data Service item to the project adds a handy template in which only the context class and list property are needed to be updated (highlighted in the code below)</p>
<pre class="code"><span style="color:blue;">public class </span><span style="color:#2b91af;">SomeDataService </span>: <span style="color:#2b91af;">DataService</span>&lt;<span style="color:#2b91af;"><strong><font size="3">PubsContext</font></strong></span>&gt;
{
    <span style="color:blue;">public static void </span>InitializeService(<span style="color:#2b91af;">DataServiceConfiguration </span>config)
    {
        config.SetEntitySetAccessRule(<span style="color:#a31515;">"<font size="3"><strong>list</strong></font>"</span>, <span style="color:#2b91af;">EntitySetRights</span>.AllRead);
        config.DataServiceBehavior.MaxProtocolVersion = <span style="color:#2b91af;">DataServiceProtocolVersion</span>.V2;
    }
}
</pre>
<p>To get everything working I needed to do a couple more small changes &#8211; </p>
<p>I needed to define the <em>DataConnectionString </em>configuration setting in the csdef file and add the connection string value pointing at my Azure Storage (or the local emulator), this is easily done through the Visual Studio UI.</p>
<p>Last – I needed to put the code to initialise set the configuration setting publisher in the Global.asax’ Application_Start handler, this is pretty standard for any project deployed on Azure &#8211; </p>
<pre class="code"><span style="color:green;">// This code sets up a handler to update CloudStorageAccount instances when their corresponding
            // configuration settings change in the service configuration file.
            </span><span style="color:#2b91af;">CloudStorageAccount</span>.SetConfigurationSettingPublisher((configName, configSetter) =&gt;
            {
                <span style="color:green;">// Provide the configSetter with the initial value
                </span>configSetter(<span style="color:#2b91af;">RoleEnvironment</span>.GetConfigurationSettingValue(configName));
            });
</pre>
<p>…and voila – calling this service exposed the information from Windows Azure as a basic oData feed, easily consumable from PowerPivot&nbsp; &#8211; </p>
<p><a href="http://yossidahan.files.wordpress.com/2012/01/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2012/01/image_thumb.png?w=390&#038;h=289" width="390" height="289"></a></p>
<p>One last thing to bear in mind, of course, is that I kept my service completely open for anonymous access, which you’d probably not want to do in real life, but as this is now a standard WCF Data Service than the normal configuration applies, and PowerPivot will support both SSPI and basic authentication)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=70&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2012/01/17/manipulating-data-in-windows-azure-table-using-powerpivot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2012/01/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Error in WCF Data Service</title>
		<link>http://yossidahan.wordpress.com/2012/01/17/error-in-wcf-data-service/</link>
		<comments>http://yossidahan.wordpress.com/2012/01/17/error-in-wcf-data-service/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 11:04:01 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Entity Framework]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/?p=66</guid>
		<description><![CDATA[I’ve been working on a small demo for a customer involving a WCF Data Service (blog post to come, hopefully) when my newly developed, and very simple, service insisted on returning &#8211; “The server encountered an error processing the request. See server logs for more details.&#8221; This happened before any of my code executed directly, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=66&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’ve been working on a small demo for a customer involving a WCF Data Service (blog post to come, hopefully) when my newly developed, and very simple, service insisted on returning &#8211; <em>“The server encountered an error processing the request. See server logs for more details.&#8221;</em></p>
<p>This happened before any of my code executed directly, which buffeled me for a short bit, but then adding the [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] attribute to the data service class revealed a little bit more detail &#8211; </p>
<p><em>The server encountered an error processing the request. The exception message is &#8216;On data context type &#8216;AzurePubsContext&#8217;, there is a top IQueryable property &#8216;list&#8217; whose element type is not an entity type. Make sure that the IQueryable property is of entity type or specify the IgnoreProperties attribute on the data context type to ignore this property.&#8217;</em></p>
<p>My AzurePubsContext class did not have any public properties that do not return IQueryable, so this was not pointing directly at the problem, but it was clear that I have an issue with the entity I was using.</p>
<p>I was trying to represent pub’s roysched table, migrated to Azure Table Storage and I suspect my problem was that there was no obvious key the Entity Framework could use.</p>
<p>Specifying the [DataServiceKey(“PartitionKey”,"RowKey")] attribute on my entity class sorted this quickly enough. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=66&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2012/01/17/error-in-wcf-data-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>
	</item>
		<item>
		<title>An SLA Detente?</title>
		<link>http://yossidahan.wordpress.com/2012/01/05/an-sla-detente/</link>
		<comments>http://yossidahan.wordpress.com/2012/01/05/an-sla-detente/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 09:31:11 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[High Availability]]></category>
		<category><![CDATA[SLAs]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/?p=63</guid>
		<description><![CDATA[The latest ‘cloud computing’ newsletter pointed at Alistair Croll’s Top 12 Cloud Trends Of 2012 which makes an interesting read; particularly interesting, I found, was his ‘Trend No 8: An SLA Detente’ (I had to look Datente up, turns out it means relaxation…). In his article Alistair suggests, and I paraphrase, that customers’ expectations from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=63&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The latest ‘cloud computing’ newsletter pointed at Alistair Croll’s <a href="http://www.informationweek.com/news/cloud-computing/infrastructure/232301203?cid=nl_IW_cloud_2012-01-04_html&amp;elq=483bf9355b7146299c24a310c482b1f7"><strong>Top 12 Cloud Trends Of 2012</strong> </a>which makes an interesting read; particularly interesting, I found, was his ‘<strong>Trend No 8: An SLA Detente</strong>’ (I had to <a href="http://en.wikipedia.org/wiki/D%C3%A9tente" target="_blank">look Datente up</a>, turns out it means relaxation…).</p>
<p>In his article Alistair suggests, and I paraphrase, that customers’ expectations from the SLAs provided by cloud vendors are unrealistic and he suggest the point that Car makers don’t provide insurance as part of the deal to purchase the car, but rather customers buy insurances they deem necessary separately.</p>
<p>This had got me thinking – the man does have a point. to a point.</p>
<p>I would suggest that analogy stretches further, and actually taking about the warranty is a better viewpoint – Consider you’re a logistics business in need of a fleet – you would make your research and settle on a car from a maker with a good track record of reliability and service.</p>
<p>You might pay premium for these, but you asses the risk and suggest that buying a truck from a reliable manufacturer is worth more than buying one from a less robust maker; I don’t think anybody believes it is possible to buy a truck which ‘5 nines availability, and even businesses that relay on these accept a certain amount of ‘down time’; of course we expect a good maker to have a good service network, that will see our truck fixed in the shortest amount of time possible (and at the first attempt), and we would almost certainly expect a courtesy car/van/truck whilst ours is in the garage, but if it takes half a day to sort this out, in the main, we accept the fact.</p>
<p>Now – I don’t suggest that cloud platform are equivalent to cars and certainly when thinking of the Windows Azure platform I would think closer to the space shuttle – with tons of redundancy and a lot of ‘big brains’ behind it, and so – the chances for failures are indeed much smaller than those of a car or a truck, and recovery is much faster, and certainly at large IT operations in general we tend to aim for the mythical 100% availability and try to hit that 5 nines promise, largely because we believe we can, but I do think I agree with Alistair that organisations increasingly feel more than comfortable with the SLAs on offer, accepting the cost/benefit analysis behind it and – more importantly – accepting that in most cases they could not have achieved better or even similar in most cases!)</p>
<p>I also agree, and would like to emphasise Alistair’s last point on this topic which is that cloud vendors, and certainly the Windows Azure platform, provide a lot of capabilities that allow solutions respond to any issues that emerge and so building high availability solutions is actually much easier on Windows Azure than it is on-premises, or – as he had put it ”In 2012, we&#8217;ll realize that the providers have been trying to tell us something: You can have any SLA you want, as long as you code it yourself and find a way to turn risk into economic value.”</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=63&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2012/01/05/an-sla-detente/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>
	</item>
		<item>
		<title>Storing user&#8217;s data</title>
		<link>http://yossidahan.wordpress.com/2011/12/11/storing-users-data/</link>
		<comments>http://yossidahan.wordpress.com/2011/12/11/storing-users-data/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 08:03:13 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Access Control Service]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/?p=59</guid>
		<description><![CDATA[In my post ‘Of Claims and Public Identities’ I have pointed out that web sites that use the ACS usually augment the information provided by the IP (typically a meaningless token) with user inputted personal information which would be stored by the application against the IP’s token. As part of a demo I’ve been working [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=59&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my post ‘<a href="http://yossidahan.wordpress.com/2011/10/21/of-claims-and-public-identities/" target="_blank">Of Claims and Public Identities</a>’ I have pointed out that web sites that use the ACS usually augment the information provided by the IP (typically a meaningless token) with user inputted personal information which would be stored by the application against the IP’s token.</p>
<p>As part of a demo I’ve been working on I’ve decided to implement this approach and, initially at least, everything seems to work fine (using my Live ID)</p>
<p>Below is the initial code I’ve written (it’s not pretty, but it does the job <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://yossidahan.files.wordpress.com/2011/12/wlemoticon-smile.png?w=630"> ) &#8211; </p>
<p>First I check that the user has indeed been authenticated (if not, it has not been through the ACS, which should never have happened), next I extract the claims I expect – name identifier and identity provider &#8211; before performing a lookup in an Azure table to see if a user with this token (from this particular provider) already exists. </p>
<p>If I find the user in my table I redirect the request to the home page, if I don’t I redirect to the registration page which would ask the user for more details, add it to the table and then re-run the code below to verify.</p>
<pre style="width:631px;height:797px;" class="code">    <span style="color:green;">//Check that user is authenticated
    </span><span style="color:blue;">if </span>(!User.Identity.IsAuthenticated)
    {
        <span style="color:blue;">throw new </span><span style="color:#2b91af;">ApplicationException</span>(<span style="color:#a31515;">"User is not authenticated"</span>);
    }

    <span style="color:green;">//get user identity
    </span><span style="color:#2b91af;">ClaimsIdentity </span>ci = User.Identity <span style="color:blue;">as </span><span style="color:#2b91af;">ClaimsIdentity</span>;
    <span style="color:blue;">if </span>(ci == <span style="color:blue;">null</span>)
        <span style="color:blue;">throw new </span><span style="color:#2b91af;">ApplicationException</span>(<span style="color:#a31515;">"Identity is not ClaimsIdentity"</span>);

    <span style="color:green;">//read claims from security token token
    </span><span style="color:#2b91af;">Claim </span>id = ci.Claims.FirstOrDefault(claim =&gt; claim.ClaimType == <span style="color:#a31515;">"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"</span>);
    <span style="color:#2b91af;">Claim </span>provider = ci.Claims.FirstOrDefault(claim =&gt; claim.ClaimType == <span style="color:#a31515;">"http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider"</span>);

    <span style="color:blue;">if </span>(id == <span style="color:blue;">null </span>|| provider == <span style="color:blue;">null</span>)
        <span style="color:blue;">throw new </span><span style="color:#2b91af;">ApplicationException</span>(<span style="color:#a31515;">"Security token did not contain expected information"</span>);

    <span style="color:green;">//check user identity against user store
    </span><span style="color:#2b91af;">UserLineDataServiceContext </span>context = getUserContext();
    context.IgnoreResourceNotFoundException = <span style="color:blue;">true</span>;

    <span style="color:blue;">var </span>result = <span style="color:blue;">from </span><span style="color:#2b91af;">UserLine </span>u <span style="color:blue;">in </span>context.Users <span style="color:blue;">where </span>(u.RowKey == id.Value) &amp;&amp; (u.PartitionKey == provider.Value) <span style="color:blue;">select </span>u;
    <span style="color:#2b91af;">UserLine </span>user = <span style="color:blue;">null</span>;
    <span style="color:green;">//TODO: lookup user - this causes exception for some reason
    </span>user = result.FirstOrDefault();

    <span style="color:green;">//if user is known return view
    </span><span style="color:blue;">if </span>(user != <span style="color:blue;">null</span>)
        <span style="color:blue;">return </span>Redirect(<span style="color:#a31515;">"/Home/Index"</span>);
    <span style="color:blue;">else
    </span>{
        <span style="color:green;">//if user is not known return register view.
        </span><span style="color:#2b91af;">UserLineModel </span>userModel = <span style="color:blue;">new </span><span style="color:#2b91af;">UserLineModel</span>(provider.Value, id.Value);
        <span style="color:green;">//TODO: should move HOme Controller's Register to the account controller?
        </span><span style="color:blue;">return </span>View(<span style="color:#a31515;">"Register"</span>, userModel);
    }
}
</pre>
<p>When I ran this with my Google id, however, I got a DataServiceQueryException on the result.FirstOrDefault() call, which took me a while to figure out.</p>
<p>The inner exception’s message was an xml describing an Invalid Input error with the message – “One of the request inputs is not valid”</p>
<p>Turns out that the Google identity is represented as a Uri (absolutely nothing wrong with that, of course), but that key fields in Azure tables do not allow certain characters, see <a href="http://msdn.microsoft.com/en-us/library/dd179338%28v=MSDN.10%29.aspx" target="_blank">this</a> for more details.</p>
<p>The solution was to base-64-encode both partition and row key fields before performing the lookup, as well as, naturally, before storing them in the registration controller executing after the user had filled in the registration form and hit ok.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=59&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2011/12/11/storing-users-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2011/12/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Azure HPC Job Scheduler</title>
		<link>http://yossidahan.wordpress.com/2011/11/16/windows-azure-hpc-job-scheduler/</link>
		<comments>http://yossidahan.wordpress.com/2011/11/16/windows-azure-hpc-job-scheduler/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 14:28:15 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[HPC]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/2011/11/16/windows-azure-hpc-job-scheduler/</guid>
		<description><![CDATA[HPC Server 2008 R2 SP1 added the ability to burst into Azure. David Chappell wrote a good white paper on the combination of Windows HPC Server and Windows Azure. Now, with the introduction of SP3, we have announced the ability to run the scheduler directly on Azure, with no need for on-premise software. To learn [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=55&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://technet.microsoft.com/en-us/library/gg481760(WS.10).aspx" target="_blank">HPC Server 2008 R2 SP1</a> added the ability to <a href="http://blogs.technet.com/b/windowshpc/archive/2011/01/16/run-batch-workload-on-a-mixed-infrastructure-windows-azure-worker-nodes-amp-on-premise-hpc-server-2008-r2-compute-nodes.aspx" target="_blank">burst into Azure</a>. David Chappell wrote a good <a href="http://www.microsoft.com/windowsazure/Whitepapers/HPCServerAndAzure/" target="_blank">white paper</a> on the combination of Windows HPC Server and Windows Azure.</p>
<p>Now, with the introduction of SP3, we have announced the ability <a href="http://blogs.technet.com/b/windowshpc/archive/2011/11/11/hpc-pack-2008-r2-sp3-and-windows-azure-hpc-scheduler-released.aspx" target="_blank">to run the scheduler directly on Azure</a>, with no need for on-premise software.</p>
<p>To learn more take a look at <a href="http://msdn.microsoft.com/en-us/library/hh560245(v=VS.85).aspx" target="_blank">Getting Started with Application Deployment with the Windows Azure HPC Scheduler</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=55&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2011/11/16/windows-azure-hpc-job-scheduler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;I have a cloud&#8221;</title>
		<link>http://yossidahan.wordpress.com/2011/11/13/i-have-a-cloud/</link>
		<comments>http://yossidahan.wordpress.com/2011/11/13/i-have-a-cloud/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 19:04:02 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Private Cloud]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/2011/11/13/i-have-a-cloud/</guid>
		<description><![CDATA[In all the initial conversations that I’m having with customers about the Windows Azure Platform I go over what I believe cloud computing to be, which often includes this definition from the National Institute of Standards and Technology (NST) (bolds are mine) Cloud computing is a model for enabling convenient, on-demand network access to a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=54&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In all the initial conversations that I’m having with customers about the Windows Azure Platform I go over what I believe cloud computing to be, which often includes this definition from the National Institute of Standards and Technology (NST) <em><font size="1">(bolds are mine)</font></em></p>
<blockquote><p>Cloud computing is a model for enabling convenient, <strong>on-demand</strong> network access to a <strong>shared pool </strong>of configurable computing resources that can be <strong>rapidly provisioned </strong>and released with <strong>minimal management </strong>effort or service provider interaction.</p>
</blockquote>
<p>I also often use a metaphor for cloud computing I heard not long ago and really liked – which is one of a water tap &#8211; </p>
<ul>
<li>When you approach a tap, you expect to be able to open and close it yourself – this is the principle of <strong>self-provisioning</strong>
<li>You expect that the more you open it – the more water you are going to get –&nbsp; in other words &#8211; <strong>immediate scalability</strong>
<li>You expect to only pay for the water you use, with 0 cost when the tap is fully closed- <strong>metering and chargeback</strong>
<li>and you also expect that the utility company will share the water in the most efficient way possible, so that you get the water in the lowest cost possible – <strong>resource pooling</strong></li>
</ul>
<p>I think this metaphor is very useful when discussing what one should expect from a cloud platform, and helps distinguishing traditional virtual hosting farms from cloud platforms.</p>
<p>This is important because in many of the conversations I’m having, somebody will, at some point, suggest that this particular company already has a cloud platform delivered through virtualisation, 3rd party hosting etc., but practically every time, when we explore this point a bit more in conversation, and dig a bit deeper into the capabilities of the Windows Azure platform versus those currently available to the company, significant differences emerge, often enough to suggest that public cloud can add a lot of value.</p>
<p>Private cloud, in its current form, isn’t an overhead-free solution – whilst its true that very large organisations can spread overhead costs of purchasing and maintaining server farms across many business units, and that those who can make some large technological investments can achieve a reasonable high level of automation – overheads still do exist, and, for most, organisations, these appear as significant upfront costs in purchasing (i.e. CAPEX) as well as substantial costs in running (i.e OPEX) servers and software,</p>
<p>Public cloud offering at the scale of Microsoft’s spreads this overhead over many customers, and removes any upfront investment aspect, the cost is strictly on a pay-for-what-you-use basis at a well know rate, there’s not cost to not using resources. </p>
<p>Further more – the scale of the Microsoft investment in the technology in those data centres, driven by the scale of the adoption, means that the level of automation achieved in our data centres is incredibly high (no human interaction required to provision services or to update them, or even to overcome issues in any running service)</p>
<p>This high level of automation helps keeping the cost of the services offered low, certainly lower than most, if not all, private cloud solutions , but it also allows us to provide some capabilities that are unique to the platform, and this is where the majority of value of the platform lies, consider a couple of examples &#8211; </p>
<p>When you’re handing your application to the Windows Azure Fabric to be deployed, the fabric makes a decision where to deploy your application to. several factors come into play in this decision, one of which is the concept of failure domains: </p>
<p>Assuming you’ve asked the controller to deploy your application to at least 2 instances, it ensures that the deployment is such that these instances will not have any single point of failure – they will be deployed on separate hosts, on separate racks, with separate network switches and power supply. short of the data centre blowing up, you are pretty much guaranteed that at least one of your instances will remain alive. this is much more than most organisations have the ability to do.</p>
<p>But it doesn’t stop there – the controller also constantly monitors the state of the instances it ‘owns’ and if indeed one fails, it would immediately start deploying it elsewhere. the net result of which is that in minutes after any failure, your application will resume the same level of resiliency as it had initially, and all of this is done with no human intervention.</p>
<p>These are just a couple of examples of the sort of things that we can do on our platform that private cloud initiative can’t easily achieve today. this is at the heart of the strong proposition that is public cloud.</p>
<p>And so – whilst it is true that many organisations have built strong virtualisation platform that provide many cloud-like capabilities, I don’t think that they are quite comparable to the capabilities of Windows Azure – being able to self-provision is great, but being able to do so and in the process consider aspects such as failure domains and performance characteristics is better. private clouds can offer dynamic scaling, but are more sensitive to capacity planning than a massive scale public cloud offering. virtualisation helps increase utilisation, but hosting many many customers across geographies and industries, and cleverly analysing multi-tenancy patterns means that utilisation is greater still.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=54&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2011/11/13/i-have-a-cloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>
	</item>
		<item>
		<title>On SQL Azure Reporting</title>
		<link>http://yossidahan.wordpress.com/2011/10/26/on-sql-azure-reporting/</link>
		<comments>http://yossidahan.wordpress.com/2011/10/26/on-sql-azure-reporting/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 07:50:19 +0000</pubDate>
		<dc:creator>Yossi Dahan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Access Control Service]]></category>
		<category><![CDATA[SQL Azure]]></category>
		<category><![CDATA[SQL Azure Reporting]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">https://yossidahan.wordpress.com/2011/10/26/on-sql-azure-reporting/</guid>
		<description><![CDATA[I’ve been preparing a demonstration for a customer about SQL Azure Reporting so I’ve been playing around a little bit and I thought I’d share, at high level, what I’ve done (nothing fancy, I’m afraid, but if you’ve never looked at it, this should give you an idea of what’s involved) To beginning was to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=52&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><sub></sub><sub></sub>I’ve been preparing a demonstration for a customer about SQL Azure Reporting so I’ve been playing around a little bit and I thought I’d share, at high level, what I’ve done (nothing fancy, I’m afraid, but if you’ve never looked at it, this should give you an idea of what’s involved)</p>
<p>To beginning was to get a data source to work on, and at the moment, that means SQL Azure database(s), which &#8211; of course – makes perfect sense, and so I promptly created a SQL Azure Database server, and, using the <a href="http://sqlazuremw.codeplex.com/" target="_blank">SQL Azure Migration Wizard</a>, I’ve migrated good old Northwind onto it. </p>
<p><a href="http://yossidahan.files.wordpress.com/2011/10/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:5px 0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2011/10/image_thumb.png?w=410&#038;h=106" width="410" height="106"></a>&nbsp;</p>
<p>Now that I have a data source with some familiar data, it was time to create a report.<br />Given that I’m by no means a reporting expert and that this isn’t really the point of the demonstration, I did not try to get too creative and created a simple report of customers by country </p>
<p>I started by opening Visual Studio 2008 and creating a new project of type ‘Report Server Project Wizard’</p>
<p>The first step in the wizard was to define a data source, and it’s great that SQL Azure is an entry in the list of possible types; all that’s needed is to provide the connection string and the UI helps make that easy too</p>
<p><a href="http://yossidahan.files.wordpress.com/2011/10/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:5px 0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2011/10/image_thumb1.png?w=238&#038;h=291" width="238" height="291"></a></p>
<p>It was simply a case of typing in my database server name and credentials and provide the database name. The only other thing I needed to do is set the TrustServercertificate to True under the properties accessed through the Advanced button.</p>
<p>I then used the Query Builder to select the entire Customers Table and carried on with the Wizard specifying Tabular Format, Group By Country and the details fields (you can see I’ve been very creative)</p>
<p>Then, at the last page of the wizard, it was time to specify the deployment location I replaced the default value of <a title="http://localhost/ReportServer" href="http://localhost/ReportServer">http://localhost/ReportServer</a> with the address of my Azure-based SQL Reporting ‘Server’, which I copied from the management portal</p>
<p><a href="http://yossidahan.files.wordpress.com/2011/10/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:5px 0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2011/10/image_thumb2.png?w=389&#038;h=124" width="389" height="124"></a></p>
<p>This, of course, is not necessary at this stage, it is perfectly fine to start working against a local reporting server and deploying the report later either through the management portal or by changing the server property in the report project’s properties and deploying from Visual Studio.</p>
<p>With the wizard complete I could now run my report from Visual Studio and see the results and the only thing I noticed is that I had to provide the credentials to the data source every time I ran the report.</p>
<p><font></font>This might be desirable in some cases, but I wanted a more streamlined experience, and so I set the credentials to the database in the data source. the report file itself will be protected through the management portal and the login to that, so these don’t get compromised.<font></font></p>
<p><font></font>With the data source credentials sorted I now deploy the project straight from visual studio and after minute or so it is visible in the management console. Clicking on the report renders it successfully -</p>
<p><a href="http://yossidahan.files.wordpress.com/2011/10/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:5px 0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2011/10/image_thumb3.png?w=396&#038;h=293" width="396" height="293"></a></p>
<p>So – at this point the report is fully operatoinal, and can be accessed via a publicly available url. access is governed by username/password pairs setup through the admin console and permissions set on the report itself (or a folder0, and that’s probably good enough for many scenarios for departmental reports inside the organisation.</p>
<p>For more public reports, ones available for external parties for example, I think that re-hosting the report in a web role and leveraging the <a href="http://www.microsoft.com/windowsazure/features/accesscontrol/" target="_blank">ACS</a> for access control would be a lot more flexible and manageable, and so I moved on to do this as well &#8211; </p>
<p>Embedding the report simply meant, in my little example anyway, using the ReportViewer control on an ASP.net page; I’ve configured the ServerReport property of the viewer with the relevant Uri’s and made sure to set the control ProcessingMode property to ‘Remote”.</p>
<p>I then used code to assign the fixed credentials to reporting services. once again – my application is going to be protected by ACS and this code is server side code, so I am comfortable with embedding these in the code (should be configuration, of course…)</p>
<p>At this point I could run my little ASP.net application locally and that would succesfully access the report in reporting services and display it on screen &#8211; </p>
<p><a href="http://yossidahan.files.wordpress.com/2011/10/image4.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2011/10/image_thumb4.png?w=417&#038;h=303" width="417" height="303"></a></p>
<p>The last step, then, was to add support for STS.</p>
<p>I’ve made all the necessary configuration in the management portal, and copied the ws-federation metadata url, and then used the add STS reference wizard to make the necessary configuration changes to my application &#8211; </p>
<p><a href="http://yossidahan.files.wordpress.com/2011/10/image5.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2011/10/image_thumb5.png?w=266&#038;h=280" width="266" height="280"></a></p>
<p>The result of the wizard was a set of entries added to my web.config, to which I added, under &lt;system.web&gt; the following &#8211; </p>
<p>&lt;httpRuntime requestValidationMode=&#8221;2.0&#8243;/&gt;<br />&lt;pages validateRequest=&#8221;false&#8221;/&gt;<br />&lt;authorization&gt;<br />&nbsp; &lt;deny users=&#8221;?&#8221; /&gt;<br />&lt;/authorization&gt;</p>
<p>Running the application now automatically redirects me to the ACS, and – as I have configured to possible identity providers (Windows Live Id and Google) I am presented with a selection screen &#8211; </p>
<p><a href="http://yossidahan.files.wordpress.com/2011/10/image6.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://yossidahan.files.wordpress.com/2011/10/image_thumb6.png?w=244&#038;h=269" width="244" height="269"></a></p>
<p>Choosing the provider I want I am redirected to the login screen, hosted by the identity provider, and from there back to my application. the second time I will access my reporting application these redirects will happen, but local cookies in all parties will remember me and I won’t need to sign in again, until I sign out or the cookies expire.</p>
<p>The only thing to note is that the ACS configuration includes the url to the application, so once tested locally this needs to change to include the url on Windows Azure but once done, and deployed to Windows Azure, I can now browse to my reporting application, login using, for example, my Windows Live ID, and view a report on SQL Azure Reporting.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yossidahan.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yossidahan.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yossidahan.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yossidahan.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/yossidahan.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/yossidahan.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/yossidahan.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/yossidahan.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yossidahan.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yossidahan.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yossidahan.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yossidahan.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yossidahan.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yossidahan.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yossidahan.wordpress.com&amp;blog=28192073&amp;post=52&amp;subd=yossidahan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://yossidahan.wordpress.com/2011/10/26/on-sql-azure-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86c1d53dc7fca98123efdc01a3fa64f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yossidahan</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2011/10/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2011/10/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2011/10/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2011/10/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2011/10/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2011/10/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://yossidahan.files.wordpress.com/2011/10/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
