Install Python package from Azure Artifacts on Databricks cluster

Sypula, Aleksandra 0 Reputation points
2023-10-11T13:34:57.6933333+00:00

Hello,

I would like to install a Python package that is located in the Azure DevOps Artifacts feeds on a databricks cluster. Right now I can install it using the pip install command with the --extra-index-url and providing the url to the package with my personal access token. How can this be done but without a personal access token but other means of authentication? Can a service principal be used in the place of the PAT?
Will the command also look like pip install --extra-index-url='https://{personal_access_token}@pkgs.dev.azure.com/{space}/_packaging/{rest}'

Many thanks in advance,
Ola

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,514 questions
{count} votes

1 answer

Sort by: Most helpful
  1. QuantumCache 20,366 Reputation points Moderator
    2023-10-11T16:32:25.7566667+00:00

    Hello @Sypula, Aleksandra,

    Did you see the below note?

    https://learn.microsoft.com/en-us/azure/devops/artifacts/quickstarts/python-packages?view=azure-devops

    User's image

    I have not tried the Service Principal route, but you may try the below suggestion!
    Need to create a service principal in Azure DevOps and grant it access to the Artifacts feed. Then, you can use the --extra-index-url option with the URL of the Artifacts feed and the --user and --password options with the service principal credentials to authenticate and install the package.

    The command will look like this:

    pip install --extra-index-url=https://pkgs.dev.azure.com/{organization}/_packaging/{feed}/pypi/simple/ --user {service_principal_id} --password {service_principal_secret} {package_name}
    

    Replace {organization} with the name of your Azure DevOps organization, {feed} with the name of your Artifacts feed, {service_principal_id} with the ID of your service principal, {service_principal_secret} with the secret of your service principal, and {package_name} with the name of the Python package you want to install.

    I hope this helps! Let me know if this helps with initial query!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.