AD FS 2.0 - No certificate with thumbprint “…….” found

During the last week I was working for an identity project related to the new U-Prove CTP version of the Active Directory Federation Services 2.0.

As you know, when working with new technologies, it is very common to find blocking issues like this. This is why I want to share with you my experience.

Symptom

AD FS certificates cannot be changed neither from the Management Console nor PowerShell Cmdlet. You may receive an error message like No certificate with thumbprint “…….” found.

Solution

  1. Open the Microsoft Management Console and add a new Certificates Snap-in for Computer Account
    • Go to the Personal / Certificates node and open the new certificate you are going to use by doble-clicking on it
    • Select the Details tab and copy the Thumbprint value
  2. Open SQL Server Management Console
    • Select the AdFsConfiguration databaseNote: If you are using the Microsoft Internal Database you can use this connection string ( \\.\pipe\mssql$microsoft##ssee\sql\query )
    • Open the IdentityServerPolicy.ServiceSettings table and copy the ServiceSettingsData field value (XML) to a Notepad
    • Find the missing Thumbprint values you got on the AD FS error message
    • Replace the found values by the new one certificate’s Thumbprint without empty spaces.
    • Update the ServiceSettingsData field with the new XML configuration
      Note
      : XML contents must not BE tidy

  3. Go to to and refresh the Certificates node
  4. At this point you should see listed the new certificate
  5. If you are changing the Service Communications Certificate, open the Internet Information Service (IIS) Manager
    • Select the Default Website
    • Click on Bindings… action, go to the https row ad click on Edit…
    • Select the new certificate from the SSL certificate combo-box and click OK (Note: if you see an error message, click ok)

Windows Azure Tables adapter for DataMapper

The Past

Last Friday, we shipped the first Major version (v1.0.0) of the Windows Azure Storage API gem for ruby, started a few months ago by my friend Johnny Halife. As it is an open-source project, I had the opportunity to contribute with:

  • Support for table service to query, get_one, insert, update, merge and delete entities.
  • Support for running against the Storage Developement Fabriq shipped with Microsoft SDK.
  • Signature support for Tables service according to msdn.microsoft.com/en-us/library/dd179428.aspx
  • Support to enumerate, create, and delete tables on give storage account.
  • Give feedback to Improve the support for stacked connection management.

This release of waz-storage for ruby includes numerous features collected thru 0.5.6 to 1.0.0, for more information you can visit the http://waz-storage.heroku.com/ where you will find all the gem documentation, or if you like to read the source code, contribute or giving us feedback you can get it from on http://github.com/johnnyhalife/waz-storage.

The Present

One of the objectives of having Tables support on the gem was to have an interface to interact with Tables and Entities that we can consume from an adapter as we usually do with our favorite ORM written in ruby which is DataMapper.

This is why this weekend was pretty much to make the dream come true, creating a new project on github called dm-waztables-adapter (http://github.com/jpgarcia/dm-waztables-adapter) and spitting some lines of code.

Writing the adapter

As everything in Ruby wonderful world, it was really easy to have a first version running with the features provided by Datamapper.

It took me a few hours to write down 85 lines of code to cover the whole adapter (Create, Read, Update and Delete methods)

Sorry, I’m forgetting the aditional 30 minutes I spent on writing 32 more lines to cover the Migrations stuff. So you won’t worry about creating the tables when you design your models (As Windows Azure doesn’t have support for schemas inside tables, migrations exists just to make sure that you have the tables. It won’t modify attributes of existing data).

Below you will find some code samples. I hope you like it.

Getting started

sudo gem install dm-waztables-adapter --source http://gemcutter.org

Usage

require 'dm-waztables-adapter'

# set up a DataMapper with your Windwows Azure account
DataMapper.setup(:default, { :adapter => 'WAZTables',
                                         :account_name => 'name',
                                         :access_key => 'your_access_key' })

# define a new model
class Guitarist
    include DataMapper::Resource

    property :id, String, :key => true
    property :name, String
    property :age, Integer
end

# set up database table on Windows Azure for a specific model
Guitarist.auto_migrate! # (destructive)
Guitarist.auto_upgrade! # (safe)

# set up database table on Windows Azure for all defined models
Datamapper.auto_migrate! # (destructive)
Datamapper.auto_upgrade! # (safe)

# play with DataMapper as usual
Guitarist.create(:id => '1', :name => 'Ritchie Blackmore', :age => 65)

yngwie = Guitarist.new(:id => '2', :name => 'Yngwio Malmsteen', :age => 46)
yngwie.name = "Yngwie Malmsteen"
yngwie.save

# retrieving a unique record by its id
ritchie = Guitarist.get('1')
ritchie.age # => 65

# updating records
ritchie.age = 66
ritchie.save

# retrieving all guitarists
    Guitarist.all.length # => 2

# performing queries
    older_guitar_players = Guitarist.all( { :age.gte => 50 } )

# deleting records
older_guitar_players.destroy!

TODO

  • Allow users to define the model partition key by using :partition_key => true option on the property.
  • Allow users to set the partition key as an additional attribute of the model with a lambda as default value.
  • Allow users to set the partition key as a method on the model.
  • Implement “in” operator in queries
  • Implement “order” query option
  • Retrieve more than 1000 fields using Windows Azure :continuation_token

Known Issues

  • Like statements are not working since Microsoft service API is throwing a NotImplemented exception when
    using startswith and endswith filters (more information here)
  • There’s no way to tell thru the entity which is the partition key of our entity, so there’s no out-of-the-box load balancing support (for mor info on the tables model that a look at http://msdn.microsoft.com/en-us/library/dd179338.aspx)

Reaching Azure Development Fabriq from a remote machine

Are you following me on Twitter? If the answer is yes, you may know that I forked the waz-storage project to write the Tables and Entities operations exposed by the Windows Azure Table API.

One of the things I wanted to get while writing code in my ruby environment, was to perform functional tests against a local environment. So, today I’m going to talk about the Azure Development Fabriq and how you can access to this service from outside your local host.

The problem

The Development Fabriq is configured by default to listen in the following sockets:

That said, we can imagine that http://{Your_LAN_IPAddress}:10000/devstoreaccount1/container/myblob will allow us to get that blob, but it will never happen. At this point, you can consume the services just from your localhost.

The solution

You can change the default 127.0.0.1 IP address by the one assigned to your interface, in the configuration file C:\Program Files\Windows Azure SDK\v1.0\bin\devstore\DSService.exe.config:

<services>
  <service name="Blob" url="http://192.168.1.100:10000/"/>
  <service name="Queue" url="http://192.168.1.100:10001/"/>
  <service name="Table" url="http://192.168.1.100:10002/"/>
</services>

Shutdown / Start the Development Fabriq to apply those changes and that’s it. Tests passing from Textmate against a vm runing the Storage Service locally.

image

image

hope you like it!

Dropzone extension leveraging Ruby waz-storage gem

It’s been a long time since my last post, so today I want to share with you my experience on using the waz-storage gem, created by my friend Johhny Halife. If you are not aware about his amazing job you should check this post to get more context about what I’m going to show you.

What can I do?

After reviewing Johnny’s code I was very excited on creating something and to start playing with that toy, but obviously the question was WHAT?

The answer came to my mind while reading a blog about an application for Mac OSX desktop called Dropzone. This is a excerpt taken from Dropzone’s website.

“Drag a file onto the dock icon and your fully customizable grid of destinations flies smoothly out using core animation. Drop the file onto a destination and Dropzone will take care of the rest. Whether you’re installing an app, uploading a file to an FTP server or sharing your photos on Flickr.”

There is a section regarding how to extend the Dropzone’s features, and how to contribute creating plugins. Dropzone can easily be extended using simple ruby scripts.

So, I thought about writing a script that allow users to easily drag an drop files from your computer and store them as Blobs on the Windows Azure Storage Services.

Coding for fun!

I started reading the Dropzone Scripting API documentation and I was surprised how easy it was. There are only two methods to implement which are dragged, clicked and that’s it.

Beyond the simplicity that gives the Dropzone’s API, I had the joy of coding in Ruby and the waz-storage gem easiness.

You can find the source code on the following url http://github.com/jpgarcia/dropzone-user-scripts/blob/master/WAZBlobs.dropzone

How can you try it?

Installation and configuration:

  1. Download the Dropzone program from here
  2. Install the waz-storage gem if the gem isn’t installed yet
    sudo gem install waz-storage –version >= 0.5.4 –source http://gemcutter.org
  3. Download the dropzone extension that I created from the github repositories. The file is called WAZBlobs.dropzone
  4. Open the WAZBlobs.dropzone file and provide your Windows Azure Services credentials as depicted below:

The script and the functionality is very simple:

  1. Drag and drop your files to the Azure’s icon on the Dropzone panel
  2. The files will be uploaded to a public container called dropzone.
  3. The following picture shows how the Picture 3, that I dragged & dropped above, is already on Windows Azure Blobs servers. So I will play a little bit with the console to show you that the Blob is already there :)

On my next post I will show you a new application I’m developing on Heroku that uses the same gem to manage the Blobs via Web. Stay tuned!

Webcast for Latin American Community about HPC with WCF

Spanish Version

On December 11, 2008 we gave a Webcast for Latin American Community with my friend and mentor Johnny Halife about how to develop distributed applications by using Windows HPC Server 2008.

The objective of the talk was about to explain the platform that Windows HPC Server 2008 provide us to build distributed applications with a SOA architecture by using Windows Communication Foundation (WCF).

In addition we had the opportunity to make a small demo creating a simple application on our lab deployed at Southworks.

For the ones that couldn’t attend this presentation, you can download or watch it in the following url: http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032390257&Culture=es-AR.

Enjoy it!

Visual Studio 2008 templates compliant with Microsoft StyleCop

Motivation

Since Microsoft launched StyleCop, we are running this tool in all Southworks’ projects. From our Engineering Excellence department we’re promoting the use of this tool because it give us source code consistency and homogeneity we want for developers and customers who read the code.

If you’re using this tool, you surely be realized that some Visual Studio templates are not compliant with some of the StyleCop rules, like using directives inside the namespaces, regions, one class for each file, among others. This is quite annoying when you’re coding because each class, interface or test you add to your project has to be stylized to meet that rules.

Project templates like ASP.Net Web MVC Application (Preview 5) have an amount of ~120 warning even avoiding the documentation rules.

The purpose of this post is to give you a workaround to avoid this unnecessary work.

Context

The way that Visual Studio provides these templates is by using a series of compressed zip files, with the base source code inside.

There are two folders inside the %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\” with these templates, one for the items (classes, interfaces, tests, etc.) and one for projects (Class Library, Console Application, MVC Web Application, etc.).

Workaround

The workaround is pretty much straightforward, all you have to do is:

  1. Extract the default Visual Studio template files
  2. Modify them to be compliant
  3. Compress it again
  4. and overwrite the original files

What I did this weekend, is make the work for you for the most used files and projects for me including the Microsoft ASP.Net MVC preview 5 project template :). So below you’ll find a table with the zip files to download and the folder location where you will overwrite them.

Once you have copied the files, ensure you’ve all you Visual Studio instances closed and run as administrator from the console the following command to refresh Visual Studio’s template cache:

“%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com" /setup"

Template Files

(*) rootPath = "%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\"

template path template file

(*)\ItemTemplates\CSharp\Web\MVC\1033

(*)\ItemTemplates\CSharp\1033

(*)\ItemTemplates\CSharp\Code\1033

(*)\ProjectTemplates\CSharp\Web\1033

(*)\ProjectTemplates\CSharp\Test\1033

You can also download all templates in a single .zip file: AllTemplates.zip

One year and four months later…

Spanish Version

Yesterday night while drinking a couple of beers with some of my Southworks’ colleagues, I returned back to my home and being lying on my bed, I started to think on this last year and four months from when I began working in Southworks.

While I was dating back over time, I remembered in which projects and customers we were worked for, some of them are “Microsoft Architecture Strategy Team”, “Microsoft Depeloper & Platform Evangelism Team”, “Microsoft Connected Services Framework Team”, “Microsoft SQL Server Team”, “Grupo Sancor Seguros” among others, and the important people who I known in person like Eugenio Pace y Gianpaolo Carraro.

Words and technical acronyms came to my mind regarding things I have being acquired and incorporated during this time. So, in this moment I started to imagine something like a mental “Tag Cloud” and it was there when I decided to write this post with the objective of leaving this as a log experience and to compare it in the future with the new words that surely will be added.

Beside all tags am I listing in this post, I wanted to thank all Southies who were helping me to fill my mind with all this knowledge and specially to my two mentors, which are Johnny Halife y Matias Woloski who today I still admiring and respecting, but the ones who I having fun where the computer aren’t close to us.

Here is my "Mind Tag Cloud":

  Refactoring    Code Analysis    Retrospective    TDD    WCF    WSDL    Continuous Integration    Patterns    Cluster Server    ISO    Virtualization    SOA    Singleton    Cyclomatic Complexity    WPF    Model View Controller    REST    Linq to XML    Mocks    Paravirtualization    Sprint    Hyper-V    Lamda Expressions    Repository    SAN    Synchronization Framework    iSCSI    LUN    Powershell    SCRUM    Ssds    Agile    Spike    NAS    Iteration Planning    Dependency Injection    Factory    Linq to SQL    Code Coverage    Subversion    Security Token Service    CMMi    StyleCop    Model View Presenter    Strategy  FxCop    Serialization    Apache    Prototype    Datamember    Composite Application Block    Build Server    RSS    DIT    S+S    Backlog    Commitment    Inversion Of Control    Scaffolding    Abstract Factory    Reflection    LCOM    Iteration Review    Software As A Service    DataContract    TFS    Code Query Language    SOAP    Dynamic Language Runtime    Lightweight Directory Services 

Avoiding duplicated items in Fxcop analysis using MSBuild

In my previous post, I started with a posts series that describe the tasks we’ve included in the Southworks SDC Tasks we recently published at Google Code.

Today, I’m going to focus in a useful and interesting task which is RemoveDuplicatedFileNames and the reason of why we had the need to create it.

So let’s start.

The Problem

Imagine you have a solution where your assemblies are referenced as depicted in the picture below:

image

When you compile this solution you’ll realize that the Contracts.dll assembly will be generated into the Services and in WebUx folders, that’s right?

So far, there is no problem regarding compilation, but what happens if we define an ItemGroup in our MSBuild project that includes all our solution assemblies to be examined by FxCop by using WildCards like this?

<ItemGroup>
  <Assemblies Include="$(SampleDirectory)\**\*.dll" />
</ItemGroup>

The answer is that FxCop will analyze the same assembly twice, which will generate duplicated warnings and Code Analysis errors.

Our solution approach

As I told you previously we created a simple task called RemoveDuplicatedFileNames that basically remove items from an ItemGroup on the MSBuild process, to avoid the problem described above.

So let me show you how you should configure your project file to use this task

  1. Reference the Southworks SDC Tasks assembly RemoveDuplicatedFileNames in your project file
    <UsingTask AssemblyFile="$(ToolsPath)\Southworks.Sdc.Tasks.dll"
               TaskName="RemoveDuplicatedFileNames"/>

  2. Create your ItemGroup including your assembly files
    <ItemGroup>
      <Assemblies Include="$(SampleDirectory)\**\*.dll" />
    </ItemGroup>

  3. Inside the target that runs FxCop include the following lines
    <RemoveDuplicatedFileNames Input="@(Assemblies)">
      <Output TaskParameter="FilteredItems" 
              ItemName="CodeAnalysisItems" />
    </RemoveDuplicatedFileNames>

  4. Finally, instead of using the Assemblies defined in the first point, you should use the new filtered ItemGroup generated in the previous point
    <FxCop Assemblies="@(CodeAnalysisItems)"
           OutfileName="$(CCNetArtifactDirectory)\fxcop.xml"
           ProjectFilePath="$(CCNetArtifactDirectory)\project.fxcop"
           ToolPath="$(FxCopPath)"
           ProjectTemplateFilePath="$(ToolsPath)\template.fxcop" />

Note: The FxCop task is not part of Southworks SDC Tasks, you can get it from the Microsoft SDC Tasks at Codeplex. There are many useful tasks for your build process!

Verification

in order to verify if your assemblies are no duplicated you should add a Message task on the same target to display the contained values on both ItemGroup, Assemblies and CodeAnalysisItems.

<Message Text="Unfiltered Assemblies" />
<Message Text="=====================" />
<Message Text="@(Assemblies)" />
 
<Message Text="Filtered Assemblies" />
<Message Text="===================" />
<Message Text="@(CodeAnalysisItems)" />

Technorati Profile

Updating your Assembly Info files with Southworks SDC tasks

Spanish Version

Johnny and Ezequiel had published in they blogs about the Southworks SDC Tasks we published two weeks ago in Google Code. This project is a set of comprehensive MSBuild tasks that we built along with the maturity of our build process.

I’ll give you a walkthrough for these tasks we developed by giving you a sample of each one of them.

In this post you will find how you can easily update your assembly info files with company information by using the UpdateAssemblyinfo task.

This task is pretty much straight-forward, so I will create a simple .proj file to demonstrate how it works.

Reference the SDC assembly in your project file

The first step is to add the assembly reference for this specific task by giving the AssemblyFile and the TaskName values:

<Project DefaultTargets="UpdateAssemblyInfos" 
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask AssemblyFile="d:\test\Southworks.Sdc.Tasks.dll"
             TaskName="UpdateAssemblyInfo"/> 
</Project>

Notice that the DefaultTargets property indicates which target will be first executed, I’m going to include this target later.

Defining the files to be updated

Then, you need to specify which files will be updated and where they’re located. To do that create a new ItemGroup. If you want to know more about including and/or including Items, see http://msdn.microsoft.com/en-us/library/646dk05y.aspx.

<Project DefaultTargets="UpdateAssemblyInfos"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
  <UsingTask AssemblyFile="d:\test\Southworks.Sdc.Tasks.dll"
             TaskName="UpdateAssemblyInfo"/>  
  <ItemGroup>
    <AssemblyInfos Include="d:\test\**\AssemblyInfo.cs"/>
  </ItemGroup>
 
</Project>

Configure the UpdateAssemblyinfo target

Finally create and configure a new target by specifying the information to be replaced on the files we defined in the previous step.

<Project DefaultTargets="UpdateAssemblyInfos" 
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
  <UsingTask AssemblyFile="d:\test\Southworks.Sdc.Tasks.dll"
             TaskName="UpdateAssemblyInfo"/>
  
  <ItemGroup>
    <AssemblyInfos Include="d:\test\**\AssemblyInfo.cs"/>
  </ItemGroup>
 
  <Target Name="UpdateAssemblyInfos">
    
    <UpdateAssemblyinfo Include="@(AssemblyInfos)"
                      AssemblyCopyright="Southworks (r) copyright"
                      AssemblyCompany="Southworks"
                      AssemblyProduct="Sample product " />
  </Target>
  
</Project>

To see if all it’s working as expected, you could run the project file with MSBuild as depicted bellow:

image

Open the sample AssemblyInfo.cs file and see how it was updated:

image

thanks, stay tuned!

Folder wildcards like \**\ in CruiseControl.Net

Spanish Version

Last week we were working on our Build Server using CruiseControl.Net to allow multiple Test / Code Coverage tasks for two or more solutions.

Once we’ve configured the .proj file to run a set of two RunTests / RunCodeCoverage tasks we needed to merge the results file to the MSBuild log after running them.

So, our first approach was modifying the ccnet.config file to merge the files generated by these tasks using the same pattern of MSBuild, I mean, using "\**\", something like this:

<merge>
  <files>
    <file>D:\srv\ccnet\logs\project\**\*.trx</file>
    <file>D:\srv\ccnet\logs\project\**\*.cvg</file>
  </files>
</merge>

At this point, we have figured out that Cruise Control .Net does not have this functionality, only it allows to run something like D:\srv\ccnet\logs\project\theProject\*.trx, and since the CruiseControl.Net source code is available I started to writing some lines to modify the ThoughtWorks.CruiseControl.Core assembly to allow that.

In this post you will find the source code of the spike I wrote with a series of tests to implement that feature and the WildCardPath.cs source code from the core CruiseControl.Net project updated.

  • Spike solution with tests [Download]
  • WildCardPath class file of CruiseControl.Net Core assembly [Download]

Once you have updated the Core project with the new implementation of the WildCardPath class, you need to do the following tasks to keep it running.

  1. Compile the Core project
  2. Stop the CruiseControl.Net service
  3. Replace the ThoughtWorks.CruiseControl.Core assembly with the new one.

And that’s it, use wildcards as in MSBuild :)

Next Page »