Azure-Samples/AzureMapsCodeSamples

Fill Address Form with Autosuggest Uncaught (in promise) TypeError: Failed to fetch running sample code

chargerback-ron opened this issue · 3 comments

I get this error message trying to run the sample code from my website. The error is generated from the getAadToken function. Searching on the web, it appears that the code is trying to authenticate a system or user-assigned identity for Maps service. I created a user-assigned identity, but when I try to assign it to my Azure Maps Account, the Identity blade is grayed out. Hovering on it shows a tooltip which reads "Cannot assign identity to a global account". Sure enough, my Azure Maps Account is a global account. So I tried to assign it to a region, but Azure Maps does not support regions; it is global only.

We are already using Azure Maps for geolocation and time zones. However, we use it with Shared Key Authentication. I tried using that with this sample code, but it also fails. Apparently, the subscription-key parameter is not valid in calls to the https://atlas.microsoft.com/search/address/ endpoint. I'm hoping you can point me in the right direction here.

Disregard. I got it to work with Shared Key Authentication. I had not commented out the header for Authorization when using the key. Closing this issue.

When working with Azure Maps, please create an Azure Maps account and select always a region (and do not set it too global). When creating a new Azure Maps account, the region selection only affects your Azure Maps account's account management and metadata capabilities. Basically, you decide that all metadata, logs, and private map data stay in the selected region (the United States or Europe). However, it's important to note that Azure Maps is still a global service, irrespective of the region you select.

Thank you. It sounds like I would have to create a new Azure Maps Account, which is not an option for me, since we are already using it in production code.