Azure Blob storage unauthorized 403 while access from app service

Tahami Rizwan 20 Reputation points
2023-05-31T05:42:29.0366667+00:00

We have multiple backend APIs hosted on Azure web app under same plan. All APIs have same outbound ips, and all these APIs enabled access restriction, these APIs only accessible within the api gateway. We have blob storage, we have also enable restriction on it (Networking Enabled from selected virtual networks and IP addresses  Firewall, added all APIs ips on it), Now when APIs going to fetch some image from blob it throw following error,

Azure.RequestFailedException: This request is not authorized to perform this operation.

RequestId:0bc5827d-c01e-0030-382f-929e61000000

Status: 403 (This request is not authorized to perform this operation.)

ErrorCode: AuthorizationFailure

Content:

Point to be noted that both APIs and blob are not using vNet, and both are on same resource group and using the same Identity

but when we remove network restriction on storage account it works fine

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,182 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,875 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,807 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vasco Ezequiel 11 Reputation points
    2024-09-25T16:58:32.2966667+00:00

    I want to share my case to help those who might encounter a similar error.

    My case

    My storage was only accessible from a limited set of public IPs. I could run the AzCopy commands from my house without any issues, but running the same command from a VM in Azure generated an error. To make things worse, I could run AzCopy Sync successfully as long as the blobs were the same or in --dry-run mode, but I could not copy them.

    Investigation

    The public IPs of the VMs were in the allow list.

    <br>However some transactions were done with non-routable IPs, I could not add the private IP 10.x.x.x/16 to that list.

    Solution

    After reviewing the logs, I noticed that a new and unknown public IP from Microsoft was also attempting to do the copy. Once that IP was added to the allow list, the error was resolved.

    0 comments No comments

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.