How can I use Azure Maps Weather API to display location based snowfall forecasts in my website?

Kylie Dev 100 Reputation points
2026-11-30T15:36:35.78+00:00

Hi, I'm working on a weather related tool website ProtonReader and want to improve its snowfall forecasting feature.

I'm looking into the Azure Maps Weather API to show location based forecasts including snowfall probability, expected accumulation and daily temperature.

Can I combine the Azure Maps Search API with the Weather API to get live forecasts using a user's city name or ZIP code? Also tell me, what's the best way to handle API requests securely without exposing the subscription key?

I'd appreciate any advice. Thanks!

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.


Answer accepted by question author
SHOUMIK CHAKRAVARTY 1,795 Reputation points
2026-12-01T04:40:36.21+00:00

Hi @Kylie Dev

1. Can I combine Azure Maps Search with the Weather API?

Yes. In fact, you need to, because the Weather API only accepts coordinates. From Get Daily Forecast, the query parameter is:

"The applicable query specified as a comma separated string composed by latitude followed by longitude e.g. "47.641268,-122.125679"."

A typical flow is:

  1. User enters a city name or ZIP code.
  2. Use Azure Maps Search to get the latitude and longitude.
  3. Pass those coordinates to the Weather API.

Example:

GET https://atlas.microsoft.com/weather/forecast/daily/json?api-version=1.1&query={lat},{lon}&duration=15

duration accepts 1, 5, 10, 15, 25 or 45 days. For snowfall, the daily forecast response includes snowProbability, hoursOfSnow and a snow object, so the data you need is already in there.

2. How do I keep the Azure Maps key out of the browser?

A key in your front-end code is readable by anyone who looks, so it is worth moving before you launch. From Authentication with Azure Maps:

"Primary and Secondary keys should be treated as sensitive data."

Since you're already using App Service, the simplest approach is to keep the key on the server and have your backend call Azure Maps. The browser then talks only to your API and never sees the key.

If you prefer not to proxy, Azure Maps also supports Microsoft Entra authentication and SAS tokens. For browser applications, see Secure a single page application with user sign-in.

If you go the Entra route specifically, you can also set disableLocalAuth on the Maps account. Worth knowing what that covers:

"When true, all authentication to the Azure Maps data-plane REST API is disabled, except Microsoft Entra authentication."

So it rules out SAS tokens as well as keys, which makes it a good lock once you are fully on Entra and a problem if you still need either.

Help make this community better for everyone: if this answer resolved your issue, please accept it or leave an upvote. If not, share more details in a comment so we can continue the discussion and find the right solution.

Was this answer helpful?

2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

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.