Microsoft has introduced the option to invite AAD users into MSA backed Azure DevOps accounts. This is great for companies that are transitioning accounts over from "unmanaged" to "managed", starting with transferring account ownership to an AAD user and then fixing the user and licensing mess in a slower approach.
However, when I try to clone a repository using Visual Studio 2017 or 2019, I'm greeted with an error message:
Git failed with a fatal error. Authentication failed for: {remote-url}.
or, depending on which version of the Git credential manager you have:
error: cannot spawn askpass: No such file or directory fatal: could not read Username for '{remote-url}': terminal prompts disabled`
When cloning from the command line, there are no issues and afterward, Visual Studio can also use the resulting git repository.
Update
Update your global git config to point to a specific implementation of the Git credential Manager:
Update the
[credential]
section to read:Ensure the path points to where the latest Git Credential Manager can be found on your system. Mind all of the escapes needed to make paths work in the global git config.
It turns out that Visual Studio 2017 (as of 15.9.7) and 2019 (preview 3) still ship with version 1.17 of the Git Credential Manager and they don't use a globally installed version when available.
You can check whether you have an "old" version in the following locations:
If they're not on version 1.18.4, then they don't have the required fix for AAD authentication in MSA backed accounts.
If you have the correct version you should see:
Fix
To fix Visual Studio you can overwrite the binaries in the above locations with the files in the latest release zip of the Git Credential Manager:
You'll need to re-apply these files each time you upgrade to a newer update/preview until Microsoft decides to ship the latest version as part of Visual Studio, unfortunately. The Visual Studio Installer will stubbornly overwrite it with the 1.17 version.