question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to add blob tags via iot blob upload

See original GitHub issue

Hi.

As the title states, I am unable to add blob tags to blobs uploaded via the iot hub.

Following your guide : https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/iot-hub/iot-hub-python-python-file-upload.md it should be as simple as

# Upload the specified file
with BlobClient.from_blob_url(sas_url) as blob_client:
    with open(file_name, "rb") as f:
        result = blob_client.upload_blob(f, overwrite=True)
        blob_client.set_blob_tags({"test":"tag"})
        return (True, result)

However this yields a <Error><Code>AuthorizationPermissionMismatch</Code><Message>This request is not authorized to perform this operation using this permission.

On the other hand i am able to add metadata

# Upload the specified file
with BlobClient.from_blob_url(sas_url) as blob_client:
    with open(file_name, "rb") as f:
        result = blob_client.upload_blob(f, overwrite=True)
        blob_client.set_blob_metadata({"test":"tag"})
        return (True, result)

Is there any workaround around this? Adding the correct permissions to the iothub for instance. I know this does not fit in the python sdk per se, but if you can point me to the correct repository to post this then ill gladly reupload.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
petoorcommented, Oct 28, 2022

Hi @lev-i .

Im glad they are working on a fix.

For anyone else browsing this issue : Our fix is to have an azure function with a blob trigger, that takes the metadata and adds that as tags. It works, it is not very complex, but of course it would be a better solution if it was not there at all.

1reaction
lev-icommented, Oct 11, 2022

@petoor As Tim pointed out, this was an issue on the C# SDK. I don’t believe it was solved on there, and likely won’t be solved here either assuming the same constraints are present. I’ll reach out to that team and see if it’s been updated at all, and I’ll let you know what I find out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure IoT Blob upload troubleshooting - Microsoft Q&A
I have setup Azure IoT Edge and a module for Azure IoT Blob storage. I have added about 12 containers that I want...
Read more >
Unable to View Contents of IoT Edge Device's Blob Storage ...
I have an IoT Edge device running a local blob storage module. When updating to v1.15.1, I can now no longer connect to...
Read more >
Unable to Download all the Blobs in a container from Azure ...
I have been trying to download 5 files uploaded as blobs already in azure cloud in container: updateappnew via a nodejs script.
Read more >
Do's and Don'ts for Streaming File Uploads to Azure Blob ...
NET MVC for uploading large files to Azure Blob Storage ... got through. we can't do it until after the upload because we...
Read more >
Azure Blob Storage by Microsoft | Docker Hub
Release Date: 02-Feb-2021 · Return blob creation time to avoid erroring out on newest .NET SDK (Azure.Storage. · Respect "create only" precondition for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found