azure.core.exceptions.HttpResponseError: This request is not authorized to perform this operation.

조한익 0 Reputation points
2023-08-23T12:29:03.0533333+00:00

I can't access Azure Blob Storage to upload and download blobs on Azure virtual Machine.

I use Python to access Azure Blob Storage.

I have SAS Key. This key is not expired.

And My Containers are Access level is 'container'. not private.

My Container account's Networking is opened to all networks.

I can't upload and download my images and files to blob storage in Azure Virtual Machine.

However, In my local, It works very well. I can access the blob storage very well.....

I think this is the network problem. but I opened my all ip and port in container account.

plz, help me.

My Virtual Machine is NC4as T4 v3.

and VM and Containers are in Korea Central region.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,017 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,192 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. 조한익 0 Reputation points
    2023-08-24T07:25:07.4433333+00:00

    I realize that in Azure VM, I can't use the SAS KEY because It occurs an error of authrization.

    So, we need to use other way to authenticate.

    0 comments No comments

  2. Bhanu Ejjagiri 261 Reputation points Microsoft Employee
    2023-08-25T19:21:04.1566667+00:00

    Hi 조한익

    Thanks for contacting Microsoft Q&A.

    Based on your case note, I understand that you are unable to access a storage account from a specific Azure VM and the same is working from your local machine.

    There could be multiple reasons for the failure, few below:

    1. VM public network: You mentioned that the storage account doesn't have any firewall restrictions and open to all networks, but can you please check and confirm if you have public network is enabled on the VM to access the storage account.
    2. VM's time: Verify that the time and time zone settings on the Azure VM are accurate. SAS tokens are time-sensitive, and if there's a significant time difference between your VM and the storage service, it could lead to authentication failures.
    3. Python Library issues: Ensure that you're using the same version of the Azure Storage SDK on the Azure VM as you are on your local machine. Mismatched library versions could lead to compatibility issues.

    Can you please try to test the below:

    1. open command prompt and run the following command "telnet yourSTaccount.blob.core.windows.net 443" - if it is connected, your network is fine else please troubleshoot your source network issues.
    2. If telnet is working and still unable to connect, please install "Azure storage explorer" in your VM and connect/mount the storage container using the SAS - https://learn.microsoft.com/en-us/azure/vs-azure-tools-storage-manage-with-storage-explorer?tabs=windows
    3. Please check your SAS has enough permissions, example: https://yourSTaccount.blob.core.windows.net/Container?sp=racwdl&st=2023-08-25T18:50:25Z&se=2023-08-30T02:50:25Z&sv=2022-11-02&sr=c&sig=3nnnkeykeykey

    Please feel free to let me know if you have any further queries or suggestions.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.