I am trying to upload a simple blob from an azure function app with managed identity:
public class BlobUtil
{
static public async Task UploadBlob(string accountName, string containerName, string blobName, string blobContents)
{
// Construct the blob container endpoint from the arguments.
string containerEndpoint = string.Format("https://{0}.blob.core.windows.net/{1}",
accountName,
containerName);
// Get a credential and create a client object for the blob container.
BlobContainerClient containerClient = new BlobContainerClient(new Uri(containerEndpoint),
new DefaultAzureCredential());
try
{
// Create the container if it does not exist.
await containerClient.CreateIfNotExistsAsync();
// Upload text to a new block blob.
byte[] byteArray = Encoding.ASCII.GetBytes(blobContents);
using (MemoryStream stream = new MemoryStream(byteArray))
{
await containerClient.UploadBlobAsync(blobName, stream);
}
}
catch (Exception e)
{
throw e;
}
}
}
await BlobUtil.UploadBlob("stintxxxxatadev", "xxx", Guid.NewGuid().ToString()+".json", "yo bro");
I get following error:
The I/O operation has been aborted because of either a thread exit or
an application request
And
Status: 403 (This request is not authorized to perform this
operation.)
The function has been provided following access on the storage account:
Am I missing some further access settings or any ideas on how to troubleshoot this?