8

Having set-up a TFS server, I subsequently decided to rename the server (it is on a VM so it's been renamed for network purposes). When I now go into TFS Management Console on the server, I'm getting:

SQL Access Denied

For Server URL, Noritifcation URL and various other settings. Obviously this is caused by them still looking for the SQL Server instance at the old server name. My question is: can I change this, or does it require a re-install of TFS Server?

I'm running TFS Server 2013 on Windows Server 2008-R2.

Below is a screenshot; the areas in blue are showing the old server name still.

enter image description here

EDIT:

Following @DanBig's suggestion and link below, the access denied message is now resolved (the key was editing the web.config file in the TFS directory). However, The application tier is now pointing at the old server name (this time highlighted in yellow below):

enter image description here

Paul Michaels
  • 215
  • 3
  • 12

1 Answers1

13

Login to SQL server through Management Studio and run this:

select @@servername

The output will likely reflect the old hostname of the server. If so, run this script, and restart the service.

exec sp_dropserver '<oldhostname>\instance'
go
exec sp_addserver '<newhostname>\instance' , local
go

Once the service is restarted, open a new query and run the first script again, it should now reflect the new hostname.

To change the data and applcation tier settings, you need to edit web.config for each.

App tier: C:\Program Files\Microsoft\"tfs dir"\Application Tier\Web Services\web.config

<add key="applicationDatabase" value="Data Source=**computer_name**;Initial Catalog=Tfs_Configuration;Integrated Security=True;" />
DanBig
  • 11,393
  • 1
  • 28
  • 53
  • Whilst that certainly did work in changing the servername for SQL, TFS is still listing the data tier as the old server name, and it still gives an error saying that it can't access the DB. – Paul Michaels Feb 05 '14 at 08:59
  • 1
    Take a look at this link. http://msdn.microsoft.com/en-us/library/ee248587(v=vs.100).aspx – DanBig Feb 05 '14 at 13:15
  • Many thanks for this. I think it got me 80% of the way there; I've edited my post with what happened after following that document. – Paul Michaels Feb 05 '14 at 16:06
  • I'm not particularly sure why, but restarting the server a few times seems to have corrected this – Paul Michaels Feb 12 '14 at 12:06
  • Nice answer. Truly helped me. I wish I could plus many times. – Saeed Neamati Mar 30 '15 at 06:49
  • ***Addition to the above answer for those using Team Foundation Server 2015.*** Team Foundation Server 2013 & Below: > App tier: C:\Program Files\Microsoft\"tfs dir"\Application Tier\Web > Services\web.config Team Foundation Server 2015: > App tier: C:\Program Files\Microsoft Team Foundation Server 14.0\Application > Tier\Web Services – Cassidy Keyser Apr 12 '16 at 17:12