If you plan to install Team Foundation Server using a single-server deployment with Active Directory on the same computer, you must first install Active Directory before installing Internet Information Services and everything else for that matter. Failure to do so will cause problems with Windows SharePoint Services. For more information, see Troubleshooting Installation Issues:
Running Windows SharePoint Services on a Domain Controller
I installed Windows SharePoint Services to a computer, and then made the computer a domain controller. Now when I go to SharePoint Central Administration or to a page in my SharePoint site, I see a "file not found" error, or an "access denied" error.
In order for the permissions for Windows SharePoint Services to be configured correctly, Internet Information Services (IIS) and Windows SharePoint Services must be installed to the domain controller after it is promoted to domain controller. If you have already installed IIS and Windows SharePoint Services to a computer, and you now need to make that computer a domain controller, you must uninstall IIS and Windows SharePoint Services, promote the computer to domain controller, and then reinstall IIS and Windows SharePoint Services. For more information about running IIS on a domain controller, see the IIS documentation.