tf.exe TF30063 unauthorized (VS 2022) - azure-devops

I had to change my corporate password which we also use for Azure access. I rebooted and logged in into the account again. I can access Azure TFS from Visual Studio without a problem. However, tf.exe get . does not work anymore because apparantly I am unauthorized. I checked the internet/SO but the credential manager didn’t seem to hold any credentials I could clear and %LOCALAPPDATA%\Microsoft\ does not contain a Team Foundation folder where I could delete any cache.
When I try to use a personal access token (PAT), then instead of two "denied"s, I only get one:

Related

How to connect my GitHub Enterprise Account with Visual Studio Code

I want to know if it's possible to connect my github enterprise account of my organization to vs code, and if so how?
I know how to sign in with a normal github account on vs code but it doesn't work for github enterprise. I already looked up online but couldn't find any answers.
In the vs code settings there is an option called github enterprise: Uri. I put there the url of my github organization "github.organizationname.com" but I don't know what else I need to do.
Here's what worked for me on vs code 1.62.3.
Clone the GitHub Enterprise repo outside of vs code (ie, using git cli in a terminal or GitHub Desktop).
In vs code, open the folder containing the cloned repo.
And just like magic, it works. If you click on the source control tab in vs code, you can pull changes and make commits. Actually, it might not work quite yet if your cloned project doesn't have your personal access token saved. If you need to do that, you can find instructions in this answer to a different question
I have set it up in the vscode settings like so:
Then it asked for my personal access token. This is token can be created under "settings" -> "developer options"
see: https://docs.github.com/en/enterprise-server#3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
It is possible to login using GitHub enterprise from VS Code without using personal access token or SSH keys. User can login by SSO if session already exist in browser else will need to sign in using their credentials. One of the ways to achieve this is to install Git Credential Manager. Git Credential Manager (GCM) is a secure Git credential helper built on .NET that runs on Windows, macOS, and Linux.
Compared to Git's built-in credential helpers (Windows: wincred, macOS: osxkeychain, Linux: gnome-keyring/libsecret) which provides single-factor authentication support working on any HTTP-enabled Git repository, GCM provides multi-factor authentication support for Azure DevOps, Azure DevOps Server (formerly Team Foundation Server), GitHub, Bitbucket, and GitLab.
For installing GCM based on OS follow the given link:
https://github.com/GitCredentialManager/git-credential-manager
Once GCM is installed and you try to clone a repository you will be able to see Enterprise login page. This can be achieved by using other Git Oauth Authorized Apps such as GitHub CLI.
Another option is to access with you microsoft email and then , the Github enterprise signing option will be added in "Account" just click it and you now will have access to GithubEnterprise
Account bottom in green
more reference here is the link:
https://learn.microsoft.com/en-us/visualstudio/ide/work-with-github-accounts?view=vs-2022

Unauthorized Response from Azure DevOps

Our client is using for Azure DevOps for code repository. I've been able to connect and pull/push code for a year without issue.
I started on a new project for this client that uses the ADO Artifacts for a NuGet store. My windows login for this project is different than my ADO account so when I build the solution in VisualStudio I get asked for credentials for the NuGet store. I enter my credentials and it immediately asks me again for creds. It does this 4 or 5 times then finally fails.
Minutes to hours later, I can no longer pull/push code from the Git repos. I've tried switching to a PAT but same result. I can get into ADO through a browser and see the repositories. I'm an org admin but can't see users and permissions during this time. If I wait a few hours, it will start working again. I verified my user is NOT locked in AzureAD. I get denied on all devices (on and off client network).
I think I've fixed the issue of the NuGet authentication but does anyone know if there's a "lock out" feature in ADO that I'm missing? If so, is there a way to "unlock" the user when this happens.
The error I get back in Git seems to be a standard failed authentication:
fatal: Authentication failed for 'https://****.visualstudio.com/DefaultCollection/projectname/_git/repo-name/'

Azure Devops clone This is not a valid source path in source tree

