Friday, March 9, 2012

Using Windows Azure Access Control Services for Windows Live Authentication using Live Id SDK and ADFS authentication – Part 1

After long time I am writing post today. Well I was busy in doing some important work related to Azure which took substantial amount of time. Today I am going to discuss the same.
I will guide you on how I used Azure ACS along with Windows Live ID. The main problem with Windows Live Id using with Azure ACS is that, you don’t get profile information. Means you will not receive the email ID, user name etc information as claims from Azure ACS when using Live Id. So what is the solution?
Also I want to use ADFS (Active Directory Federation Service) for which I need to use ACS. So how can I integrate Access Control Services with Active Directory Federation Services and Live ID and get required information in claims? Following post talks about the same.

Here I assume that, you already have an ACS namespace configured on Azure Management Portal. Also you have configured Identity Providers – ADFS and Live ID, relying party for URL – http://127.0.0.1/ along with necessary rules. For example “name” rule for live ID and default rules that get generated for my ADFS. If local cloud environment is running on port 81 then relying party URL will be – http://127.0.0.1:81/ I am running on port 80 so throughout the explanation I will use http://127.0.0.1/ only.

Windows Azure ACS - Windows Live Integration - Callback.aspx code samples

This post is follow up of Part 1 and Part 2.
Callback.aspx -



<%@ Page Language="C#" AutoEventWireup="true" Inherits="Avanade.AMMO.Web.Callback" Codebehind="Callback.aspx.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>  
    <script src="//js.live.net/v5.0/wl.js" type="text/javascript" language="javascript"></script>
</head>
<body>
<form id="form2" runat="server">           
</form>
</body>
</html>

Wednesday, February 15, 2012

Windows Azure and ACS - CryptographicException: Key not valid for use in specified state

My technical architect asked me to work on windows Azure access control service and configure ACS for ADFS. After following all the steps on Azure management portal such as configuring identity provider, adding relying party; it was time for me to add STS reference in my azure web role. If you don’t know click - how to add STS reference.
I added the STS reference in my web role and pressed F5 to start debug. And I got difficult exception mentioned below –
CryptographicException: Key not valid for use in specified state.
InvalidOperationException: ID1073: A CryptographicException occurred when attempting to decrypt the cookie using the ProtectedData API (see inner exception for details). If you are using IIS 7.5, this could be due to the loadUserProfile setting on the Application Pool being set to false.
 I don’t understand why I always face very odd issues. Anyways, following is the description about solution to the above mentioned error.

Friday, February 10, 2012

Windows Azure and ACS - ID1024: The configuration property value is not valid. Property name: 'serviceCertificate'

Total there are 2 errors which I have seen getting resolved with following information I am providing.
If you are using Azure Web Role with Azure ACS configured ADFS authentication then you may receive any of the following 2 errors –
1.     Parser Error Message: ID1024: The configuration property value is not valid.
Property name: 'serviceCertificate'
Error: 'ID1039: The certificate's private key could not be accessed. Ensure the access control list (ACL) on the certificate's private key grants access to the application pool user

2.     The X.509 certificate CN=companyinacloud.accesscontrol.windows.net is not in the trusted people store. The X.509 certificate CN=companyinacloud.accesscontrol.windows.net chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
I will be discussing the steps I followed which worked for me. Hope it will help to you as well. Here is the solution.
Make sure that the certificate stored in LocalMachine My store should be same as the certificate present in ACS namespace created on Azure Management Portal. If you see the exception details closely then in above 1st error you will observe a description that says - The certificate's private key could not be accessed. Ensure the access control list (ACL) on the certificate's private key grants access to the application pool user.