Skip to content

Add proxy to Azure Maps#63

Merged
anotherRedbeard merged 29 commits into
mainfrom
ar/azure-maps
Jun 19, 2025
Merged

Add proxy to Azure Maps#63
anotherRedbeard merged 29 commits into
mainfrom
ar/azure-maps

Conversation

@anotherRedbeard

Copy link
Copy Markdown
Contributor

This PR should satisfy Feature Request #42. Added to show how to use Azure API Management (APIM) to proxy calls to the Azure Maps service. It will also show the 3 different authentication methods supported by APIM policies (subscription key, Azure Entra AD, and SAS Tokens).

@github-actions

github-actions Bot commented Jun 17, 2025

Copy link
Copy Markdown

Python 3.12 Test Results

212 tests  ±0   212 ✅ ±0   1s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 5b39ce5. ± Comparison against base commit c2219ee.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jun 17, 2025

Copy link
Copy Markdown

Python 3.13 Test Results

212 tests  ±0   212 ✅ ±0   1s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 5b39ce5. ± Comparison against base commit c2219ee.

♻️ This comment has been updated with latest results.

@simonkurtz-MSFT simonkurtz-MSFT requested review from Copilot and simonkurtz-MSFT and removed request for simonkurtz-MSFT June 17, 2025 21:02

This comment was marked as outdated.

Comment thread shared/bicep/modules/apim/v1/api.bicep Outdated
Comment thread samples/azure-maps/create.ipynb Outdated
Comment thread samples/azure-maps/map_default_route_v2_aad_get.xml
simonkurtz-MSFT and others added 19 commits June 17, 2025 18:19
- Updated the Azure Maps Jupyter notebook to include output messages for resource group initialization and deployment completion.
- Modified the API definitions in the notebook to remove unnecessary sample folder references and ensure correct API operations are included.
- Corrected the authentication method description in the notebook for the Default Route API.
- Fixed a typo in the Bicep template comments regarding the Azure Maps Contributor role.
- Removed the obsolete map_all_operations.xml file as it is no longer needed.
- Adjusted the API service URL assignment in the Bicep module to handle cases where the service URL might be absent.
- Updated the Azure Maps Jupyter notebook to include output messages for resource group initialization and deployment completion.
- Modified the API definitions in the notebook to remove unnecessary sample folder references and ensure correct API operations are included.
- Corrected the authentication method description in the notebook for the Default Route API.
- Fixed a typo in the Bicep template comments regarding the Azure Maps Contributor role.
- Removed the obsolete map_all_operations.xml file as it is no longer needed.
- Adjusted the API service URL assignment in the Bicep module to handle cases where the service URL might be absent.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for proxying Azure Maps calls through API Management, showcasing three authentication methods (subscription key, Azure AD, and SAS tokens) and handling asynchronous operations.

  • Extended the API model in Python to include a serviceUrl property.
  • Added an asynchronous POST helper with polling to the ApimRequests class.
  • Updated Bicep modules, sample policies, and deployment scripts for Azure Maps integration.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
shared/python/apimtypes.py Added serviceUrl field and serialization in the API type
shared/python/apimrequests.py Implemented _poll_async_operation and singlePostAsync methods
shared/bicep/modules/apim/v1/api.bicep Mapped serviceUrl into the APIM API resource
samples/azure-maps/*.xml Provided policy XML samples for each authentication method
samples/azure-maps/main.bicep New sample Bicep deployment for Azure Maps with APIM
samples/azure-maps/create.ipynb Notebook guiding deployment and testing of the sample
samples/azure-maps/README.md Documentation for the Azure Maps APIM proxy sample
README.md Added Azure Maps sample entry to the top-level README
Comments suppressed due to low confidence (4)

samples/azure-maps/create.ipynb:25

  • [nitpick] Using 'index' as a variable name may be ambiguous and shadow common built-ins; consider renaming to something more descriptive like 'sampleIndex'.
    "index       = 1\n",

shared/python/apimrequests.py:228

  • The 'time' module is used here but not imported in this file, which will cause a NameError. Please add 'import time' at the top of the module.
        start_time = time.time()

shared/python/apimtypes.py:186

  • [nitpick] Including 'serviceUrl' in the output dictionary when it's None may lead to unexpected null values in serialized JSON. Consider conditionally adding this key only when 'serviceUrl' is set.
            "serviceUrl": self.serviceUrl,

samples/azure-maps/README.md:1

  • There's a typo in the title: 'proxing' should be spelled 'proxying'.
# Samples: Api Management proxing calls to Azure Maps

@simonkurtz-MSFT simonkurtz-MSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for setting all of this up, @anotherRedbeard!

Comment thread samples/azure-maps/create.ipynb
Comment thread samples/azure-maps/main.bicep Outdated
Comment thread samples/azure-maps/main.bicep
Comment thread samples/azure-maps/create.ipynb
Comment thread samples/azure-maps/main.bicep
Comment thread samples/azure-maps/README.md Outdated

@simonkurtz-MSFT simonkurtz-MSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome, @anotherRedbeard! Thank you for putting this together! Squash merge at will, please.

@anotherRedbeard anotherRedbeard merged commit ccda532 into main Jun 19, 2025
7 checks passed
@anotherRedbeard anotherRedbeard deleted the ar/azure-maps branch June 19, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants