AzureMapsControl.Components 1.10.0-net60-alpha0001

Nuget Nuget (with prereleases) Build Unit Test release codecov Slack

This library allows you to use Azure Maps inside your razor application.

Install the Nuget Package

This library is available on Nuget as AzureMapsControl.Components.

Setup

Add the css and scripts

You will need to add the atlas script and css files as well as the script generated by the library on your application.

<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
<script src="_content/AzureMapsControl.Components/azure-maps-control.js"></script>

Or use the minimized version :

<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
<script src="_content/AzureMapsControl.Components/azure-maps-control.min.js"></script>

Register the Components

You will need to pass the authentication information of your AzureMaps instance to the library. SubscriptionKey, Aad and Anonymous authentication are supported. You will need to call the AddAzureMapsControl method on your services.

You can authenticate using a subscription key :

    // This method gets called by the runtime. Use this method to add services to the container.
    // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddServerSideBlazor();
        
        services.AddAzureMapsControl(configuration => configuration.SubscriptionKey = "Your Subscription Key");
    }

Or using Azure Active Directory:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor(options => options.DetailedErrors = true);

            services.AddAzureMapsControl(configuration => {
                configuration.AadAppId = "Your Aad App Id";
                configuration.AadTenant = "Your Aad Tenant";
                configuration.ClientId = "Your Client Id";
            });
        }

The Anonymous authentication requires only a ClientId:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor(options => options.DetailedErrors = true);

            services.AddAzureMapsControl(configuration => configuration.ClientId = Configuration["AzureMaps:ClientId"])
        }

It also needs to fetch the token to send to the requests of the atlas library. For that, you have to override the azureMapsControl.Extensions.getTokenCallback method on your application after referencing azure-maps-control.min.js and resolve the token in it. For example :

@page "/"
@namespace AzureMapsControl.Sample.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>AzureMapsControl.Sample</title>
    <base href="~/" />
    <link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" />
    <link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/drawing/0.1/atlas-drawing.min.css" type="text/css" />
    <style>
        body {
            margin: 0;
        }

        #map {
            position: absolute;
            width: 100%;
            min-width: 290px;
            height: 100%;
        }
    </style>
</head>
<body>
    <app>
        <component type="typeof(App)" render-mode="ServerPrerendered" />
    </app>
    <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
    <script src="https://atlas.microsoft.com/sdk/javascript/drawing/0.1/atlas-drawing.min.js"></script>
    <script src="_content/AzureMapsControl.Components/azure-maps-control.min.js"></script>
    <script src="_framework/blazor.server.js"></script>
    <script type="text/javascript">
        azureMapsControl.Extensions.getTokenCallback = (resolve, reject, map) => {
            const url = "url_of_my_token_endpoint";
            fetch(url).then(function (response) {
                return response.text();
            }).then(function (token) {
                resolve(token);
            });        
        };
    </script>
</body>
</html>

How to use

Want to contribute ?

Contributions are welcome! One of the best way to start is to take a look at the list of issues where help is wanted.

If you need a new feature which is not listed on the issues, feel free to open a new one. Take also a look at the Contributing guidelines.

No packages depend on AzureMapsControl.Components.

