Loading...

Managed identities for Azure Maps

Managed identities for Azure Maps

In many enterprise organizations, there are strict processes for privacy, access, and handling of personally identifiable information (PII). Azure Maps is a global Azure service, which means it is available worldwide (except for China and South Korea), but it also needs to store metadata and logs somewhere. In addition, Azure Maps Creator is an addon for private indoor maps that also holds map data. So, where do we keep this data?

 

Even when Azure Maps stores almost no information, you still need to select in which region the metadata, logs, and private maps must be stored. 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). Microsoft doesn't control or limit the locations from which your end users come to Azure Maps.

 

Azure Maps shares customer-provided address/location queries with third-party TomTom for mapping functionality purposes. These queries aren't linked to any customer or end-user when shared with TomTom and can't be used to identify individuals. TomTom is listed on our Online Services Subcontractor List.

 

Azure Maps Keys

When using Azure Maps Keys, you can access, modify, upload, and delete all the data associated with that Azure Maps account. Not the best choice for a production solution. We recommend using Azure Managed identities for Azure Maps, which give you several powerful security benefits and access controls. You can disable (also by policy) the use of Azure Maps Keys for development, testing, and production. The best thing about managed identities is that you do not need to store any secrets, and you can no longer accidentally leak any keys in your source code.

 

Setting up managed identities

You can set up managed identities easily using the Azure Portal (what we are doing here), or if you like, you can also use the Azure command line (CLI). Here, we have written a step-by-step guide on using managed identities with Azure Maps and .NET.

 

Before we start, you need an Azure Maps account, a Web App, and access to your Azure Active Directory to register a new App.

 

We start with your Web App, where you like to enable managed identities for. First, navigate to your Web App, select the Identity option, and enable the system-assigned identity. Next, click on the permissions button.

 

1.png

 

Azure manages this system-assigned identity; no need to know any secrets. Next, we need to assign what this managed identity can do and access it or not. Finally, click the plus button to add what role this managed identity needs.

 

2.png

 

Select the resource group where you have created your Azure Maps account. We can use many different roles, but we are only interested in the Azure Maps roles for this blog. Type Azure Maps to filter and select the role you need for your solution. More roles are available here.

 

Azure Role Definition

Description

Azure Maps Contributor

Grants access all Azure Maps resource management.

Azure Maps Data Contributor

Grants access to read, write, and delete access to map related data from an Azure maps account.

Azure Maps Data Reader

Grants access to read map related data from an Azure maps account

Azure Maps Search and Render Data Reader

Grants access to limited set of data APIs for common visual web scenarios. Specifically, render and search data APIs

 

3.png

 

Now we have enabled managed identities in our Web App and allowed it to access Azure Maps with the selected role. In the Web App, we can now create a token proxy that uses the managed identity to generate an Azure Maps token that we use in our client app. Example code in C#

 

 

using Azure.Core; using Azure.Identity; using Microsoft.AspNetCore.Mvc; namespace AzureMapsDemo.Controllers; public class ApiController : Controller { private static readonly DefaultAzureCredential tokenProvider = new(); public async Task<IActionResult> GetAzureMapsToken() { var accessToken = await tokenProvider.GetTokenAsync( new TokenRequestContext(new[] { "https://atlas.microsoft.com/.default" }) ); return new OkObjectResult(accessToken.Token); } }

 

 

This Azure Maps token proxy can then be used in the Azure Maps Web Control, which runs in your browser by the following JavaScript code. Tokens are short-lived and are automatically renewed by the Azure Maps Web Control.

 

 

// Add authentication details for connecting to Azure Maps. authOptions: { // Use Azure Active Directory authentication. authType: 'anonymous', // Your Azure Maps client id for accessing your Azure Maps account. clientId: '[YOUR_AZUREMAPS_CLIENT_ID]', getToken: function(resolve, reject, map) { // URL to your authentication service that retrieves // an Azure Active Directory Token. var tokenServiceUrl = "/api/GetAzureMapsToken"; fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token)); } }

 

 

Do you need a step-by-step guide on how to use managed identities and authorization in a .NET web application, read our Azure Maps Web Application Authentication blog

Published on:

Learn more
Azure Maps articles
Azure Maps articles

Azure Maps articles

Share post:

Related posts

Introducing the Data-Bound Reference Layer in Azure Maps Visual for Power BI

Imagine managing a nationwide sales team and needing to understand how your sales align with factors like population density, competitor locat...

1 year ago

Enhance Azure Maps with Overture Maps Data using PMTiles!

  Supercharge Azure Maps with Overture Maps Data using PMTiles! We’ve got some exciting news. Azure Maps now supports PMTiles! This me...

1 year ago

Where do I go if I have questions about Azure Maps?

As you might expect, just looking around on your own, or asking Co-pilot, you can find comprehensive help like Samples.AzureMaps.com, wit...

1 year ago

Tailor your Reference Layers in Azure Maps Visual for Power BI

  We’re excited to share the latest enhancements to the Azure Maps visual in Power BI, designed to make your data visualization even mor...

2 years ago

Enhancing Logistics with Azure Maps and NVIDIA cuOpt for Multi-Itinerary Optimization

The logistics industry is always finding ways to optimize vehicle routing to enhance efficiency. The Vehicle Routing Problem (VRP) and Pickup ...

2 years ago

Introducing the Unified Azure Maps Experience

Microsoft has recently announced the unification of Bing Maps for Enterprise (BME) with Azure Maps, marking a remarkable advancement in their ...

2 years ago

Power BI Azure Maps Visual: Enhanced Reference Layer & Embedded Support

The Power BI Azure Maps visual has received a major update which includes an expansion of the reference layer and the addition of Power BI Emb...

2 years ago

Enhance your indoor maps with real-time map feature styling

The ability to dynamically update and visualize the state of rooms or areas within a building is critical to understanding the status of any b...

2 years ago

Dynamic Clustering Aggregation with Custom Styling in Bubble Layer

The Power BI Azure Maps visual allows you to create stunning geospatial visualizations with your data. Today, we are excited to announce a new...

2 years ago

HO HO HO Two Point OH!

You might notice some big changes have come to the North Pole experience at NORADSanta.ORG this year.  Developer elves have implemented a...

2 years ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy