Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
DorFey
Frequent Visitor

Authentication Web query to Azure Maps Geocoding API Service - Shared Key Authentication failing

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).

 

Fehlermeldung.PNG

 

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 🙄

1 ACCEPTED SOLUTION
v-hashadapu
Community Support
Community Support

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.

View solution in original post

2 REPLIES 2
DorFey
Frequent Visitor

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!

v-hashadapu
Community Support
Community Support

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.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.