-
Notifications
You must be signed in to change notification settings - Fork 495
Description
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