fabragaMS / ADPE2E

Azure Data Platform End-to-End
343 stars 239 forks source link

Lab 4 - HTTPError: 403 Client Error: Forbidden for url: https://australiaeast.api.cognitive.microsoft.com/vision #26

Open mtinkova opened 2 years ago

mtinkova commented 2 years ago

While working through Lab4, I came across the following issue. After importing NYCImageMetadata-Lab notebook and replacing suscription_key ans vision_base_url I used "https://petlifetoday.com/wp-content/uploads/2018/06/wireless-dog-fence.jpg" in the "Image URL" and hit Run/Run All. I got the following error (image attached below): "HTTPError: 403 Client Error: Forbidden for url: https://australiaeast.api.cognitive.microsoft.com/vision/v2.0/analyze?visualFeatures=Categories%2CDescription%2CColor%2CBrands%2CTags%2CObjects&details=Landmarks%2CCelebrities"

image

I opened Microsoft cognitive services API Console for Computer Vision and passed the same subscription key and same image URL. And I got response: image

"403: Forbidden..." seems to be very common issue. There are number of suggested solutions, but none related to my particular case. There was a suggestion to pass more parameters to the request header, not just 'Ocp-Apim-Subscription-Key'. I added 'User-Agent' and 'Content-Type', but that didn't change anything (and I didn't expect it to). The fact that I can establish connection and run the service with my subscription key from the MS API console, and not from Databricks tells me something is wrong in the communication between Databricks and ComputerVision resource in Azure with my account. Any help is highly appreciated.