azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

azure-ai-ml 1.19.0 custom model download fails

Open Antalagor opened this issue 2 years ago • 7 comments

  • Package Name: azure-ai-ml
  • Package Version: 1.19.0
  • Operating System: macOS Sonoma 14.6.1
  • Python Version: 3.11.9

Describe the bug With version 1.19.0 I am unable to upload/ download a model in the same script. Model listing works, though. I also cannot download older model uploaded with version 1.8.0.

With version 1.18.0 it all works smoothly, though.

I get authentication error:

...
│ te-packages/azure/storage/blob/_shared/response_handlers.py:186 in           │
│ process_storage_error                                                        │
│                                                                              │
│   183 │   error.args = (error.message,)                                      │
│   184 │   try:                                                               │
│   185 │   │   # `from None` prevents us from double printing the exception ( │
│ ❱ 186 │   │   exec("raise error from None")   # pylint: disable=exec-used #  │
│   187 │   except SyntaxError as exc:                                         │
│   188 │   │   raise error from exc                                           │
│   189                                                                        │
│ in <module>:1                                                                │
╰──────────────────────────────────────────────────────────────────────────────╯
HttpResponseError: Operation returned an invalid status 'This request is not 
authorized to perform this operation using this permission.'
ErrorCode:AuthorizationPermissionMismatch

To Reproduce

  1. Upload a model
credential_service = DefaultAzureCredential()
ml_client = MLClient(credential_service, subscription_id, resource_group, workspace)

model = Model(
        path=PATH,
        type=AssetTypes.CUSTOM_MODEL,
        name=NAME,
        description=DESCRIPTION,
)

ml_client.models.create_or_update(model)
  1. Download it again
models = ml_client.models.list()
ml_client.models.download(NAME, VERSION)

Expected behavior Model gets uploaded. Models can be listed. Model can be downloaded.

Antalagor avatar Sep 03 '24 09:09 Antalagor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-ml-sdk @azureml-github.

github-actions[bot] avatar Sep 03 '24 13:09 github-actions[bot]

@Antalagor Can you check what role assignments you have on storage account associated with ML workspace? Minimum, it should be Storage Blob Data Reader or Storage Blob Data Contributor.

Note that I am able to download model using azure-ai-ml 1.19.0 version. So, it's not producible at our end.

jayesh-tanna avatar Sep 04 '24 06:09 jayesh-tanna

Hi, thanks for having a look into this.

By no means, I am an expert on the Azure service infrastructure, so I am not sure, if I can assist with the right information. When I look into Storage account -> IAM -> Role assignments and search for the mentioned items I find:

Storage Blob Data Contributor -> Enterprise Application, that seems to be associated with the resource (and has a matching name)

Storage Blob Data Reader -> different Enterprise Application, that seems to be inherited (and has a non-expressive hash name)

Hope, I could help

Antalagor avatar Sep 05 '24 06:09 Antalagor

@Antalagor - below code worked for me

ml_client = MLClient(
            subscription_id=subscription_id,
            resource_group_name=resource_group,
            workspace_name=workspace_name,
            credential=DefaultAzureCredential(),
)

model1 = ml_client.models.create_or_update(model)
ml_client.models.download(name=model1.name,version=model1.version)

Are you still able to repo the issue? If yes, can you please share what is authentication type on your default data store. Image

achauhan-scc avatar Dec 09 '24 09:12 achauhan-scc

Hi,

yes, the problem persists for azure-ai-ml==1.19.0. I cannot download a model uploaded with azure-ai-ml==1.18.0 However, when using azure-ai-ml==1.22.4 it works.

I tried to find the exact screen, to look up datastore credentials. However, I can only find a storage account with blobs and no datastore.

Side note: We needed a new setup of the Azure ML Workspace in a new Subscription/ Resource Group for some internal infrastructural reasons. We updated software to the newest version. In the new setup the issue no longer exists. Thus, update of the sdk on our software side was possible. Meaning, the issue is not super painful on our end anymore .

phwolfram avatar Dec 13 '24 13:12 phwolfram

Hi @Antalagor. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

github-actions[bot] avatar Feb 03 '25 08:02 github-actions[bot]

Hi @Antalagor, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

github-actions[bot] avatar Feb 10 '25 10:02 github-actions[bot]