<div> 
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2531 " id="quads-ad2531" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>
 <h2>The Story: </h2><p>You might have got a request to upgrade from ADFS 2012 R2 to Windows ADFS 2016. </p><div> 
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2528 " id="quads-ad2528" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>
 </div><div> 
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2525 " id="quads-ad2525" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>
 </div><div> 
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2526 " id="quads-ad2526" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>
 </div><p>This process can be complicated especially if you&rsquo;ll have to migrate the Database as well and it would be more of an issue when the Database is WID (Windows Internal Database) since there&rsquo;s no much documentation about troubleshooting issues involving WID on ADFS.</p><p>I have got a request from a client whom have done a migration with another consultant and obviously it was not done right. </p><h2>Symptoms </h2><p>On Windows 2016 ADFS when trying to update the ADFS SSL certificate I get the following error:</p><h5>Set-AdfsSslCertificate -ThumbPrint A7etc : PS0159 : The Operation is not supported at the current Farm Behavior Level &lsquo;1&rsquo;. Raise the farm to at least version &lsquo;2&rsquo; before retrying.</h5><p>At line:1 char:1 </p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/clip_image001-1.png"><img width="844" height="117" title="clip_image001" style="display: inline; background-image: none;" alt="clip_image001" src="https://www.moh10ly.com/wp-content/uploads/2020/01/clip_image001_thumb-1.png" border="0"></a> 
</p><div> 
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2529 " id="quads-ad2529" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>
 </div><p>Trying to update the database from 1 to 2,3 will also fail with the following error:</p><p>Invoke-AdfsFarmBehaviorLevelRaise </p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-14.png"><img width="868" height="512" title="image" style="margin: 0px; display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-14.png" border="0"></a></p><h2>Error:</h2><p>Database upgrade cannot be performed on AdfsServer.domain.com. Error: A database for the target behavior level already exists.</p><p>
