<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Random ramblings about Technology : Team Foundation Server</title><link>http://blogs.msdn.com/martijnh/archive/tags/Team+Foundation+Server/default.aspx</link><description>Tags: Team Foundation Server</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Running Virtual Machines under alternate user credentials on a Domain Controller</title><link>http://blogs.msdn.com/martijnh/archive/2008/05/02/running-virtual-machines-under-alternate-user-credentials-on-a-domain-controller.aspx</link><pubDate>Fri, 02 May 2008 16:43:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8450546</guid><dc:creator>martijnh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/martijnh/comments/8450546.aspx</comments><wfw:commentRss>http://blogs.msdn.com/martijnh/commentrss.aspx?PostID=8450546</wfw:commentRss><description>&lt;h2 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="4"&gt;Introduction&lt;/font&gt;&lt;/strong&gt;&lt;/h2&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Recently, I was experimenting with Team Foundation Server 2008, setting it up with SSL and running it within a test domain. For the Team Foundation Server, I couldn't use the host installation as it runs Windows Server 2003 R2 x64 edition and TFS doesn't support (see the &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ff12844f-398c-4fe9-8b0d-9e84181d9923&amp;amp;displaylang=en"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;TFS installation guide&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;, under 'Overview of Team Foundation Architecture', '64-bit Support in Team Foundation') this setup in a single server scenario. So, I installed &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bc49c7c8-4840-4e67-8dc4-1e6e218acce4&amp;amp;displaylang=en"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;Virtual Server 2005 R2 SP1&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;, installed TFS on top, configure SSL and voila, a working TFS setup. &lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;When I shut down the host computer, I want the virtual machine of TFS to save state and come back up again when the host is turned on again. This can be done in Virtual Server using an alternative use running the actual Virtual Machine instance. Trying to set this up in a least privilege way proved not to be obvious from documentation, so this blog entry documents what I did for posterity (and myself ;-)).&lt;/font&gt;&lt;/p&gt; &lt;h2 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="4"&gt;Outline&lt;/font&gt;&lt;/strong&gt;&lt;/h2&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Here's what needs to be done in order to circumvent obscure error messages:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;1.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;We need a new user group so the account we'll use doesn't belong to default domain users and inherits no permissions.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;2.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;We need a new user to run the Virtual Machine instance, the user should belong to this group only.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;3.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;The user needs to be given 'Local on locally' rights.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;4.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;Permissions need to be set on the folder containing network configuration information for Virtual Server.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;5.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;Permissions need to be set on the folder containing the Virtual Machine and the actual files (*.vhd, .vmc) making up the Virtual Machine.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;6.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;The Virtual Machine needs to be configured to use the new user.&lt;/font&gt;&lt;/p&gt; &lt;h2 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="4"&gt;Instuctions&lt;/font&gt;&lt;/strong&gt;&lt;/h2&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Let's configure the necessary elements. &lt;/font&gt;&lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;1. Create a new group&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Create a new group within the Active Directory Users and Computers MMC snapin (found under Administration Tools):&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/emptygroup_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="410" alt="emptygroup" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/emptygroup_thumb.png" width="369" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;2. Create a new user&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Create the user which is to run the specific Virtual Machine (done from the same MMC snap-in), add it to the 'empty' group, set the 'empty' group as it's Primary Group and remove the 'Domain Users' group from the list. After this, your user overview should resemble this image:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmuser_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="446" alt="vmuser" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmuser_thumb.png" width="372" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;3. Assign 'Log on locally' rights to the user&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;This step is critical in getting the Virtual Machine running under the new user context. Steps to achieve the appropriate right setting are described &lt;/font&gt;&lt;a href="http://support.microsoft.com/kb/234237"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;. If the user doesn't receive the 'Log on locally' right, Virtual Server will display an error: '&lt;i style="mso-bidi-font-style: normal"&gt;The account name and password could not be set. The virtual machine account could not be set. The account has not been granted the requested logon type.&lt;/i&gt;'. Make sure the security policy is updated before using the account.&lt;/font&gt;&lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;4. Set permissions for the used virtual network interface&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Now that we have the user and it's group configured, let's set the appropriate permissions for the user to make use of the configured network. Mind you, these instructions will only allow the user to use the network it's given access to from the instructions, the 'local network only' et al will not work as the user has no rights on the files used for those configurations.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;The virtual network configuration files for Virtual Server are stored in &lt;i style="mso-bidi-font-style: normal"&gt;%SystemDrive%\Documents and Settings\All Users\Application Data\Microsoft\Virtual Server\Virtual Networks&lt;/i&gt;. The user needs permissions as &lt;/font&gt;&lt;a href="http://www.microsoft.com/technet/prodtechnol/virtualserver/2005/proddocs/vs_operate_using_secure_vm.mspx"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;specified&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; in order to use the network. If permissions are set incorrectly, the Virtual Machine will not have network access.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/networkpermissions_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="480" alt="networkpermissions" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/networkpermissions_thumb.png" width="377" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;5. Set permissions on Virtual Machine folders and files&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;In order to start up the Virtual Machine, save state, etc, the new user needs access rights on the folder storing the actual files making up the Virtual Machine as well as specific rights on the Virtual Machine files. The folder structure containing my Virtual Machine files is:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;%SystemDrive%\vms\&amp;lt;Virtual Machine&amp;gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/i&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;First, let's set the appropriate rights on the folder hosting all Virtual Machines:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/mainvmfolderpermissions_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="486" alt="mainvmfolderpermissions" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/mainvmfolderpermissions_thumb.png" width="382" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Now, let's set the permissions for the appropriate Virtual Machine ('&lt;i style="mso-bidi-font-style: normal"&gt;tfs&lt;/i&gt;') folder:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmfolderpermissions_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="498" alt="vmfolderpermissions" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmfolderpermissions_thumb.png" width="391" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Lastly, set up permissions for the Virtual Machine files (my TFS has 3: &lt;i style="mso-bidi-font-style: normal"&gt;tfs.vmc&lt;/i&gt;, &lt;i style="mso-bidi-font-style: normal"&gt;tfs.vhd&lt;/i&gt; and &lt;i style="mso-bidi-font-style: normal"&gt;sql.vhd&lt;/i&gt;):&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmpermissions_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="509" alt="vmpermissions" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmpermissions_thumb.png" width="400" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;6. Configure the Virtual Machine&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;All permissions are set, we're ready to configure Virtual Server to run the Virtual Machine under the new user context:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/configure%20virtual%20machine_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="369" alt="configure virtual machine" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/configure%20virtual%20machine_thumb.png" width="822" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;Wrap up&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;That's it! We've configured the Virtual Machine to run under a user context which has the least amount of privileges it needs to function correctly. The Virtual Machine will save it's state when the host is shut down and will automatically turn back on when the host comes back online.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;HTH&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8450546" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/martijnh/archive/tags/Team+Foundation+Server/default.aspx">Team Foundation Server</category><category domain="http://blogs.msdn.com/martijnh/archive/tags/Active+Directory/default.aspx">Active Directory</category><category domain="http://blogs.msdn.com/martijnh/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/martijnh/archive/tags/TFS/default.aspx">TFS</category></item></channel></rss>