Skip to content

Provision your own Azure Maps key ​

The package-this app's map view (route visualisation, Part 5+) uses Azure Maps. The app works fine without it (the map simply shows a placeholder), so this step is optional. Follow it only if you want live map rendering in your own fork.

This is a per-fork key, not a dm-ws value

The Azure Maps key belongs in the frontend environment of your package-this fork, not in the dm-ws .env file. None of the core labs need it.

Prerequisites ​

  • An Azure subscription with the ability to create resources (Contributor or Owner role on a resource group).
  • The Azure CLI installed and logged in (az login).

Step 1: Create (or reuse) a resource group ​

You can reuse the group you created for Azure Foundry. To make a dedicated one:

bash
az group create \
  --name rg-maps-workshop \
  --location eastus

Step 2: Create an Azure Maps account ​

bash
az maps account create \
  --name maps-workshop \
  --resource-group rg-maps-workshop \
  --sku G2 \
  --kind Gen2 \
  --accept-tos

Wait for the command to complete (roughly 30–60 seconds).

SKU

G2 (Gen2) is the current, recommended tier and includes a generous free monthly quota that comfortably covers workshop use. The older Gen1 tiers (S0/S1) are being retired.


Step 3: Retrieve your key ​

bash
az maps account keys list \
  --name maps-workshop \
  --resource-group rg-maps-workshop \
  --query "primaryKey" -o tsv

Copy the value; this is your AZURE_MAPS_KEY.

Alternatively, open the Azure Portal, navigate to your Azure Maps account, and find it under Settings → Authentication → Shared Key Authentication.


Step 4: Wire it into your package-this fork ​

Set the key in the frontend environment of your package-this fork (see the map view's own hint in the app for the exact location for your hosting setup):

dotenv
AZURE_MAPS_KEY=<your-primary-key>

Rebuild / redeploy the frontend so the value is picked up.


Verify ​

Open the route map view in your running package-this frontend. With a valid key the map tiles render and routes are drawn; without one you see the placeholder instead.

If the map stays blank, double-check the key was copied without extra whitespace and that the frontend was rebuilt after setting the variable.