TF31002: Unable to connect

TFS 2017 | TFS 2015 | TFS 2013

You might receive this error when you try to connect to Azure DevOps Services or an on-premises Azure DevOps Server from Visual Studio.

You receive this error when you try to connect to Azure DevOps Services

Problem Resolution
You don't have an active account or license. Check with your administrator that you're a member of the account and have an active, valid license. See Assign licenses to users for details.
Your Azure DevOps Services organization is connected to the Azure Active Directory. When your Azure DevOps Services organization is connected to a directory that is associated with a Microsoft 365 or Microsoft Azure subscription, only members in the directory can access the account.

Check with your directory administrator to have them create an organizational account for you or add your account to the directory as external member.
You can't switch between different organizational accounts. If you work with several organizations that connect to different directories, such as accounts created from the Microsoft Azure Portal, the sign-out function might not work as expected. For example, you can't switch between different organizational accounts to connect to multiple accounts that are linked to directory tenants.

When this problem occurs, you see a flashing blank sign in dialog box several times. Then, you receive either TF31002 or TF31003 error after you connect to or add a new connection in "Connect to Team Foundation Server" dialog box.

To resolve this problem, apply the most recent Visual Studio update .

To learn more, see You can't switch between different organizational accounts in Visual Studio Online.
You want to sign in to Azure DevOps Services from Visual Studio using different credentials. See Connect to projects, Sign in with different credentials.

When you try to connect to an on-premises Azure DevOps Server from your client computer

If you determine that you're receiving this error from one computer but not others, or others aren't receiving this error, then check the problem resolutions that are outlined below.

Problem Resolution
Your password has expired. Verify that you entered your user ID and password correctly, and that your password hasn't expired.
You've entered an incorrect server URL. Verify that you've entered the server URL correctly including the server name, port number, and protocol (http/https). See Connect to projects to learn more.
The TFS configuration has changed. If the configuration for the on-premises Azure DevOps Server has changed, you must create a new connection. You might also need to clear the client cache.
You work remotely and need to connect to a TFS Proxy server to check in files to Team Foundation version control. Configure Visual Studio to connect to TFS Proxy.
You're connecting to a later version of TFS than your Visual Studio client version. Your version of Visual Studio or Team Explorer might be incompatible with Team Foundation Server. You might need to install one or more GDR packs. See Requirements and compatibility for details.
Your firewall is blocking TFS services. See Allow a program to communicate through Windows Firewall.
Visual Studio stops responding when you run a query in Visual Studio. Your computer might be configured to bypass the proxy server. Verify the configuration of the BypassProxyOnLocal setting on your computer. For more information, see BypassProxyOnLocal Configuration.

Several users can't connect to an on-premises Azure DevOps Server

If the problem occurs on more than one computer, contact your administrator to confirm whether the server is operational and available on the network.

As an administrator, check the event logs for the application-tier server to try to pinpoint the problem. Also, you can use the following table to determine whether the server is misconfigured. In the table, problems that are more likely to occur appear first. Try the resolutions in the order in which they appear, which increases the chance that you can solve the problem quickly.

Problem Resolution
The TFSService account password has expired or is incorrect. Many services for Team Foundation Server will stop running when the service account for Team Foundation has expired. For more information, see Change the service account or password for Team Foundation Server.
The application-tier server for Team Foundation is unavailable. Verify whether each required service is running. If a required service isn't running, you must restart it. If necessary, set it to start automatically. For more information, see Stop and start services, application pools, and websites.
The network is unavailable. Verify whether your network is operational.
A website identity for Team Foundation is configured incorrectly. Verify or correct the server binding assignments that are made to websites for Team Foundation.
Access to a website for Team Foundation has been restricted. Verify or correct restrictions that are made to those websites that are based on IP addresses and domain names.
The firewall or ports are configured incorrectly. Verify or correct port binding assignments for websites and port assignments for the firewall. First, you should open the administration console for Team Foundation, display the Application Tier page, and review the URL assignments. If necessary, you can click Change URL to modify the URL of a website. Next, you should verify the port assignments for Internet Information Services (IIS) and the ports that are allowed through the firewall. For more information, see Review Server Status and Settings and Verify or Correct Port Assignments.
Trust relationships between domains aren't configured correctly. If a group of users can't access Team Foundation Server, you might have trust issues between domains.
When users connect to different versions of TFS from Visual Studio, for example, they connect to TFS 2012 and then TFS 2008, they can get the TF31002 error. This error can occur because the GUIDs for the TFS 2012 collection are the same as TFS 2008. The local client cache gets confused because it tries to maintain the same GUID-based local cache for both the 2008 server and the new Project Collection in 2012.

To fix, run the TFSConfig ChangeServerID command. See TFSConfig ChangeServerID command.