OK, I think a couple of you guys already did it successfully – others just look for something written. Here we go.
Let's start right away by browsing to GitHub and clone the IdentityServer.v2 repo:
After cloning we have the following code structure in Windows Explorer:
Open Thinktecture.identityServer.sln as an elevated admin (for the Windows Azure Compute Emulator to work correctly). Build the entire solution.
No, choose Add… New project… and add a new Cloud project to the solution.
In the Cloud Service dialog do not choose any new project, just hit OK.
We now add the existing IdSrv WebSite project as a Web Role to the Windows Azure project, just like so:…
For now, the solution should look something like this:
Alright. On to some essential Cloud stuff now.
We need an SSL certificate. I am going to use an existing self-issued cert from my local machine. This of course needs to be a 'real' certificate if you deploy IdSrv as a production STS to Windows Azure – of course
Please head over to WebSite role configuration and the Certificates tab. Specify your desired certificate:
Based on this certificate we now create an SSL endpoint:
OK, this should be it for now.
Let's attack the database side of things. We need a SQL database for our identity configuration and data. I am going to create a new one via the Windows Azure management portal:
Please make a note of the connection string for your SQL database as we still need to change the connection strings inside IdentityServer's configuration files.
Then open up connectionString.config in the Configuration folder inside the WebSite project and adjust the connection strings to point to your SQL database in the Cloud:
2: <add name="IdentityServerConfiguration"
4: Database=idsrvcloud;User ID=christian@…;Password=...;
5: Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
6: providerName="System.Data.SqlClient" />
8: <add name="ProviderDB"
10: Database=idsrvcloud;User ID=christian@…;Password=...;
11: Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
12: providerName="System.Data.SqlClient" />
… drum roll …
F5 (with the Cloud project as the startup project) and pray …
Enter the basic setup information you need to enter and you should be good to go. This locally running instance inside Windows Azure Compute Emulator already uses the Cloud SQL database – just for the records.
Done… well almost … I am spilling the beans already now so that we can save some cycles.
There is an issue with the Membership hash algorithm type on Cloud VMs.
- Locally: HMACSHA256
- Azure Cloud Emulator: HMACSHA256
- Published to Cloud Service: SHA1
So it looks like there must some machine.config setting in Cloud Service images – Microsoft is investigating this.
For us it means we need to set the keys explicitly in web.config (you can use a tool like this):
6: validation="HMACSHA256" />
After that we need to export the SSL cert, anyways, so that we can upload it to the Cloud Service , e.g. via the management portal.
And then, we finally can publish & deploy to Windows Azure:
After approx. 8 to 10 minutes we have our thinktecture IdentityServer v2 running up in the Cloud.
Hope this helps.