How do I convert a UWP application to use Azure Maps?

Frank LaRosa 21 Reputation points
2025-07-09T20:59:00.2433333+00:00

I maintain a large UWP application that uses MapControl (from Windows.UI.Xaml.Controls.Maps). I didn't know that Bing map tokens were being retired until I started seeing a "MapServiceToken not specified" warning in my map views a few days ago.

My understanding is that Enterprise tokens will still be supported until 2028, but I can't figure out how to obtain one. (I am not the original developer of this application and he apparently started with a free token and never bothered to upgrade it). I would like to get an Enterprise token so I can fix the immediate problem.

Long term, am I going to be able to replace the MapControl with something else that works in a UWP application? I read through some of the migration information but it isn't clear to me if UWP is supported or not.

Thanks,

Frank

Developer technologies | Universal Windows Platform (UWP)
0 comments No comments

3 answers

Sort by: Most helpful
  1. Frank LaRosa 21 Reputation points
    2025-07-10T16:02:25.95+00:00

    Thanks for the responses. We contacted Microsoft and they are willing to sell us a license to continue using Bing maps for another year.

    It's too bad that we have to resort to using a web view but I guess that's what we'll do.

    The idea of "migrating" to WinUI3 sounds great and is easy to say, but we're talking about a huge application that took years to develop, so it's an expensive undertaking.

    Was this answer helpful?


  2. Dhruv shah 0 Reputation points
    2025-07-10T15:55:11.69+00:00

    For the long term, MapControl (Bing Maps) is being phased out. Azure Maps does not support UWP natively — it's web-based.

    Options:

    Short-term: Use an Enterprise key to keep your app running.

    Long-term:

    Use WebView to embed Azure Maps via JavaScript in UWP.

      Or migrate to **WinUI 3 + WebView2** for modern support.
      
    

    Let me know if you want help with the WebView or migration!

    Was this answer helpful?

    0 comments No comments

  3. Anonymous
    2025-07-10T02:57:57.1+00:00

    Hi @Frank LaRosa ,

    Not only that Enterprise Bing Maps tokens will continue to be supported until 2028, but Microsoft has also stopped onboarding new customers to the Bing Maps Enterprise program. This means that only existing enterprise customers can continue using their tokens until the end-of-support date — new users cannot obtain Enterprise tokens anymore.

    Given this, the best long-term solution is to migrate your UWP application to use Azure Maps. Azure Maps is actively supported and offers robust mapping capabilities, including REST APIs, Web SDKs, and integration with other Azure services.

    You can follow this instruction for more detail!


    I read through some of the migration information, but it isn't clear to me if UWP is supported or not.

    Regarding UWP support — you're not wrong, UWP is not supported yet because Azure Maps does not currently offer a native UWP control like MapControl. However, you can still integrate Azure Maps into your UWP app using WebView to host the Azure Maps Web SDK, or by calling its REST APIs and rendering the data manually. This approach may require some architectural changes, but it's the most future-proof path forward.

    You can read these previous answers from here and here, — thanks to rbrundritt for sharing helpful guidance. I recommend following his instructions to implement Azure Maps successfully!


    Here is my basic Azure Maps implement follow rbrundritt:

    • azuremap.html file, put in assets folder
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title></title>      
    <meta charset="utf-8" /> 
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />      
    <!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
    <link href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.css" rel="stylesheet" />
    <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.js"></script>      
    <script>         
    	var map;          
    	//Your Azure Maps key. Get an Azure Maps key at https://azure.com/maps.
    	//Consider storing this in a secure location and loading it when when calling get map.
    	var subscriptionKey = 'key';
    	function getMap() 
    	{
    		//Initialize a map instance.
    		map = new atlas.Map('myMap', 
    		{
    			center: [-97, 39], zoom: 3,
    			// style: 'grayscale_dark',
    			view: 'Auto',
    			//Add authentication details for connecting to Azure Maps.
    			authOptions: 
    			{
    				authType: 'subscriptionKey',
    				subscriptionKey: subscriptionKey
    			}
    		});
    	}
    	function setMapView(cameraOptions) {
    		map.setCamera(cameraOptions);
    	}
    </script>
    <style>         
    	html, body {
    		margin: 0;             
    		padding: 0;             
    		width: 100%;             
    		height: 100%;         
    	} 
             #myMap {             
    		position: relative;             
    		width: 100%;             
    		height: 100%;         
    	}       
    </style> 
    </head> 
    <body onload="getMap()">
    	<div id="myMap"></div>
    </body>
    </html>
    
    • MainPage.xaml call WebView2
    <Page x:Class="Map.MainPage"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:local="using:Map"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          xmlns:webview="using:Microsoft.UI.Xaml.Controls"
          mc:Ignorable="d"
          Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">      
    	<Grid> 		
    		<webview:WebView2 x:Name="MyWebView" />
    	</Grid>
    </Page>
    
    • MainPage.xaml.cs call the azuremap.html for WebView
    using System; 
    using Microsoft.UI.Xaml.Controls; 
    using Windows.UI.Xaml; 
    using Windows.UI.Xaml.Controls; 
    using Windows.UI.Xaml.Navigation; 
    using System.Diagnostics; 
    using Windows.Storage;
     
    namespace Map 
    {          
    	public sealed partial class MainPage : Page     
    	{         
    		public MainPage()         
    		{             
    			this.InitializeComponent();             
    			Loaded += MainPage_Loaded;         
    		}
            private async void MainPage_Loaded(object sender, RoutedEventArgs e)         
    		{             
    			try             
    			{                 
    				await MyWebView.EnsureCoreWebView2Async();
    				MyWebView.CoreWebView2.Settings.AreDevToolsEnabled = true;
    				var htmlFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/azuremap.html"));
    				MyWebView.Source = new Uri($"file:///{htmlFile.Path}");             
    			}             
    			catch (Exception ex)             
    			{
    			}                                  
    		}         
    	}     
    }
    

    Let me know if you need any helps! Thank you!

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.