An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
To use Azure Maps on a trial Azure subscription and get an authentication key, first ensure an Azure Maps account is created, then retrieve the subscription key from that account.
Follow these steps end to end:
- Create an Azure Maps account
- Sign in to the Azure portal.
- If not already done, create an Azure Maps account:
- Go to Create a resource → search for Azure Maps → create an account (for example, kind "Gen2" and an appropriate SKU).
- This step is required even if the Azure subscription itself is in free/trial mode.
- Open the Azure Maps account
- In the Azure portal, select All resources.
- Select the Azure Maps account that was created.
- Get the subscription key (Shared Key authentication)
- In the left pane of the Maps account, under Settings, select Authentication.
- Under Shared Key authentication, locate Primary Key and Secondary Key.
- Copy the Primary Key. This is the subscription key used by your application.
https://atlas.microsoft.com/map/tile?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=2024-04-01&tilesetId=microsoft.base.road&zoom=15&x=5236&y=12665&tileSize=256 - Use the key in an application (example)
- For a simple JavaScript/TypeScript app using the Azure Maps REST SDK:
MAPS_SUBSCRIPTION_KEY="<subscription-key>"const MapsSearch = require("@azure-rest/maps-search").default; const { AzureKeyCredential } = require("@azure/core-auth"); require("dotenv").config(); const credential = new AzureKeyCredential(process.env.MAPS_SUBSCRIPTION_KEY); const client = MapsSearch(credential); - For .NET (Geolocation client example):
AzureKeyCredential credential = new AzureKeyCredential("<My Subscription Key>"); MapsGeolocationClient client = new MapsGeolocationClient(credential);
- For a simple JavaScript/TypeScript app using the Azure Maps REST SDK:
- If the Authentication blade “doesn’t work”
- Confirm that the Azure Maps account was actually created (step 1). The subscription alone is not enough; the Maps resource must exist.
- Open All resources and verify the Maps account is listed and selectable.
- Once inside that resource, the Authentication blade is where the keys appear; if it is empty or missing, the Maps account may not have been created correctly and should be recreated.
For production, Microsoft Entra ID authentication is recommended, but for a trial and for updating an existing Bing Maps application, Shared Key (subscription key) is the simplest path.
References:
- Authentication with Azure Maps
- Manage authentication in Azure Maps
- Quickstart: Create an interactive search map with Azure Maps
- Migrate from Bing Maps to Azure Maps overview
- Secure an input constrained device by using Microsoft Entra ID and Azure Maps REST APIs
- JavaScript/TypeScript REST SDK Developers Guide (preview)
- Azure Maps Geolocation client library for .NET - version 1.0.0-beta.3
- Migrate Bing Maps Get a Static Map API