I am able to CreateContainers, ListContainers, ListBlobs but when I am trying to make a PUT/DELETE request to upload or delete files in the Azure Storage blob but it shows the following error after making the request:
403
This request is not authorized to perform this operation using this permission.
{
'content-length': '279',
'content-type': 'application/xml',
server: 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '4de6c154-f01e-0051-7ce4-1314ef000000',
'x-ms-version': '2018-03-28',
'x-ms-error-code': 'AuthorizationPermissionMismatch',
date: 'Mon, 08 Mar 2021 06:32:44 GMT',
connection: 'close'
}
The code for upload/PUT file is:
const request = require("request");
require("dotenv").config();
const account = process.env.ACCOUNT_NAME || "";
const containerName = "demo";
const blobName = "dummyfile1.txt";
const blobContent = "Hello, This will be written in file";
const contentLength = new TextEncoder().encode(blobContent).length;
var strTime = new Date().toUTCString();
const options = {
url: `https://${account}.blob.core.windows.net/${containerName}/${blobName}`,
headers: {
Authorization: "Bearer <BearerToken>",
"x-ms-date": strTime,
"x-ms-version": "2018-03-28",
"x-ms-blob-type": "BlockBlob",
"Content-Length": contentLength,
"Content-Type": 'application/text-plain',
},
body: blobContent,
};
function callback(error, response, body) {
console.log(response.statusCode);
console.log(response.statusMessage);
console.log(response.headers);
}
request.put(options, callback);
Here I am manually replacing the from the one which I am getting through POSTMAN via:
Also, I have added the permission of Storage Data Contributor to the App:
I have delegated Azure Storage, user_impersonation permission also to the Application.

But still, the same error persists.




