If the AutoCertificateRollover feature of ADFS 2.0 is utilized (by default), it’s not necessary to replace the Token-Signing and Token-Decrypting certificates manually. AutoCertificateRollover will create self-signed certificates and set it as primary Token certificates when a time threshold has been met.
Some Relying Parties cannot consume the Federation Metadata automatically so it might make sense to deploy the certificates manually. To maintain the certificates manually it is necessary to set the appropriate value.
- Launch Powershell on the Federation Server
- Run the following commands:
Add-Pssnapin Microsoft.Adfs.Powershell
Get-ADFSProperties
- The value of AutoCertificateRollover will show True (default value) or False
- Set the value to False to maintain the certificates manually:
Set-ADFSProperties -AutoCertificateRollover $False
Create Certificates (Option 1)
- Open Internet Information Services Manager
- Click on Server
- Double-click Server Certificates
- Under Actions Create Self-Signed Certificate…
Create Certificates (Option 2)
Use the Makecert.exe utility. Makecert.exe is available in the Microsoft .NET Framework 2.0 Software Development Kit (SDK) (x86) (http://go.microsoft.com/fwlink/?LinkId=79548)
makecert -r -n “CN=ADFS Token Signing Certificate” -pe -len 2048 -b 08/31/2012 -e 08/31/2015 -eku 1.3.6.1.5.5.7.3.3 -ss my -sr localMachine -sky exchange -sp “Microsoft RSA SChannel Cryptographic Provider” -sy 12 “ADFSTokenSigningCert.cer” -a sha1
makecert -r -n “CN=ADFS Token Decrypting Certificate” -pe -len 2048 -b 08/31/2012 -e 08/31/2015 -eku 1.3.6.1.5.5.7.3.3 -ss my -sr localMachine -sky exchange -sp “Microsoft RSA SChannel Cryptographic Provider” -sy 12 “ADFSTokenDecryptingCert.cer” -a sha1
You can set a longer validity period using this option (Option 1 is only for 1 year)
-r creates o self-signed certificate
-n specifies the subject’s certificate name
-pe marks private key as exportable
-len specifies the generated key length, in bits (must be at least 2048)
-b specifies the start of the validity period
-e specifies the end of the validity period
-eku sets enhanced key usage for Code Signing (not necessary)
-ss specifies the subject’s certificate store name that stores the output certificate
-sr specifies the subject’s certificate store location
-sky specifies the subject’s key type (exchange is used for key encryption and key exchange)
-sp specifies the subject’s CryptoAPI provider name
-sy specifies the subject’s CryptoAPI provider type
-a specifies the signature algorithm (sha256 is only supported by .NET 4.0)
Add certificates to ADFS
- Open ADFS 2.0 Management Console
- Expand Service and click on Certificates
- Under Actions click on Add Token-Signing Certificate… or Add Token-Decrypting Certificate…
- Select the appropriate certificate
- Acknowledge the warning message
If a service account for ADFS is used, it’s necessary to add additional read access to the private keys via the Certificate Management Console
- Open the Certificate Management Console (Local Computer)
- Expand Personal and select Certificates
- Right-click the appropriate certificate, select All Tasks, and select Manage Private Keys
- Add Read access for the ADFS 2.0 Service Account and click OK
Set the new certificate as Primary
- Open ADFS 2.0 Management Console
- Expand Service and click on Certificates
- Right-click the added certificate and click Set as Primary
When experiencing problems with “too many parameters” check out this link to solve the problem:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/1e41910f-2f89-439c-93a6-57e5c391d7ca/?prof=required
Sometimes Unicode characters can be tricky…