Reconfigure agents to connect to a new public url for TFS

In case the public url changes for your connection to a TFS on-prem environment, you might have a lot of work to reconfigure all connected agents.

Recently I was guiding a customer to expose their TFS environment only via https instead of http and for that reason all existing agents had to be reconfigured. Instead of running the configuration wizard manually for all agents, there’s a better/faster approach to accomplish this.

Scan for the .agent and .credentials files and update the serverUrl and authorizationUrl values.

Afterwards, just restart the service(s) and all agents will reconnect to the TFS environment, ready for picking up the next build/release requests.