pythonazureazure-devopsuv.netrc

What the proper way to store PAT from azure registry for UV?


In poetry I configured my registries with

poetry config http-basic.my-private-registry my-org $PAT

uv seems like using .netrc but I could not configure successefully.

I tried .netrc like this but I get 401 error

machine pkgs.dev.azure.com/my-org
    login my-org
    password <PAT>

Solution

  • 401 Unauthorized error typically means that the registry did not accept the credentials.

    For Azure Artifacts or Azure DevOps registries, your .netrc entry should look like below:

    enter image description here

    When generating the PAT in Azure DevOps, Packaging (Read) for reading artifacts. add Packaging (Write) if you plan to push packages.

    enter image description here

    [tool.poetry.source]
    name = "my-private-registry"
    url = "https://pkgs.dev.azure.com/my-org/_packaging/my-feed-name/pypi/simple/"
    secondary = true
    

    Verify the credentials work, use curl to test.