Version Downloads Last updated
2.0.0-net9.10 23 12/12/2025
2.0.0-net9.9 22 12/12/2025
2.0.0-net9.8 14 12/12/2025
2.0.0-net9.7 19 12/12/2025
2.0.0-net9.6 14 12/12/2025
2.0.0-net9.5 15 12/12/2025
2.0.0-net9.4 15 12/12/2025
2.0.0-net9.3 14 12/12/2025
2.0.0-net9.2 14 12/12/2025
1.19.0-alpha0005 2 3/12/2026
1.19.0-alpha0001 3 3/12/2026
1.18.0-beta0001 3 3/12/2026
1.18.0-alpha0012 2 3/12/2026
1.18.0-alpha0007 2 3/12/2026
1.17.1 3 3/12/2026
1.17.0 18 12/10/2025
1.16.1 11 12/12/2025
1.16.0 17 12/12/2025
1.16.0-alpha0003 12 12/12/2025
1.16.0-alpha0001 16 12/12/2025
1.15.0 14 12/12/2025
1.15.0-alpha0002 14 12/12/2025
1.14.1 17 12/12/2025
1.14.0 14 12/12/2025
1.14.0-alpha0015 12 12/12/2025
1.13.0 15 12/12/2025
1.13.0-alpha0001 13 12/12/2025
1.12.0 16 12/12/2025
1.12.0-alpha0038 15 12/12/2025
1.12.0-alpha0028 19 12/12/2025
1.12.0-alpha0019 17 12/12/2025
1.12.0-alpha0011 16 12/12/2025
1.12.0-alpha0004 15 12/12/2025
1.12.0-alpha0003 14 12/12/2025
1.11.0 13 12/12/2025
1.11.0-alpha0015 19 12/12/2025
1.10.0 15 12/12/2025
1.10.0-net60-alpha0001 12 12/12/2025
1.10.0-alpha0010 15 12/12/2025
1.9.0 16 12/11/2025
1.9.0-alpha0006 15 12/12/2025
1.8.3 15 12/12/2025
1.8.3-beta0001 14 12/12/2025
1.8.2 18 12/12/2025
1.8.2-beta0001 12 12/12/2025
1.8.1 15 12/12/2025
1.8.1-beta0001 14 12/12/2025
1.8.0 20 12/12/2025
1.8.0-html-marker-laye0001 17 12/12/2025
1.8.0-alpha0003 15 12/12/2025
1.7.1 17 12/12/2025
1.7.1-beta0001 16 12/12/2025
1.7.0 18 12/12/2025
1.7.0-alpha0014 15 12/12/2025
1.7.0-alpha0004 14 12/12/2025
1.7.0-alpha0001 15 12/12/2025
1.6.1 17 12/12/2025
1.6.1-beta0001 15 12/12/2025
1.6.0 17 12/12/2025
1.6.0-alpha0050 20 12/12/2025
1.6.0-alpha0031 15 12/12/2025
1.6.0-alpha0015 16 12/12/2025
1.5.2 15 12/12/2025
1.5.2-beta0001 18 12/12/2025
1.5.1 17 12/12/2025
1.5.1-beta0001 19 12/12/2025
1.5.0 14 12/12/2025
1.5.0-alpha0016 18 12/12/2025
1.4.0 14 12/12/2025
1.4.0-alpha0005 16 12/12/2025
1.3.0 16 12/12/2025
1.3.0-beta0003 19 12/12/2025
1.3.0-beta0002 15 12/12/2025
1.3.0-beta0001 18 12/12/2025
1.3.0-alpha0001 13 12/12/2025
1.2.0 15 12/12/2025
1.2.0-alpha0004 16 12/12/2025
1.1.0 18 12/12/2025
1.1.0-alpha0015 17 12/12/2025
1.0.0 15 12/12/2025
1.0.0-beta0008 16 12/12/2025
1.0.0-beta0007 15 12/12/2025
1.0.0-beta0006 15 12/12/2025
1.0.0-beta0005 15 12/12/2025
1.0.0-beta0004 19 12/12/2025
1.0.0-beta0003 20 12/12/2025
1.0.0-beta0002 15 12/12/2025
1.0.0-beta0001 13 12/12/2025
0.17.1 22 12/12/2025
0.17.1-beta0001 12 12/12/2025
0.17.0 18 12/12/2025
0.16.0 15 12/12/2025
0.15.0 14 12/12/2025
0.15.0-alpha0038 18 12/12/2025
0.14.0 17 12/12/2025
0.14.0-alpha0003 19 12/12/2025
0.13.0 14 12/12/2025
0.13.0-alpha0001 17 12/12/2025
0.12.0 15 12/12/2025
0.12.0-typescript0001 15 12/12/2025
0.12.0-publish-typescri0001 17 12/12/2025
0.12.0-alpha0018 21 12/12/2025
0.11.0 16 12/12/2025
0.11.0-alpha0003 19 12/12/2025
0.10.1 16 12/12/2025
0.10.0 16 12/12/2025
0.10.0-alpha0011 16 12/12/2025
0.10.0-alpha0005 13 12/12/2025
0.9.0 15 12/12/2025
0.9.0-alpha0013 14 12/12/2025
0.9.0-alpha0006 20 12/12/2025
0.9.0-alpha0003 16 12/12/2025
0.8.1 15 12/12/2025
0.8.0 18 12/12/2025
0.8.0-beta0001 15 12/12/2025
0.8.0-alpha0005 20 12/12/2025
0.7.1 15 12/12/2025
0.7.0 15 12/12/2025
0.7.0-beta0001 14 12/12/2025
0.7.0-alpha0002 22 12/12/2025
0.6.0-beta0001 17 12/12/2025
0.6.0-alpha0005 16 12/12/2025
0.6.0-alpha0001 18 12/12/2025
0.5.2 13 12/12/2025
0.5.1 13 12/12/2025
0.5.0 14 12/12/2025
0.4.0 16 12/12/2025
0.3.0-beta0001 21 12/12/2025
0.3.0-alpha0019 16 12/12/2025
0.3.0-alpha0010 17 12/12/2025
0.3.0-alpha0004 18 12/12/2025
0.2.0 16 12/12/2025
0.2.0-beta0003 16 12/12/2025
0.2.0-beta0002 19 12/12/2025
0.2.0-beta0001 15 12/12/2025
0.1.0 22 12/12/2025
0.1.0-beta0002 19 12/12/2025
0.1.0-beta0001 19 12/12/2025
0.1.0-alpha0236 16 12/12/2025
0.1.0-alpha0116 18 12/12/2025
0.1.0-alpha0112 14 12/12/2025
0.1.0-alpha0097 17 12/12/2025
0.1.0-alpha0091 17 12/12/2025
0.1.0-alpha0090 16 12/12/2025
0.1.0-alpha0089 15 12/12/2025
0.1.0-alpha0088 20 12/12/2025
0.1.0-alpha0087 21 12/12/2025
0.1.0-alpha0086 18 12/12/2025
0.1.0-alpha0085 18 12/12/2025
0.1.0-alpha0084 18 12/11/2025
0.1.0-alpha0083 16 12/12/2025
0.1.0-alpha0082 18 12/12/2025
0.1.0-alpha0081 22 12/12/2025
0.1.0-alpha0080 16 12/12/2025
0.1.0-alpha0079 15 12/12/2025
0.1.0-alpha0077 14 12/12/2025
0.1.0-alpha0076 15 12/12/2025
0.1.0-alpha0074 22 12/12/2025
0.1.0-alpha0071 25 12/12/2025
0.0.1-ci-20201106.2 15 12/12/2025
0.0.1-ci-20201106.1 17 12/12/2025
0.0.1-ci-20201105.7 13 12/12/2025
0.0.1-ci-20201105.6 18 12/12/2025
0.0.1-ci-20201105.5 17 12/12/2025
0.0.1-ci-20201105.4 17 12/12/2025
0.0.1-ci-20201105.3 15 12/12/2025
0.0.1-ci-20201105.2 15 12/12/2025
0.0.1-ci-20201105.1 15 12/12/2025
0.0.1-ci-20201104.2 16 12/12/2025
0.0.1-ci-20201104.1 20 12/12/2025
0.0.1-ci-20201030.5 23 12/12/2025
0.0.1-ci-20201030.4 18 12/12/2025
0.0.1-ci-20201030.3 16 12/12/2025
0.0.1-ci-20201030.2 17 12/12/2025
0.0.1-ci-20201030.1 16 12/12/2025
0.0.1-ci-20201029.3 15 12/12/2025
0.0.1-ci-20201029.2 15 12/12/2025
0.0.1-ci-20201029.1 16 12/12/2025
0.0.1-ci-20201028.1 19 12/12/2025
0.0.1-ci-20201027.1 17 12/12/2025
0.0.1-ci-20201026.2 15 12/12/2025
0.0.1-ci-20201026.1 22 12/12/2025
0.0.1-ci-20201023.2 14 12/12/2025
0.0.1-ci-20201023.1 17 12/12/2025
0.0.1-ci-20201022.1 22 12/12/2025
0.0.1-ci-20201008.1 16 12/12/2025
0.0.1-ci-20201005.1 16 12/12/2025
0.0.1-ci-20200407.1 13 12/12/2025
0.0.1-ci-20200406.3 18 12/12/2025
0.0.1-ci-20200406.2 15 12/12/2025
0.0.1-ci-20200406.1 16 12/12/2025
0.0.1-ci-20200403.5 15 12/12/2025
0.0.1-ci-20200403.4 20 12/12/2025
0.0.1-ci-20200403.3 16 12/12/2025
0.0.1-ci-20200403.2 18 12/12/2025
0.0.1-ci-20200403.1 15 12/12/2025
0.0.1-ci-20200402.2 24 12/11/2025
0.0.1-ci-20200402.1 17 12/12/2025