Azure-devops-docs: Option 2 docs not complete

Created on 17 Feb 2020  Â·  3Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

Option two does not show how to manually set up the credentials. For running headless installs such as a dockerized application or perhaps installing dependencies on a build server; we need the ability to use the access token. Where did the setup for the Access Token go? It used to be on the Python page. This is no longer the case. Please update the docs to include how to do this.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 devops-artifacttech devopprod doc-bug

Most helpful comment

I just ran into the same problem and I agree that the docs need to fleshed out still. But in the meantime creating and using a new personal access token that had read permissions on the artifact feed worked for me.

Steps:

  1. In Azure DevOps create a new personal access token (PAT) by clicking on "Personal Access Token" under the user settings icon in the upper right-hand corner of the screen.
  2. Under the **Packaging** section select Read.
  3. Click "Create" to create the token.

To use the token in your virtual environment create a pip.ini/pip.conf file in your virtualenv root and paste in the suggested url with the PAT included like so:

[global]
extra-index-url=https://<your_feed>:<your_PAT>@pkgs.dev.azure.com/<your_organization>/_packaging/<your_feed>/pypi/simple/

Now pip install <package> should work without requiring user input.

All 3 comments

I just ran into the same problem and I agree that the docs need to fleshed out still. But in the meantime creating and using a new personal access token that had read permissions on the artifact feed worked for me.

Steps:

  1. In Azure DevOps create a new personal access token (PAT) by clicking on "Personal Access Token" under the user settings icon in the upper right-hand corner of the screen.
  2. Under the **Packaging** section select Read.
  3. Click "Create" to create the token.

To use the token in your virtual environment create a pip.ini/pip.conf file in your virtualenv root and paste in the suggested url with the PAT included like so:

[global]
extra-index-url=https://<your_feed>:<your_PAT>@pkgs.dev.azure.com/<your_organization>/_packaging/<your_feed>/pypi/simple/

Now pip install <package> should work without requiring user input.

You're a life saver @MaxTaggart ! Your solution just about worked for me, with a slight tweak since Devops is defaulting to project based feeds these days:

[global]
extra-index-url=https://{feed_name}:{PAT}@pkgs.dev.azure.com/{org_name}/{project_name}/_packaging/{feed_name}/pypi/simple/

The user name in the url of @jeffthink answer is not checked by the server as the user is taken from the PAT. It can be any string or empty. So it is

[global]
extra-index-url=https://:{PAT}@pkgs.dev.azure.com/{org_name}/{project_name}/_packaging/{feed_name}/pypi/simple/

It is also worth noting (troubleshooting etc) that the PyPI artifact index is available at

wget --user=_ --password={PAT} https://pkgs.dev.azure.com/{org_name}/{project_name}/_packaging/{feed_name}//pypi/simple/{artifact_name}

Here the user must be non-empty, which is wget specific, I guess.

Was this page helpful?
0 / 5 - 0 ratings