I have managed to finally add my devops account in sourcetree using the https://orgname.visualstudio.com path
Now I am having issues cloning the repository
I am using the path that devops gives me
https://orgname#dev.azure.com/orgname/MyProject/_git/MyRepo
but I get an error saying
This is not a valid source
The details reveal authentication issues... Yet it authenticated fine when adding the account.
What is going on? Does the azure account have to be the default account?
I managed to fix this by changing from the sourcetree embedded git to my system git Tools>Options>Git>Git Version>Select System. Afterwards when trying again it prompted me to login on my organization domain with 2 factor as if logging in on the devops web app directly.
My system Git is using manager-core for the credential management which is probably not the same system which the embedded version used.
I tried the above solutions (and more) but for me what in the end solved the problem was that the git-password I first wrongly entered when I tried to access the repo had been saved in Keychain (MacOS) and when I tried again this password was used without giving me the option to type it in again. I deleted the password to the Azure DevOps project in Keychain and then got prompted to enter the password again whereafter I pasted the Personal Access Token (!!) generated in Azure Devops and it finally worked!
It could happen when you entered wrong credentials and you don't get asked again, try this:
Go to : Sourtree->Preferences->Advance (tab)
Under: "Default usernames for URLs which do not include one:" delete your wrong credentials.
Try accessing your repo again with right credentials.
This is not the issue which caused by Azure devops. No matter https://xxx.visualstudio.com, or the URL which like dev.azure.com, they should all available git source.
For me, I just try with multi different git URLs, and found the few of URLs are failed with same error with you. But it prompt This is a git repository after I exit the SourceTree and re-configure the clone with same URL which encountered the error previously.
This seems be the most common Sourcetree problem which encountered by many users, not just the URL of azure devops that you occurred.
Check this thread, and try with its recommend way:
Open source tree, Tools -> Options -> Click on Git Tab -> Update
Embedded Git.
Or, consider the method I used: exit the Sourcetree, and re-configure the clone with same URL. (Not recommend since this can not permanently solve this issue)

tf.exe authenticate for vsts

I am trying to list all the workspaces and trying to authenticate tf.exe with vsts using the below commandline.
tf workspaces /Collection: https://[account].visualstudio.com/defaultcollection /login:USername,Password
The vsts account is backed by Azure Active Directory synced with an on-prem AD.
It works fine when I have connected to the vsts from visual studio and then running the above tf.exe command without the login switch.
But, when I use the login switch for tf.exe and use the same credentials that I use in visual studio it throws
TF30063: You are not authorized to access https://[account].visualstudio.com/defaultcollection
TF30063: You are not authorized to access https://[account].visualstudio.com/defaultcollection
What I am trying to achieve is that I am going to provision a server and then not going to login to visual studio and want my tf to work as it works when logged in to the visual studio online account in the team explorer of my visual studio.
I am an admin of the vsts account and have full right on everything. If there are other ways of doing this possibly authenticate TF.exe using PAT token that would work as well.
I would use tf.exe again for a checkin command from automated builds.
Any help in solving this would be appreciated.
There is the Check in changes task in TFVC Build Tasks extension that you can use it to check in changes. Also, you can call TF command to check in changes during the build process, it uses build service account.
On the other hand, you can create a console application to check in changes through TFS API (Workspace.CheckIn method), then call this app through command line.
I was having the same issue (TF30063) when running tf.exe. For me the solution was:
Exit all running instances of Visual Studio
Rename %LocalAppData%\Microsoft\Team Foundation\7.0\Cache to %LocalAppData%\Microsoft\Team Foundation\7.0\Cache_old (or you could delete it; but I wanted to preserve the original so I had the option restore it when going back into VS). NB: the 7.0 varies according to which version of TF you're using.
Navigate to my project's folder pushd c:\projects\vsts_tfvc_repos\Project123
Run tf /collection:myinstance.visualstudio.com /workspace:%computername%
/login:myMicrosoftAccount#example.com,myPassword to initialise the session under the correct account
Thereafter, everything worked as expected...

Where do I enter my Visual Studio Team Services username and access token in GitHub Desktop?

A colleague has been having problems logging in to our Git repository hosted in Visual Studio Team Services (was Visual Studio Online) using GitHub Desktop on the Mac. He use to have access but now cannot fetch, push, etc. Yesterday my VSTS token failed and GitHub Desktop presented me with a login window where I entered a new personal access token that I generated on our project's VSTS portal. So today I thought I'd show him how to do that. I started by revoking my personal access token in the VSTS portal. Now I cannot get access nor can I see where to enter new credentials!
When I click 'sync' in GitHub Desktop here's what I see:
Authentication Failed
You may not have permission to access VisualCollectionsIOS. Check
Preferences to make sure you’re still logged in.
But the preferences have nowhere to add my VSTS username and access token.
Where in GitHub Desktop can I enter my username and access token for my Git repository hosted in a team project in VSTS?
You can update the credentials from OSX Keychain. Check the steps in this link for reference: Updating credentials from the OSX Keychain. Instead of searching for the github.com password, as the reference suggests, search for the visualstudio.com password. When the visualstudio.com password entries are deleted GitHub Desktop will prompt you for your username and personal access token again.