401 Unauthorized Error with Azure Maps in Route-Finding App Tutorial

Ren Ren 20 Reputation points
2024-05-09T08:05:56.05+00:00

I'm currently working through the Azure Maps tutorial on creating a route-finding app (https://learn.microsoft.com/en-us/training/modules/create-your-first-app-with-azure-maps/4-exercise-create-your-route-finding-app), and I've run into a problem. I am consistently receiving a 401 Unauthorized error when attempting to request map data. Here are the screenshot:User's image

I've verified that my subscription key is correct in the Azure portal.

Thank you in advance for your help!

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,013 questions
{count} votes

Accepted answer
  1. Rakesh Gurram 3,730 Reputation points Microsoft Vendor
    2024-05-09T12:03:32.86+00:00

    Hi Ren Ren,

    Where am I seeing this?

    Module: Create your first route finding app with Azure Maps

    Let's start by activating the sandbox in Unit 2 and follow the steps outlined.

    Note: If you're beginning the Azure sandbox learn path, ensure you've selected the 'sandbox account' before proceeding to create resources in the Azure Portal.

    • Once you reach the section titled "Create an Azure Maps Account," follow the instructions to create a resource.
    • After creating the resource in the Azure Portal, locate the "Primary key." This key serves as the sole authentication needed to connect an app to your Maps resource.

    Moving on to Unit 4, within Visual Studio Code, create a new folder and name it, for example, "MyApp.html." Then, paste the JavaScript code into this file, replacing the placeholders labeled "ADD HTML STYLE CODE," "ADD HTML BODY CODE," and "ADD JavaScript CODE" as instructed.

    Remember to replace the <YOUR AZURE MAPS PRIMARY KEY> string with the Primary key obtained from Unit 2 in the Azure Portal.

    Lastly, ensure to save the file every time you copy HTML code into Visual Studio Code.

    User's image

    In Unit 5, following the earlier instructions, open the .html file you created earlier. Double-clicking on the file will open it in your default web browser as shown:

    User's image

    In the end, you'll see the output displayed on your screen, similar to the screenshot below:

    Maps 2

    Please don't hesitate to reach out to us if you have any other queries with screenshots of the error ( after concealing your PII).

    If the information is helpful, please Accept Answer & Upvote so that it would be helpful to other community members.

    Thank you.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful