artifacts-keyring icon indicating copy to clipboard operation
artifacts-keyring copied to clipboard

Move from PATs to Microsoft Entra tokens?

Open demoray opened this issue 5 months ago • 4 comments

Currently, the use of artifacts-keyring uses creates personal access tokens (PATs) on use. The documentation for authenticating to Azure Devops with personal access tokens has the following "Important" warning text:

We recommend the more secure Microsoft Entra tokens over higher-risk personal access tokens. Learn more about our efforts to reduce PAT usage. Review our authentication guidance to choose the right authentication mechanism for your needs.

Is there a plan to move away from managing PATs to leveraging Microsoft Entra tokens?

demoray avatar Jul 02 '25 20:07 demoray

This work is planned, but there are changes we need to make to our downstream dependencies such as the MSAL broker on macOS before this can be broadly supported.

See https://github.com/microsoft/artifacts-credprovider/issues/543#issuecomment-2648855539 for more info.

cobya avatar Jul 03 '25 21:07 cobya

For environments where macOS isn't an issue, is there a short term solution?

PATs are generating SFI warnings for us.

demoray avatar Jul 03 '25 23:07 demoray

@demoray use ARTIFACTS_CREDENTIALPROVIDER_FEED_ENDPOINTS env var, and configure authentication on behalf of Entra App through a certificate. You'll need to add the application's service principal into ADO organization and grant it access to the artifacts feed (Contributor access is preferred, so that it can proxy missing packages from PyPI).

See https://github.com/microsoft/artifacts-credprovider?tab=readme-ov-file#environment-variables

greatvovan avatar Aug 26 '25 17:08 greatvovan

You might also be able to use NUGET_CREDENTIALPROVIDER_VSTS_TOKENTYPE set to SelfDescribing to generate JWTs, according to https://github.com/microsoft/artifacts-credprovider.

I've not tried this, but it sounds promising.

austindonnelly avatar Sep 11 '25 08:09 austindonnelly