Authorization Failed Error

Rajitha Nellore 0 Reputation points
2025-03-07T06:58:00.6966667+00:00

I am trying to run the AzureML SDK v2 code.While trying to authenticate MLClient via DefaultAzureCredential() getting Authorization failed Error. I have AzuremL Data Scientist role as well as full contrbutor role. Please check the log.

File "C:\Users\rajitha.nelluru.conda\envs\prs-env\lib\site-packages\azure\ai\ml_restclient\v2022_10_01_preview\operations_compute_operations.py", line 684, in get

raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)       

azure.core.exceptions.HttpResponseError: (AuthorizationFailed) The client '0dae0dfa-9a0d-4999-9500-8a8656d419e2' with object id '0dae0dfa-9a0d-4999-9500-8a8656d419e2' does not have authorization to perform action 'Microsoft.MachineLearningServices/workspaces/computes/read' over scope 9e2' with object id '0dae0dfa-9a0d-4999-9500-8a8656d419e2' does not have authorization to perform action 'Microsoft.MachineLearningServices/workspaces/computes/read' over scope '/subscriptions/ff2e23ae-7d7c-4cbd-99b8-116bb94dca6e/resourceGroups/RG-ITSMLteamAMLV1toV2-DEV/providers/Microsoft.MachineLearningServices/workspaces/avadevitsmlsvc/computes/SampleSDKV2' or the scope is i

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

1 answer

Sort by: Most helpful
  1. Pavankumar Purilla 4,025 Reputation points Microsoft External Staff
    2025-03-07T23:03:20.63+00:00

    Hi Rajitha Nellore
    Greetings & Welcome to the Microsoft Q&A forum! Thank you for sharing your query. 

    The error you're encountering indicates that the Azure Active Directory (AAD) client (with object ID 0dae0dfa-9a0d-4999-9500-8a8656d419e2) does not have sufficient permissions to perform the action Microsoft.MachineLearningServices/workspaces/computes/read on the specified resource.

    Here are some steps to troubleshoot and resolve this issue:
    1.Verify Role Assignments

    Even though you mentioned having the "AzureML Data Scientist" and "Contributor" roles, ensure that these roles are assigned at the correct scope (e.g., subscription, resource group, or workspace level). The error suggests that the required permissions are missing for the specific resource.

    • Go to the Azure Portal.
    • Navigate to the Resource Group or Workspace (avadevitsmlsvc) where the resource resides.
    • Check the Access Control (IAM) settings.
    • Ensure that your user or service principal has the necessary roles assigned.
    1. Required Permissions
    • The error indicates that the action Microsoft.MachineLearningServices/workspaces/computes/read is being blocked. To resolve this:
    • Ensure that your role includes the required permissions for Machine Learning Services. The "Contributor" role should suffice, but you may also need the "Owner" or "Machine Learning Workspace Contributor" role for full access.
    • If you're using a service principal, ensure it has the correct role assignments.
    1. Check DefaultAzureCredential Configuration
    • If you're using DefaultAzureCredential() for authentication, ensure that:
    • The environment is correctly configured to authenticate the client.
    • If you're using a service principal, verify that the AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_CLIENT_SECRET environment variables are set correctly.

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


    If this answers your query, do click Accept Answer and Yes for was this answer helpful.

    0 comments No comments

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.