MLClient Authentication Issue

Kush Shah 0 Reputation points
2023-10-27T02:17:36.2533333+00:00

I am trying to upload data from a local file to ML Studio

credential = DefaultAzureCredential(managed_identity_client_id="")
subscription_id = ""
resource_group = ""
workspace = ""
ml_client = MLClient(credential, subscription_id, resource_group, workspace)

my_data = Data(    path=mltable_folder,    type=AssetTypes.MLTABLE,    description="",    name="Training_Data_10262023",    version="1",)

ml_client.data.create_or_update(my_data)

In my azure account:

  1. I have a managed Identity setup to subscription "A" and Resource Group "B" with a client ID
  2. I also have a App registered to the same tenant ID but this has a different Application (client) ID

I am getting the below error when I try to authenticate using the python sdk for ML Studio.

ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
Attempted credentials:
	EnvironmentCredential: Authentication failed: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1076)
To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.
				

Which client ID should I be using and is there a step I am missing in my setup to authenticate? I have these User variables setup as well.

Azure Machine Learning
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. santoshkc 15,600 Reputation points Microsoft External Staff Moderator
    2023-10-27T12:25:31.28+00:00

    Hi @Kush Shah ,

    Thank you for reaching out of Microsoft Q&A!

    I understand that you are trying to upload data from a local file to ML Studio using the Python SDK, but you are receiving "ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials". I will help you in this regard.

    As per your code mentioned in the queation, the Client ID you can find in ML Studio Compute. Go to Managed identity and click on edit and a small window will appear. Then enable the Assign a managed identity and select the System-assigned and click Update. Now you can see see the Principal ID(or Client ID). see below image for more info:

    User's image

    User's image

    Follow the steps to upload data to ML Studio in the given documentation: Working with tables in Azure Machine Learning - Azure Machine Learning | Microsoft Learn

    I followed steps mention in the documentation and Iam able to successfully upload the data to ML Studio

    User's image

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

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