azure-ai-ml 1.19.0 custom model download fails
- 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
- 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)
- 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.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-ml-sdk @azureml-github.
@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.
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 - 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.
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 .
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.
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.