Use private Python packages with Azure Machine Learning - PAT Auth

G Cocci 211 Reputation points Microsoft Employee


I am trying to deploy a model on an AKS cluster in Azure Machine Learning that uses a Python package that is present as a package in a feed on Azure DevOps.
I found the following article that explains how to do this:

In the example it shows that in the Worspace.set_connection method, it passes a string as "value".
If I try to do the same in my code the following error appears:

azureml._base_sdk_common.workspace.models.machine_learning_service_error.MachineLearningServiceErrorException: (ValidationError) JSON format is expected for Properties.Value

Looking at the documentation (azureml.core.workspace.workspace) it actually says that it expects a JSON:
value: the json format serialization string of the connection details)

What format and what information should this JSON contain?


Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,667 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ramr-msft 17,641 Reputation points

    @G Cocci Thanks for the question. Please find the example for PAT passing.

    from azureml.core import Workspace  
    pat_token = input("Enter secret token")  
    ws = Workspace.from_config()  
       category = "PythonFeed",  
       target = "https://<my-org>",   
       authType = "PAT",   
       value = “\’”+pat_token+”\’”)   

    0 comments No comments