Replies: 8 comments 5 replies
-
Interesting issue. Obviously, this has to do with the SAS URI provided by IoT Hub and what permissions are on it. I'll check with the IoT Hub service team and possibly the Azure Storage team to find out what's going on here, but it may be slow going. How much of a blocker is this for you? |
Beta Was this translation helpful? Give feedback.
-
This appears to be a problem with the SAS URI generated by Azure Storage, or the handling in Storage with a SAS URI with write permissions, not allowing writing to the Tags. |
Beta Was this translation helpful? Give feedback.
-
@KiwiBryn What package name and version of the Storage blobs client are you using? |
Beta Was this translation helpful? Give feedback.
-
@drwill-ms copied from project, is this sufficient? PackageReference Include="Azure.Storage.Blobs" Version="12.11.0" Is there anything else which would be useful? |
Beta Was this translation helpful? Give feedback.
-
I've reached out to a contact on the Azure Storage team to see if they know why we see this error. Hang tight! :) |
Beta Was this translation helpful? Give feedback.
-
Forgot to add it's not a blocker for us. May cause some issues in about a month as I have a slightly "nasty" work around |
Beta Was this translation helpful? Give feedback.
-
@KiwiBryn I've found that the issue lies with an older NuGet package used in Azure IoT Hub service that precedes the introduction of support for allowing the editing of Tags in the SAS URI. Given how work and deployment timelines work, I suspect that'll take months minimum, even if they start today. I've inquired about it with engineering leadership and referred to this case. |
Beta Was this translation helpful? Give feedback.
-
I've moved this issue to a discussion so others can continue to be made aware of the issue, add their support for the support being present, and stay on top of news. |
Beta Was this translation helpful? Give feedback.
-
OS, version, SKU and CPU architecture used: Windows 10 Pro 21H2 , X64
.NET 6.0 v 6.0.202
Device: Desktop (could try on ASUS PE100 Ubuntu, RPI 4B Bullseye if that was helpful)
SDK version used:
"Azure.Storage.Blobs" Version="12.11.0"
"CommandLineParser" Version="2.8.0"
"Microsoft.Azure.Devices.Client" Version="1.40.0"
We have a data capture application (storage account only) which uploads images with "tags" so it is easier to search for images we want to review. Our metrics application (IoT Hub + storage account) does some "inferencing" then uploads telemetry, plus the raw and marked up images to the Storage Account associated with the IoT Hub.
When I tried to add "tags" to an image the upload failed with the error below...
Uploading file TestPayload.txt
Getting SAS URI from IoT Hub to use when uploading the file...
Successfully got SAS URI (https://xxxxxxx.blob.core.windows.net/azureiothubimages/backyard105%2FTestPayload.txt?sv=2018-03-28&sr=b&sig=NZm%2Bk7gaB7PZHDz3ePuwKOxBznEgCNyNeKR4czCsjrs%3D&se=2022-04-18T07%3A14%3A49Z&sp=rw) from IoT Hub
Uploading file TestPayload.txt using the Azure Storage SDK and the retrieved SAS URI for authentication
Failed to upload file to Azure Storage using the Azure Storage SDK due to Azure.RequestFailedException: This request is not authorized to perform this operation using this permission.
RequestId:d1098366-101e-0040-27eb-52831a000000
Time:2022-04-18T06:14:50.4597519Z
Status: 403 (This request is not authorized to perform this operation using this permission.)
ErrorCode: AuthorizationPermissionMismatch
The simplest repro could get is based on [azure-iot-samples-csharp/iot-hub/Samples/device/FileUploadSample
Around line 59 ish
// Works
await blockBlobClient.UploadAsync(fileStreamSource, new BlobUploadOptions());
// Works
BlobUploadOptions blobUploadOptions = new BlobUploadOptions();
await blockBlobClient.UploadAsync(fileStreamSource, blobUploadOptions);
// Works
BlobUploadOptions blobUploadOptions = new BlobUploadOptions()
{
Metadata = new Dictionary<string, string>()
};
blobUploadOptions.Metadata.Add("MetaData1", "1");
blobUploadOptions.Metadata.Add("MetaData2", "2");
blobUploadOptions.Metadata.Add("MetaData3", "3");
// Fails
BlobUploadOptions blobUploadOptions = new BlobUploadOptions()
{
Tags = new Dictionary<string, string>()
};
blobUploadOptions.Tags.Add("Tag1", "1");
blobUploadOptions.Tags.Add("Tag2", "2");
blobUploadOptions.Tags.Add("Tag3", "2");
await blockBlobClient.UploadAsync(fileStreamSource, blobUploadOptions);
Odd thing is adding MetaData works but not Tags
iot_000001.etl.txt
Beta Was this translation helpful? Give feedback.
All reactions