<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PhishThis! &#187; SQL Server</title>
	<atom:link href="http://www.phishthis.com/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phishthis.com</link>
	<description></description>
	<lastBuildDate>Tue, 22 Feb 2011 05:48:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>How to give a user account rights to register its own Service Principal Name (SPN)</title>
		<link>http://www.phishthis.com/2009/12/30/how-to-give-a-user-account-rights-to-register-its-own-service-principal-name-spn/</link>
		<comments>http://www.phishthis.com/2009/12/30/how-to-give-a-user-account-rights-to-register-its-own-service-principal-name-spn/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 18:05:33 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Kerberos]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[ServicePrincipalName]]></category>
		<category><![CDATA[SPN]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.phishthis.com/?p=146</guid>
		<description><![CDATA[<p>I recently had a SQL server where the SQL instance had a different name than the hostname. Not having rights to connect to SQL, I wasn&#8217;t aware of that. So, I registered the SPNs as they should have been registered, and it was still falling back to NTLM (see: failing). </p> <p>SQL Server will [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a SQL server where the SQL instance had a different name than the hostname. Not having rights to connect to SQL, I wasn&#8217;t aware of that. So, I registered the SPNs as they should have been registered, and it was still falling back to NTLM (see: failing). </p>
<p>SQL Server will register its own SPNs at startup &#8211; assuming the service account has rights to set its own SPN. To give the service account rights to self-register SPN (assuming you&#8217;re using a domain service account and not Network Service/Local System), you need to grant the service account rights to &#8220;Write Public Information&#8221; on itself in Active Directory.</p>
<p>1) Launch Active Directory Users and Computers<br />
2) Find your service account and hit the <b>Security</b> tab<br />
3) Select <strong>&#8220;SELF&#8221;</strong> in the <strong>&#8220;Groups or user names&#8221;</strong> listbox<br />
4) Find <strong>&#8220;Write public information&#8221;</strong> in the <strong>&#8220;Permissions for SELF&#8221;</strong> listbox and check <strong>&#8220;Allow&#8221;</strong><br />
5) Click OK</p>
<p><a href="http://www.phishthis.com/wp-content/uploads/2009/12/WritePublicInformation.png"><img src="http://www.phishthis.com/wp-content/uploads/2009/12/WritePublicInformation-231x299.png" alt="" title="WritePublicInformation" width="231" height="299" class="size-medium wp-image-147" /></a><br />
After, you&#8217;ll need to restart SQL Server for the SPN to register. Use <b>setspn -l domain\account</b> to verify that the account has properly registered. </p>
<p>If you do happen to be using Network Service or Local System, shame on you. That said you&#8217;ll just need to verify on the computer account in AD that SELF has &#8220;Validated write to service principal name&#8221; set to Allow. But, seriously, stop using Network Service or Local System (ESPECIALLY THAT!) and start using a domain account&#8230;or at the very least a local account. </p>
<p><DIV style="MARGIN-TOP: 10px; HEIGHT: 15px" class=zemanta-pixie><A class=zemanta-pixie-a title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/a789ff5a-54b4-4143-b96c-8931c8c8d0f5/"><IMG style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; FLOAT: right; BORDER-TOP: medium none; BORDER-RIGHT: medium none" class=zemanta-pixie-img alt="Reblog this post [with Zemanta]" src="http://img.zemanta.com/reblog_e.png?x-id=a789ff5a-54b4-4143-b96c-8931c8c8d0f5"></A><SPAN class="zem-script more-related pretty-attribution"><SCRIPT type="text/javascript" defer="defer" src="http://static.zemanta.com/readside/loader.js"></SCRIPT></SPAN></DIV></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phishthis.com/2009/12/30/how-to-give-a-user-account-rights-to-register-its-own-service-principal-name-spn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to configure AD, SQL, and IIS for two-hop Kerberos authentication</title>
		<link>http://www.phishthis.com/2009/10/24/how-to-configure-ad-sql-and-iis-for-two-hop-kerberos-authentication-2/</link>
		<comments>http://www.phishthis.com/2009/10/24/how-to-configure-ad-sql-and-iis-for-two-hop-kerberos-authentication-2/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 00:01:48 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Server Management]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[Internet Information Services]]></category>
		<category><![CDATA[Kerberos]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Web service]]></category>

		<guid isPermaLink="false">http://www.phishthis.com/?p=138</guid>
		<description><![CDATA[<p>Recently, some of our developers were writing an app that required impersonation from the web service, as the user, to the database. Admittedly, Kerberos isn&#8217;t one of my strong points.</p> <p>There were two hops here. From the user -&#62; IIS server and from IIS Server -&#62; SQL Server, but the application in IIS would [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, some of our developers were writing an app that required impersonation from the web service, as the user, to the database. Admittedly, <A class=zem_slink title="Kerberos (protocol)" href="http://en.wikipedia.org/wiki/Kerberos_%28protocol%29" rel=wikipedia>Kerberos</A> isn&#8217;t one of my strong points.</p>
<p>There were two hops here. From the user -&gt; IIS server and from IIS Server -&gt; SQL Server, but the application in IIS would impersonate the user when authenticating with the SQL server.</p>
<p>So, the idea here is that from the user to the IIS server, we know Kerberos will work. The user passes its ticket to the web service. Nothing unusual. From there, the web app, running as a custom app pool ID, needs to pretend (delegate) to be the user when it authenticates to the SQL server. </p>
<p>There are a few requirements.<br />
<strong>1) </strong>Your application in IIS should be running under a custom identity &#8211; domain\MyAppService<br />
<strong>2) </strong>SQL Server needs to be running under a domain service account &#8211; domain\MySQLService<br />
<strong>3)</strong> IIS needs to use Negotiate instead of NTLM for that application. It should do this by default, then fall back to NTLM. For whatever reason, my app was using NTLM. IIS should also have Windows Authentication enabled.<br />
<strong>4) </strong>Change your connection string to impersonate the site user</p>
<p><STRONG>Step 1</STRONG> &#8211; Set the SPN on your app pool ID for the site, for the hostname and FQDN.<br />
<CODE>setspn -a http/mysite domain\MyAppService<br />
setspn -a http/mysite.domain.com domain\MyAppService</CODE></p>
<p><STRONG>Step 2</STRONG> &#8211; Set the SPN for the SQL service on your SQL service account &#8211; assuming you use the default SQL port<br />
<CODE>setspn -a MSSQLSvc/hostname domain\MySQLService<br />
setspn -a MSSQLSvc/hostname.domain.com domain/MySQLService<br />
setspn -a MSSQLSvc/hostname:1433 domain\MySQLService<br />
setspn -a MSSQLSvc/hostname.domain.com:1433 domain/MySQLService</CODE><br />
Restart SQL</p>
<p><STRONG>Step 3</STRONG> &#8211; In Active Directory Users and Computers, find the service account, click the delegation tab, and trust it for delegation. You can set it for delegation to anywhere, or constrained delegation to the SPNs you&#8217;ll set for the SQL service account. </p>
<p><STRONG>Step 4</STRONG> &#8211; Force your site or application to use Negotiate. This won&#8217;t work with NTLM, so we&#8217;ll remove it. (Note: This is for IIS7/7.5)<br />
- Find and open your applicationHost.config. It&#8217;s probably under c:\windows\system32\inetsrv\config. You can also set this in the system.webServer section of the web.config for the application. </p>
<p>- Scroll to the bottom and above /configuration copy this in:</p>
<pre>
   &lt;location path=&quot;SitePath&quot;&gt;
        &lt;system.webServer&gt;
            &lt;security&gt;
                &lt;authentication&gt;
                    &lt;windowsAuthentication&gt;
                        &lt;providers&gt;
                            &lt;add value=&quot;Negotiate&quot; /&gt;
                            &lt;remove value=&quot;NTLM&quot; /&gt;
                        &lt;/providers&gt;
                    &lt;/windowsAuthentication&gt;
                &lt;/authentication&gt;
            &lt;/security&gt;
        &lt;/system.webServer&gt;
    &lt;/location&gt;
