Forum Discussion
Authentication Web query to Azure Maps Geocoding API Service - Shared Key Authentication failing
- 1 year ago
Hi Anonymous , Thank you for reaching out to the Microsoft Community Forum.
You will need to ensure the API key is passed correctly. Power BI expects a key name when using Web.Contents and Azure Maps uses subscription-key as that key. The recommended solution is to store your Azure Maps key in a Power BI parameter for security and then reference it in a query that uses Web.Contents with ApiKeyName = "subscription-key". This setup avoids triggering the credentials prompt and aligns with both Power BI’s and Azure Maps’ authentication models.
Before running the query, make sure to clear any saved permissions for https://atlas.microsoft.com in Data Source Settings and set its privacy level to Public. This step helps Power BI process the request without authentication conflicts. Once that’s done, you can use the following Power Query to send an address to Azure Maps and get geocoded results in return:
let
apiKey = AzureMapsKey, // Reference to your Power BI parameter
locationQuery = "400 Broad St, Seattle, WA 98109", // Replace with your address
url = "https://atlas.microsoft.com/search/address/json",
queryParams = [
#"api-version" = "1.0",
query = locationQuery,
#"subscription-key" = apiKey
],
response = Web.Contents(url, [Query = queryParams, ApiKeyName = "subscription-key"]),
json = Json.Document(response),
results = json[results]
in
results
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi Anonymous , Thank you for reaching out to the Microsoft Community Forum.
You will need to ensure the API key is passed correctly. Power BI expects a key name when using Web.Contents and Azure Maps uses subscription-key as that key. The recommended solution is to store your Azure Maps key in a Power BI parameter for security and then reference it in a query that uses Web.Contents with ApiKeyName = "subscription-key". This setup avoids triggering the credentials prompt and aligns with both Power BI’s and Azure Maps’ authentication models.
Before running the query, make sure to clear any saved permissions for https://atlas.microsoft.com in Data Source Settings and set its privacy level to Public. This step helps Power BI process the request without authentication conflicts. Once that’s done, you can use the following Power Query to send an address to Azure Maps and get geocoded results in return:
let
apiKey = AzureMapsKey, // Reference to your Power BI parameter
locationQuery = "400 Broad St, Seattle, WA 98109", // Replace with your address
url = "https://atlas.microsoft.com/search/address/json",
queryParams = [
#"api-version" = "1.0",
query = locationQuery,
#"subscription-key" = apiKey
],
response = Web.Contents(url, [Query = queryParams, ApiKeyName = "subscription-key"]),
json = Json.Document(response),
results = json[results]
in
results
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.