{"id":319,"date":"2012-02-12T17:30:42","date_gmt":"2012-02-12T17:30:42","guid":{"rendered":"https:\/\/pipe2text.com\/?page_id=319"},"modified":"2014-02-17T02:03:38","modified_gmt":"2014-02-17T02:03:38","slug":"configuring-adfs-server-as-the-first-server-in-the-adfs-farm-using-sql-for-the-conguration-database","status":"publish","type":"page","link":"https:\/\/pipe2text.com\/?page_id=319","title":{"rendered":"Configuring ADFS Server as the First server in the ADFS Farm using SQL for the Configuration Database"},"content":{"rendered":"<p>Hi All,<\/p>\n<p>After you have installed ADFS 2.0 on your server you will need to configure it for use (For information on installing ADFS 2.0 see <a title=\"Installing Active Directory Federation Services (ADFS) 2.0\" href=\"https:\/\/pipe2text.com\/?page_id=285\">Installing Active Directory Federation Services (ADFS) 2.0<\/a>)\u00a0. Using the configuration wizard is great but it will configure the server to use the Windows Internal Database (WID) as it&#8217;s configuration database. WID will work great in\u00a0many environments\u00a0as it is scalable, redundant and will let you add up to 5 ADFS servers in the farm but there are a few advantages to using SQL . If you decide to use a\u00a0 SQL server you will be able to use its high availability and backup features. Using SQL will also give you the added benefit of SAML artifact resolution and SAML\/WS-Federation token replay detection. For more information on the SAML artifact resolution and SAML\/WS-Federation, please go to Microsoft&#8217;s Technet Library and read about it.\u00a0\u00a0When using\u00a0SQL for your configuration database, you must configure ADFS from the command line using fsconfig\u00a0due to the fact that\u00a0installing\u00a0using\u00a0the configuration wizard through the GUI doesn&#8217;t offer the option to use SQL.\u00a0The configuration example I will be giving in this blog is meant to be used in a lab scenario since\u00a0I will be using self-signed certs. I will be using\u00a0a cert that I generate using selfssl for the Service Communication cert which is the cert that you bind to the default website in IIS as described later.\u00a0The Token Signing and Token Decrypting being used will be self signed certs which are generated when running the ADFS configuration with the \/AutoCertRolloverEnabled switch.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Preparing to run the ADFS Configuration<\/strong><\/span><\/p>\n<p>For the setup\u00a0you will need to create a Domain User for the ADFS service (This will be your ADFS service account). You will also need to run the command\u00a0logged on to the ADFS server with an\u00a0account (Not the ADFS Service Account) that has the correct access to\u00a0wite\u00a0to Active Directory and the account will also need proper rights to SQL for creating the Databases. I just used a Domain Admin account and granted that account DB Creator and Security Admin in SQL.<\/p>\n<p>Also, for the configuration to succeed, you will need to create a self signed cert as mentioned earlier. It seems when creating a self signed cert in IIS 7.5, it will only let you create a cert that uses the server name itself for the subject. For this reason, I used SelfSSL which is part of\u00a0the IIS 6 resource kit because\u00a0it gives you the freedom to create\u00a0a subject name of your choice. The subject name of the Service Communication Certificate <strong>MUST<\/strong>\u00a0match the name of the Federation Service Name. To create a self signed cert, download Selfssl to the ADFS server and open a command prompt as administrator. Change to the directory which contains the the Selfssl executable and type the following command replacing &#8220;adfs.pipe2text.com&#8221;\u00a0with your own federation service name:<\/p>\n<p>selfssl.exe \/T \/N:cn=adfs.pipe2text.com \/V:365<\/p>\n<p>Note: You may receive an error about being unable to open the metabase when running this command. You can safely ignore this error.<\/p>\n<p>Using the \/T will make sure the cert is place in the &#8220;Trusted Root Certificate Authorities&#8221; in addition to the &#8220;Personal&#8221; certificates on the local machine. Since this\u00a0is a self signed cert and not issued by a trusted 3rd party CA like Verisign, it\u00a0will need to be placed in &#8220;Trusted Root Certificate Authorities&#8221; for any machine that will\u00a0be accessing\u00a0the service using this certificate or there will be certificate errors. The \u00a0&#8220;\/V:365&#8221; switch \u00a0will make the cert valid for 365 days. You can increase this if you desire.<\/p>\n<p>Now that you have your self sign cert created, you will need to bind it the default website in ISS following these steps:<\/p>\n<p>1. Open the IIS Manager and right click the &#8220;Default Website&#8221; and select &#8220;Edit Bindings&#8221;.<\/p>\n<p>2. Under &#8220;Type&#8221; choose &#8220;https&#8221; and under &#8220;SSL Certificate&#8221; choose the cert that was created using SelfSSL and click &#8220;OK&#8221;.<\/p>\n<p>3. You will now see &#8220;https&#8221; and &#8220;443&#8221; in the\u00a0list of site bindings. Click &#8220;Close&#8221;.<\/p>\n<p>Now its time to configure the ADFS server. As mentioned earlier, since we are using SQL for the configuration database we will need to run the configuration from the command line. To do this you will need to use the fsconfig utility. To use the fsconfig utility, open a command prompt as administrator and switch to the \u201cActive Directory Federation Services 2.0\u2033 folder under the &#8220;Program Files&#8221; directory\u00a0where fsconfig.exe is located. where fsconfig.exe is located.\u00a0Type the following command replacing the information with information that is specific to your environment.<\/p>\n<p>FSConfig.exe CreateSQLFarm \/ServiceAccount pipe2text\\adfslabuser \/ServiceAccountPassword <em>Password<\/em> \/SQLConnectionString &#8220;database=AdfsConfiguration;server=<em>sqlservername\\instance<\/em>;integrated security=SSPI&#8221; \/CleanConfig \/FederationServiceName adfs.pipe2text.com \/AutoCertRolloverEnabled<\/p>\n<p>You will see the following output if everything ran ok.<\/p>\n<p><a href=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/02\/RunFSConfig.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-342\" title=\"RunFSConfig\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/02\/RunFSConfig.png\" width=\"662\" height=\"327\" srcset=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/02\/RunFSConfig.png 662w, https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/02\/RunFSConfig-300x148.png 300w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/a><\/p>\n<p>A few notes about the above command.<\/p>\n<p>The \/ServiceAccount specifies the ADFS Service account (an account you created in your domain as mentioned earlier) to be configured to run the ADFS Service.<\/p>\n<p>\/ServiceAccountPassword is the password of the service account. If you don&#8217;t specify this switch it will prompt you for the password before it proceeds.<\/p>\n<p>\/SQLConnection is the name of the configuration database (It must always be &#8220;AdfsConfiguration&#8221;) and server is the name of the SQL server and instance name.<\/p>\n<p>\/Cleanconfig will clear out an existing ADFS configuration Database if one already exist.<\/p>\n<p>\/AutoCertRolloverEnabled enable the automatic rollover feature for signing and decrypting certificates. When this is enabled, self signed certs are used for the Token signing and decrypting certificates and they are renewed automatically.\u00a0There are other\u00a0switches\u00a0that can be used to specify\u00a03rd party\u00a0certs for the token and decrypting certs but for this scenario I simply enabled the automatic rollover feature.<\/p>\n<p>For\u00a0detailed\u00a0information on the using\u00a0fsconfig to configure your ADFS server using\u00a0different options and configurations you can simply type &#8220;fsconfig \/help&#8221;.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Having a look around after the configuration was run<\/strong><\/span><\/p>\n<p>If you open the ADFS 2.0 management console you can look and see your Service Communication, Token Signing and Decrypting Certificates have been configured under &#8220;Service\\Certificates&#8221;. Under\u00a0&#8220;rust Relationships&#8221;\u00a0you will\u00a0see that Active Directory has been configured as a &#8220;Claims Provider Trust&#8221; and as an &#8220;Attribute Store&#8221;. Additionally, if you if you open the Services Console (service.msc) you will notice that the &#8220;AD FS 2.0 Windows Service&#8221; is configured to use the ADFS Service account. You can also open the IIS console and have a look under the default website to see that everything has been configured.<\/p>\n<p>Now,\u00a0if you look look in &#8220;Active Directory Users and Computers&#8221; (must be in &#8220;Advanced Feature View&#8221;) you will see the certificate sharing container was created under &#8220;Program Data\\Microsoft\\ADFS&#8221;.<\/p>\n<p>On your SQL server you will notice that the ADFS Configuration and Artifact Resolution databases have been created.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Create an A Record in DNS for your Federation Service Name<\/strong><\/span><\/p>\n<p>You will need to create an A record on your DNS server for client&#8217;s browsers to be able to resolve the\u00a0Federation Service Name. <strong>It\u00a0MUST be an A record and\u00a0NOT\u00a0an alias (CNAME).\u00a0\u00a0<\/strong>If you use an alias you may run into things such as the browser prompting for credentials when hitting the ADFS server. In my case I added an A record for &#8220;adfs.pipe2text.com&#8221; with the IP address of my ADFS server. Just a note: If I had multiple ADFS servers in the farm\u00a0I would have them behind a load balancer and then I would point the A record for the Federation Service Name to the\u00a0Virtual IP\u00a0Address on the\u00a0load balancer.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Verifying your ADFS Server is Operational<\/strong><\/span><\/p>\n<p>To verify the ADFS server is now operational you can hit the following URL\u00a0using your\u00a0Federation Service name:<\/p>\n<p><a href=\"https:\/\/pipe2text.com\/adfs\/fs\/federationserverservice.asmx\">https:\/\/federationservicename\/adfs\/fs\/federationserverservice.asmx<\/a><\/p>\n<p>For Example using my federation service name it would be as follows:<\/p>\n<p><a href=\"https:\/\/pipe2text.com\/adfs\/fs\/federationserverservice.asmx\">https:\/\/adfs.pipe2text.com\/adfs\/fs\/federationserverservice.asmx<\/a><\/p>\n<p>If the server is working properly you will see an XML document displayed with the service description document.<\/p>\n<p>Note: Since you are using self signed certs for the service communications cert,\u00a0you will get a certificate error when connecting to the site since the cert is not trusted. You can just click continue to site. To avoid getting this error, you can export the certificate from your ADFS Server and import it to the &#8220;Trusted Root Certificate Authorities&#8221; of your client machine or just deal with the error.<\/p>\n<p>Another step in verifying your ADFS server is by looking in the Event Viewer on the ADFS Server under &#8220;Applications and Service Logs\\AD FS 2.0\\Admin&#8221;. In the Admin log you should see event ID 100.<\/p>\n<p>Now that your ADFS Server is setup you can add a relying party but I will save that for another blog. I will also be adding a blog\u00a0on how to add\u00a0additional ADFS Servers to the farm. I hope this was helpful. If you have any questions, comments or feedback please feel free to post them.<\/p>\n<p>Related Links:<\/p>\n<p><a title=\"Installing Active Directory Federation Services (ADFS) 2.0\" href=\"https:\/\/pipe2text.com\/?page_id=285\">Installing Active Directory Federation Services (ADFS) 2.0<\/a><\/p>\n<p><a title=\"Adding an additional ADFS Server to your ADFS Farm when using SQL for the Configuration Database\" href=\"https:\/\/pipe2text.com\/?page_id=395\">Adding an additional ADFS Server to your ADFS Farm when using SQL for the Configuration Database<\/a><\/p>\n<p><a title=\"Configuring your ADFS 2.0 Farm to use a SQL Mirror\" href=\"https:\/\/pipe2text.com\/?page_id=542\">Configuring your ADFS 2.0 Farm to use a SQL Mirror<\/a><\/p>\n<p><a title=\"Installing and Configuring an ADFS 2.0 Proxy Server\" href=\"https:\/\/pipe2text.com\/?page_id=399\">Installing and Configuring an ADFS 2.0 Proxy Server<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi All, After you have installed ADFS 2.0 on your server you will need to configure it for use (For information on installing ADFS 2.0 see Installing Active Directory Federation Services (ADFS) 2.0)\u00a0. Using the configuration wizard is great but &hellip; <a href=\"https:\/\/pipe2text.com\/?page_id=319\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"class_list":["post-319","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pipe2text.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=319"}],"version-history":[{"count":52,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/319\/revisions"}],"predecessor-version":[{"id":2701,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/319\/revisions\/2701"}],"wp:attachment":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}