<p></p>
</p><h2>Troubleshooting:</h2><p>If you&rsquo;re installing ADFS on WID (Windows Internal Database) you should run the following to get the database name/Connect String</p><h5></h5><h2>On ADFS Server </h2><p>Open Windows PowerShell
</p><ol>
<li>Enter the following:
<div>::CODECOLORER_BLOCK_1::</div>
<p>and hit Enter</p>
</li><li>Enter the following:
<div>::CODECOLORER_BLOCK_2::</div>
<p>and hit enter.</p>
</li><li>You should see the connect string information.</li>
</ol><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-15.png"><img width="1028" height="150" title="image" style="margin: 0px; display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-15.png" border="0"></a></p><p>Go to Service Console and stop ADFS Service or from Powershell type <strong>Net stop adfssrv</strong> </p><p>Run <strong>SQL Server 2017 Database Engine Tuning Advisor </strong> as an administrator</p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/clip_image0014.png"><img width="819" height="318" title="clip_image001[4]" style="margin: 0px; display: inline; background-image: none;" alt="clip_image001[4]" src="https://www.moh10ly.com/wp-content/uploads/2020/01/clip_image0014_thumb.png" border="0"></a></p><p>Use the Server name as this</p><p><a href="file://%5C%5C.%5Cpipe%5CMICROSOFT##WID%5Ctsql%5Cquery">\\.\pipe\MICROSOFT##WID\tsql\query</a></p><p>As for Authentication, Use the Windows Authentication with the user you&rsquo;re logged into if you know that&rsquo;s a privileged user and can authenticate, If not try with a user which you&rsquo;ve done the upgrade of ADFS with.</p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-16.png"><img width="1028" height="542" title="image" style="margin: 0px; display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-16.png" border="0"></a></p><p>After authenticating, You will be able to see AdfsConfiguration , AdfsConfigurationV3 and AdfsArtifactStore. What we need to see is that AdfsConfigurationV3 has data in it and is not totally empty. </p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/clip_image0016.png"><img width="1028" height="604" title="clip_image001[6]" style="margin: 0px; display: inline; background-image: none;" alt="clip_image001[6]" src="https://www.moh10ly.com/wp-content/uploads/2020/01/clip_image0016_thumb.png" border="0"></a></p><p>After checking and comparing the size between V1 and V3, It appeared that V3 database is empty. So what next? </p><h2>Solution</h2><p>Deleting the AdfsConfigurationV3 was the first thought that hit my mind however, before deleting anything I always take a snapshot of the VM since backing up the WID is more painful and takes more time than simply backing up the VM (Checkpoint, Snapshot). </p><p>So the steps to fix this issue is </p><ul>
<li>Taking a VM Snapshot/Checkpoint/Backup.</li>
<li>Download Microsoft SQL Server Management Studio from this link <a title="https://go.microsoft.com/fwlink/?linkid=864329" href="https://go.microsoft.com/fwlink/?linkid=864329">https://go.microsoft.com/fwlink/?linkid=864329</a></li>
<li>Install Microsoft SQL Server Management Studio on ADFS Server</li>
<li>Run MS SQL Server Management Studio as Administrator</li>
<li>In the Server Name type :</li>
</ul><blockquote>
<p><a href="file://%5C%5C.%5Cpipe%5CMICROSOFT##WID%5Ctsql%5Cquery">\\.\pipe\MICROSOFT##WID\tsql\query</a></p>
</blockquote><p>Leave the Authentication as it is and logon. </p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-17.png"><img width="1028" height="609" title="image" style="display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-17.png" border="0"></a></p><ul>
<li>From the SQL Object Explorer right click and Delete the AdfsConfigurationV3 and leave AdfsConfiguration Database only. </li>
</ul><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-18.png"><img width="1028" height="482" title="image" style="margin: 0px; display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-18.png" border="0"></a></p><ul>
<li>After deleting the Database, Start ADFS Service to make sure that it can load the old database without an issue.</li>
<li>Then run the cmdlet Invoke-AdfsFarmBehaviorLevelRaise and Accept by typing Y and Enter.</li>
</ul><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-19.png"><img width="1028" height="743" title="image" style="margin: 0px; display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-19.png" border="0"></a></p><p>This might take about 5 minutes to finish.</p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-20.png"><img width="1028" height="745" title="image" style="display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-20.png" border="0"></a></p><p>When this process is done, You should see the following message indicating the success of the Database Upgrade. </p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-21.png"><img width="654" height="69" title="image" style="margin: 0px; display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-21.png" border="0"></a></p><p>To double check, We will run the cmdlet Get-AdfsFarmInformation</p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-22.png"><img width="658" height="117" title="image" style="margin: 0px; display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-22.png" border="0"></a></p><h2>Updating Certificate </h2><p>After this success, I am going to run the cmdlet below to replace the current certificate with the new one</p><p>Set-AdfsSslCertificate -Thumbprint 9b19426e17180c0b9c5d4atye53dda3bce9dbff</p><p>And here we go. It works perfectly fine</p><p><a href="https://www.moh10ly.com/wp-content/uploads/2020/01/image-23.png"><img width="974" height="138" title="image" style="margin: 0px; display: inline; background-image: none;" alt="image" src="https://www.moh10ly.com/wp-content/uploads/2020/01/image_thumb-23.png" border="0"></a></p><p>References: </p><p><a href="https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/troubleshooting/ad-fs-tshoot-sql">https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/troubleshooting/ad-fs-tshoot-sql</a></p><div> 
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2524 " id="quads-ad2524" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>
 </div><p><a href="https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/design/federation-server-farm-using-sql-server">https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/design/federation-server-farm-using-sql-server</a></p></div>

<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2523 " id="quads-ad2523" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>


Reset and manage your Active Directory users' Passwords Active Directory is one of the most…
Finding Exchange Database hidden mailboxes. Story:Maybe you have been in this situation before, trying to…
If you're using a Proxy server in your firewall or in your network and have…
Story:I got some clients that have reported some of their users being locked out and…
Delegate Permissions This is a code that I have wrote recently to check if an…
Story: I got a request from a client who constantly gets CVs and have to…