Earn recognition and rewards for your Microsoft Fabric Community contributions and become the hero our community deserves.
Learn moreSee when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap
Hey there!
I got some struggles reaching the Azure Maps Geocoding API via PowerBI (web) query.
I tried several approaches:
1) Providing the API-KEY directly to the credentials prompt ("primary key" value from my Azure Maps Account instance)
2) Providing the API-KEY by a PowerBI parameter (name of the parameter)
3) Providing the API-KEY in a query in advanced editor (by loading it from a .txt file, providing the parameter to the url)
(in that case i also set the privacy option for connecting the data both to "public", so that the error can´t be linked to that)
4) Providing the API-KEY in a query in advanced editor (directly in the url)
5) Providing the API-KEY with [ApiKeyName = "value of primary key"]) both in login ui and by Web.Contents(url, [ApiKeyName = "subscription-key"])
I always get redirected to the login credential prompt (even from blank query), which throws always the same error message, as soon as i try to authenticate with the primary key "A web API key can only be specified when a web API key name is provided" (i also tried the secondary key).
I also tried to create a fabric instance and authenticate - but i am no Microsoft Entra ID Admin, so i can´t use that for authentication (information necessary, which needs the corresponding admin role).
Maybe i should move to a google geocoding api approach 🙄
Solved! Go to Solution.
Hi @DorFey , 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.
Your approach solved the issue, thank you very much!
So i guess - my approach redirected me to the login credential window, because i used the key value for the Web.Contents() function, instead of the subscription-key name, which stores the key-value.
I tried it for several combinations of (partial) addresses and it works as expected!
Hi @DorFey , 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.