Skip to content

Unable to install packages from Azure DevOps private repo, 401 unauthorized #3344

@FilBot3

Description

@FilBot3

I am trying to install from an Azure DevOps Artifacts Python feed. I can publish to the feed if I use the following:

poetry publish \
  --repository 'azure' \
  --username 'orgname' \
  --password "$(cat ~/azdo_pat.txt)" \
  --build

Which I set up by doing:

poetry config \
  --local \
  repostiory.azure \
  https://pkgs.dev.azure.com/${ORG_NAME}/${PROJECT_NAME}/_packaging/python-azure-artifacts/pypi/simple/

So then my poetry.toml has:

[repositories]
[repositories.azure]
url = "https://pkgs.dev.azure.com/${ORG_NAME}/${PROJECT_NAME}/_packaging/python-azure-artifacts/pypi/simple/"

My pyproject.toml has this section added to it.

[[tool.poetry.source]]
name = "azure"
url = "https://pkgs.dev.azure.com/${ORG_NAME}/${ROFJECT_NAME}/_packaging/python-azure-artifacts/pypi/simple/"
secondary = true

Now, when ever I attempt to do anything with a package, I get 401 unauthorized errors. I had issues before with publishing to the feed when configuring the http-basic.azure before.

poetry add azdo                                                                                           2 ↵

RepositoryError

401 Client Error:  for url: https://pkgs.dev.azure.com/${ORG_NAME}/${PROJECT_NAME}/_packaging/python-azure-artifacts/pypi/simple/azdo/

at ~/.poetry/lib/poetry/repositories/legacy_repository.py:393 in _get
389│             if response.status_code == 404:
390│                 return
391│             response.raise_for_status()
392│         except requests.HTTPError as e:
→ 393│             raise RepositoryError(e)
394│
395│         if response.status_code in (401, 403):
396│             self._log(
397│                 "Authorization error accessing {url}".format(url=url), level="warn"

What do I need to do to make the add or install portion work now?

My pyproject.toml

[tool.poetry]
name = "developer.dudley.terraform_stuff"
version = "0.1.0"
description = "Python Tasks for the project"
authors = ["Phillip Dudley <Predatorian3@gmail.com>"]
license = "MIT"

[[tool.poetry.source]]
name = "azure"
url = "https://pkgs.dev.azure.com/${ORG_NAME}/${ROFJECT_NAME}/_packaging/python-azure-artifacts/pypi/simple/"
secondary = true

[tool.poetry.dependencies]
python = "^3.8"
invoke = "^1.4.1"

[tool.poetry.dev-dependencies]
keyring = "^21.5.0"
artifacts-keyring = "^0.2.10"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

Poetry Version

poetry -V
Poetry version 1.1.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions