Azure / Azure/MachineLearningNotebooks

Model Loading in Azure Databricks Failing even after Service Principal Authentication

Open
#1,266 8 comments 1 reaction 1 assignee Claimed by @shbijlan View on GitHub
ADO bug Pipelines
Dominant language
Jupyter Notebook
Stars
4.4k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

I am trying to run a `DatabricksStep`. I have used `ServicePrincipalAuthentication` to authenticate the run:

appId = dbutils.secrets.get(, )
tenant = dbutils.secrets.get(, )
clientSecret = dbutils.secrets.get(, )
subscription_id = dbutils.secrets.get(, )
resource_group =
workspace_name =

svc_pr = ServicePrincipalAuthentication(
tenant_id=tenant,
service_principal_id=appId,
service_principal_password=clientSecret)

ws = Workspace(
subscription_id=subscription_id,
resource_group=resource_group,
workspace_name=workspace_name,
auth=svc_pr
)

The authentication is successful since running the following block of code gives the desired output:

subscription_id = ws.subscription_id
resource_group = ws.resource_group
workspace_name = ws.name
workspace_region = ws.location
print(subscription_id, resource_group, workspace_name, workspace_region, sep='\n')

However, the following block of codes gives an error:

model_name=
model_path = Model.get_model_path(model_name=model_name, _workspace=ws)
loaded_model = joblib.load(model_path)
print('model loaded!')

This is giving an error:

```
UserErrorException:
Message:
Operation returned an invalid status code 'Forbidden'. The possible reason could be:
1. You are not authorized to access this resource, or directory listing denied.
2. you may not login your azure service, or use other subscription, you can check your
default account by running azure cli commend:
'az account list -o table'.
3. You have multiple objects/login session opened, please close all session and try again.

InnerException None
ErrorResponse
{
"error": {
"message": "\nOperation returned an invalid status code 'Forbidden'. The possible reason could be:\n1. You are not authorized to access this resource, or directory listing denied.\n2. you may not login your azure service, or use other subscription, you can check your\ndefault account by running azure cli commend:\n'az account list -o table'.\n3. You have multiple objects/login session opened, please close all session and try again.\n ",
"code": "UserError"
}
}

```

Why is there a Forbidden Error when Authentication was successful?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.