Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.61k stars 2.82k forks source link

azure-ai-ml 1.19.0 custom model download fails #37187

Open Antalagor opened 2 months ago

Antalagor commented 2 months ago

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)

2. 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.
github-actions[bot] commented 2 months ago

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

jayesh-tanna commented 2 months ago

@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.

Antalagor commented 2 months ago

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