Reputation: 11
I have a azure blob storage where i have placed a json file with some sample data, using postman i able to read the data present in the json file like below postman screen
I would like to get the same response using azure apim, for that i have created a an azure apim resource and in the api's i have added one API and a GET operation to see this json file content as response but is saying "blob not found or some time resource not found" when tested through apim as below
and using this url https://filetransfer.azure-api.net/filenet
Doing i need to pass any thing here to read that json file content ? I am new to APIM so i am not understanding how to achieve this
With in APIM i tried passing the filename in the query string of the gateway url like this https://filetransfer.azure-api.net/filenet?filename=testfile
but could not be able to get any response and still i got the same error as
<Error>
<Code>BlobNotFound</Code>
<Message>The specified blob does not exist.
RequestId:df7adae7-d01e-0067-0604-19cd2c000000
Time:2022-12-26T08:32:28.3446481Z</Message>
</Error>
or
<Error>
<Code>ResourceNotFound</Code>
<Message>The specified resource does not exist.
RequestId:df7adae7-d01e-0067-0604-19cd2c000000
Time:2022-12-26T08:32:28.3446481Z</Message>
</Error>
Upvotes: 1
Views: 2910
Reputation: 10520
I tried to reproduce your scenario in my environment and got the below results:-
I deployed one APIM resource
in my Azure Portal > Created one API based on Azure Storage
and used Get-Blob by adding it as an operation> I also enabled managed Identity on Azure APIM resource and added that identity Storage Blob Data Owner role
at my Storage account container level.
I configured GET URL to /
and not the URL of the APIM and was able to successfully get the Blob content via APIM.
Verify your Container name and Blob Name correctly form your storage account to avoid Container or Blob not found error.
I sent the test and retrieved blob contents successfully: -
Blob Content :-
I got the same error as yours, If I do not use / in Get Blob but if i used /< container-name >
Now, If I run the test, I get same error as yours:-
The Request URL changes in the Test when I add container name beside Get Blob URL - /
You need to use / in Get Blob operation URL instead of /filenet and verify your Container and Blob name in the Header while testing the API.
Reference: Secure Azure Blob Storage with Azure API Management & Managed Identities | by Marcus Tee | Marcus Tee Anytime | Medium by Marcus Tee.
Upvotes: 1