Can Azure Maps use AAD App Registrations to Authenticate

Harry Cantor 20 Reputation points
2023-02-23T03:33:48.39+00:00

I'm trying to use an Azure AD App Registration to authenticate with Azure Maps using an auth token. The application has the Azure Maps Data Contributor role on the Azure Maps Account resource. I'm able to get a Bearer token from that app but when I try to use the token in a REST request I get 401 Unauthorized.

https://atlas.microsoft.com/search/address/search/json?api-version-1.0&query=400 Bread St, Seattle, WA 98109

Headers:

x-ms-client-id: <maps account client id>

Authorization: Bearer <AAD App Token>

Is it possible to authenticate using a App Registrations?

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
798 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,652 questions
0 comments No comments
{count} votes

Accepted answer
  1. IoTGirl 3,461 Reputation points Microsoft Employee
    2023-02-26T19:03:10.7533333+00:00
    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 35,936 Reputation points
    2023-02-23T08:43:17.4666667+00:00

    Harry Cantor Welcome to Microsoft Q&A forum!

    Is it possible to authenticate using a App Registrations?

    Yes, it is possible to authenticate using an Azure AD App Registration.

    I'm trying to use an Azure AD App Registration to authenticate with Azure Maps using an auth token. The application has the Azure Maps Data Contributor role on the Azure Maps Account resource

    Are you following any documentation for the steps to configure Azure AD authentication to your app?

    Please check Authentication with Azure Maps to know more about different ways to authenticate requests incase if you haven't checked earlier.

    I'm able to get a Bearer token from that app but when I try to use the token in a REST request I get 401 Unauthorized.

    The error message you are getting suggests that the token you are using might not have the necessary permissions to access the Azure Maps API.

    Can you confirm if you have obtained an access token for the Azure Maps API by sending a POST request to the Azure AD token endpoint with the required parameters, including the App Registration's client ID and secret?

    I understand that you have provided, Azure Maps Data Contributor role on the Azure Maps Account. Azure Maps services may require elevated privileges to perform some actions on Azure Maps REST APIs.

    The following role definition types exist to support application scenarios.

    User's image

    I would suggest you to check Secure a web application with user sign-in you need to configure the web application to call Azure Maps REST APIs by configuring the app registration with an application secret. The app registration certificate or secret should be stored in a secure store for the web application to retrieve to authenticate to Azure AD.

    If you need further help in this matter, please comment in the below section and we are happy to discuss!


    If this answers your query, do click Accept Answer and Yes for this answer as helpful. And, if you have any further query do let us know by commenting in the below section.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.