</pre>
<p>If you get a 500 error after adding the above XML, it&#8217;s probably because Negotiate is already added elsewhere. Just remove the line that says add value=&#8221;Negotiate&#8221; and leave the remove NTLM line. </p>
<p>Reference: This post was extremely helpful in solving my problem &#8211; <A href="http://blogs.technet.com/askds/archive/2008/06/13/understanding-kerberos-double-hop.aspx">http://blogs.technet.com/askds/archive/2008/06/13/understanding-kerberos-double-hop.aspx</A> &#8211; in the end, I did pretty much everything in that post, and still had the IIS server passing anonymous to SQL, which is what tipped me off that it was using NTLM and not Negotiate.</p>
<p><DIV style="MARGIN-TOP: 10px; HEIGHT: 15px" class=zemanta-pixie><A class=zemanta-pixie-a title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/fbffe8a7-8bb0-4ce5-9df2-afc98ab58ee0/"><IMG style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; FLOAT: right; BORDER-TOP: medium none; BORDER-RIGHT: medium none" class=zemanta-pixie-img alt="Reblog this post [with Zemanta]" src="http://img.zemanta.com/reblog_e.png?x-id=fbffe8a7-8bb0-4ce5-9df2-afc98ab58ee0"></A><SPAN class="zem-script more-related pretty-attribution"><SCRIPT type="text/javascript" defer="defer" src="http://static.zemanta.com/readside/loader.js"></SCRIPT></SPAN></DIV></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phishthis.com/2009/10/24/how-to-configure-ad-sql-and-iis-for-two-hop-kerberos-authentication-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>System Center Operations Manager 2007 and BizTalk 2006 SQL Server Warning</title>
		<link>http://www.phishthis.com/2008/01/02/system-center-operations-manager-2007-and-biztalk-2006-sql-server-warning/</link>
		<comments>http://www.phishthis.com/2008/01/02/system-center-operations-manager-2007-and-biztalk-2006-sql-server-warning/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 03:49:38 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[BizTalk Server]]></category>
		<category><![CDATA[SCOM2007]]></category>

		<guid isPermaLink="false">http://www.phishthis.com/2008/01/02/system-center-operations-manager-2007-and-biztalk-2006-sql-server-warning/</guid>
		<description><![CDATA[<p></p> <p>Well, finally a post after the chaos that was the holidays. I was on vacation for 12 days and accomplished&#8230;nothing. Except for a lot of Counterstrike. And Team Fortress 2.</p> <p></p> <p></p> <p>If you&#8217;re running SCOM 2007 and BizTalk 2006 (and have the SQL agent jobs properly configured) you may notice a warning [...]]]></description>
			<content:encoded><![CDATA[<p><!-- google_ad_section_start(weight=ignore) --></p>
<p>Well, finally a post after the chaos that was the holidays. I was on vacation for 12 days and accomplished&#8230;nothing. Except for a lot of Counterstrike. And Team Fortress 2.</p>
<p><!-- google_ad_section_end --></p>
<p><!-- google_ad_section_start --></p>
<p>If you&#8217;re running SCOM 2007 and BizTalk 2006 (and have the SQL agent jobs properly configured) you may notice a warning in SCOM that says there are long running jobs. Upon inspection, you&#8217;ll discover that a single job (ManageRefCountLog) has been running since the SQL Agent last started (or the minute immediately following). I ignored this for quite some time, leaving the alert ACK&#8217;d the whole time because I couldn&#8217;t figure out why the job was running forever&#8230;that, and everything was working fine. I finally got fed up with it today and did a little digging. The error looks like this:</p>
<p><code>There are long running jobs on SQL instance MSSQLSERVER on computer SERVER.FOO.BAR.COM. This may indicate an issue with one or more jobs.</code></p>
<p>The ManageRefCountLog job has only one step that runs a stored proc on BizTalkMsgBoxDB called bts_ManageMessageRefCountLog. If you look at the store procedure itself, you&#8217;ll see:</p>
<p><code><br />
WHILE (1 = 1)<br />
BEGIN<br />
</code></p>
<p>So, the job is supposed to run forever&#8230;or until 1 != 1. Whichever comes first.I never would have noticed this job running forever, if not for SCOM2007 + the SQL 2005 management pack. Now I just need to add an exception. I&#8217;ll do that tomorrow&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phishthis.com/2008/01/02/system-center-operations-manager-2007-and-biztalk-2006-sql-server-warning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving Microsoft BizTalk Server 2006 Databases to a new SQL Server</title>
		<link>http://www.phishthis.com/2007/09/06/migrating-biztalk-databases-to-a-new-sql-server/</link>
		<comments>http://www.phishthis.com/2007/09/06/migrating-biztalk-databases-to-a-new-sql-server/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 01:19:28 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[BizTalk Server]]></category>

		<guid isPermaLink="false">http://www.phishthis.com/?p=5</guid>
		<description><![CDATA[<p>So, for whatever reason you need to move your BizTalk databases from one SQL server to another. In my case, I was moving from a hostname to a CNAME, for DR purposes (failover server is in another DC, and not clustered).</p> <p>In the event of a disaster, we could just fail over to the [...]]]></description>
			<content:encoded><![CDATA[<p><font ="Georgia">So, for whatever reason you need to move your BizTalk databases from one SQL server to another. In my case, I was moving from a hostname to a CNAME, for DR purposes (failover server is in another DC, and not clustered).</font></p>
<p><font ="Georgia">In the event of a disaster, we could just fail over to the other database server, change the CNAME to point to the &#8220;failover&#8221; server, and we should be back up and running. The problem, I found, was changing from DC1BTSQL1 to the CNAME (we&#8217;ll call it BTSQL1). After searching for a while (maybe I&#8217;m an idiot, but all of these things were classified as &#8220;backup and restore methods&#8221; not &#8220;I&#8217;m changing server name&#8221; methods or anything like that) I found two scripts and an xml file.</font></p>
<p><font ="Georgia">Under %systemdrive%\Program Files\Microsoft Biztalk Server 2006\Schema\Restore are two VBS scripts. UpdateDatabase.vbs and UpdateRegistry.vbs. There&#8217;s also an XML file called &#8220;SampleUpdateInfo.xml.&#8221; Below is the procedure for changing the SQL server name. You can even change the names of the DBs. This procudure assumes you&#8217;ve backed up and restored, or attached, the DBs to the &#8220;new&#8221; server already.</font></p>
<p><span id="more-5"></span><br />
<font ="Georgia"><font ="Georgia"><span></span></font></font><font ="Georgia"><font ="Georgia"><span><br />
1) Stop BizTalk Service on BizTalk Server<br />
2) Stop Enterprise SSO Service on BizTalk Server<br />
3) Edit C:\Program Files\Microsoft BizTalk Server 2006\Schema\Restore\SampleUpdateInfo.xml<br />
     a. Do a “Replace All” and change SourceServer to DC1BTSQL1<br />
     b. Do a “Replace All” and change DestinationServer to BTSQL1<br />
     c. Uncomment the ruleenginedb node<br />
     d. Uncomment the HWS Administration DB node<br />
     e. Save it.<br />
4) Drop to a command prompt and go to C:\Program Files\Microsoft BizTalk Server 2006\Schema\Restore<br />
     a. Run cscript UpdateDatabase.vbs SampleUpdateInfo.xml<br />
     b. Run cscript UpdateRegistry.vbs SampleUpdateInfo.xml<br />
5) Restart Enterprise SSO Service<br />
6) Restart BizTalk Service<br />
7) Check BizTalk Configuration to verify that the database server is set to BTSQL1 for all configured options.<br />
8 ) Rejoice.</span></font></font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phishthis.com/2007/09/06/migrating-biztalk-databases-to-a-new-sql-server/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

