0
votes

I'm trying to analyse my images using Azure Computer Vision API (Azure Cognitive Service)

But the issue is my Image is stored in Blob container with Private access which means without a SAS token it will not able to access. So when I tried to call the Computer Vision API with my image URL + SAS .It's giving bad request

You can easily repro this issue in this site too

enter image description here

2

2 Answers

0
votes

Not sure you can equate the demo webpage which most likely doesn't allow Cross-Origin Resource Sharing (CORS) as the Computer Vision API not allowing SAS tokens. Both the storage account (which you have control of) and the web app (which you don't control) will need to allow CORS since they are cross-domain. My advice is to stand up an Azure Web that calls the computer vision API so you can enable CORS on both.

https://docs.microsoft.com/en-us/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services

0
votes

I gave it a quick try to ensure that this was only a restriction of the web demo on the site you provided.

I can confirm that images hosted on a blob, accessed through a SAS signature, are working with the API, see below my test where I got a 200 OK and a valid reply content:

demo

I also confirm that it is not on the web demo: I guess they are just ensuring that the provided URL string ends with jpg, jpeg, gif, bmp or png