Registry / azure / azure-mgmt-maps

azure-mgmt-maps

JSON →
library2.1.0pypypi✓ verified 25d ago

The `azure-mgmt-maps` library provides Python client APIs for managing Azure Maps accounts and resources. It enables programmatic interaction with Azure Maps, allowing operations such as creating, updating, deleting, and listing Maps accounts, as well as managing account keys. The current stable version is 2.1.0, released in September 2023, and it follows the Azure SDK for Python's release cadence, with major versions indicating potential breaking changes.

pip install azure-mgmt-maps
INSTALL
IMPORT
SIG · AZURE-MGMT-MAPS
A
azure-mgmt-maps
azurepythonv2.1.0
Install
3.1s avg
Import
Disk
53MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 98.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.1s · import 0.000s · 25MB
53MB installed
● package 53MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MapsManagementClient
from azure.mgmt.maps import MapsManagementClient
from azure.mgmt.maps import MapsManagementClient

This quickstart demonstrates how to authenticate with Azure, list existing Maps accounts, and create or update an Azure Maps account using the `azure-mgmt-maps` library. It uses `DefaultAzureCredential` for authentication, which is suitable for local development and production environments. Ensure you have an Azure subscription ID and an existing resource group.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.maps import MapsManagementClient # Set your Azure Subscription ID as an environment variable (AZURE_SUBSCRIPTION_ID) subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "") resource_group_name = "myMapsResourceGroup" # Replace with your resource group name maps_account_name = "myUniqueMapsAccount" # Replace with your desired Maps account name location = "eastus" # Replace with your desired Azure region if not subscription_id: print("Please set the AZURE_SUBSCRIPTION_ID environment variable.") else: # Authenticate using DefaultAzureCredential # This credential will attempt to authenticate via several mechanisms, # including environment variables, managed identity, and Azure CLI/PowerShell. credential = DefaultAzureCredential() # Create a MapsManagementClient maps_client = MapsManagementClient(credential, subscription_id) print(f"Listing existing Maps accounts in subscription '{subscription_id}'...") for account in maps_client.accounts.list_by_subscription(): print(f" - {account.name} (Location: {account.location}, SKU: {account.sku.name})") print(f"\nCreating or updating Maps account '{maps_account_name}' in resource group '{resource_group_name}'...") try: # Ensure the resource group exists before creating a Maps account. # This example assumes the resource group already exists. maps_account = maps_client.accounts.begin_create_or_update( resource_group_name=resource_group_name, account_name=maps_account_name, account={ "location": location, "sku": {"name": "G2"}, # 'S1' (Gen1) or 'G2' (Gen2) are common SKUs "tags": {"environment": "development", "project": "maps-demo"} } ).result() print(f"Successfully created/updated Maps account: {maps_account.name} (SKU: {maps_account.sku.name})") print(f"\nGetting keys for Maps account '{maps_account_name}'...") keys = maps_client.accounts.list_keys(resource_group_name, maps_account_name) print(f" - Primary Key: {keys.primary_key}") # Optional: Delete the Maps account # print(f"\nDeleting Maps account '{maps_account_name}'...") # maps_client.accounts.begin_delete(resource_group_name, maps_account_name).result() # print(f"Maps account '{maps_account_name}' deleted successfully.") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingIn `azure-mgmt-maps` version 2.0.0, the credential system was completely revamped. Old authentication methods (e.g., `azure.common.credentials` or `msrestazure.azure_active_directory`) are no longer supported. Users must migrate to `azure-identity` classes (e.g., `DefaultAzureCredential`). Additionally, the `credentials` parameter in client constructors was renamed to `credential`.
fix
Update your authentication logic to use classes from `azure.identity` (e.g., `DefaultAzureCredential`) and pass the credential object to the `credential` parameter of the `MapsManagementClient` constructor.
affects: >=2.0.0
breakingVersion 2.0.0 introduced several parameter renames for Maps account operations. Specifically, `maps_account_id` was renamed to `account_id` in methods like `accounts.delete`, `accounts.get`, `accounts.list_by_resource_group`, and `accounts.list_keys`. Similarly, `maps_account` was renamed to `account` in `accounts.create_or_update`.
fix
Review your code for method calls involving Maps accounts and update parameter names from `maps_account_id` to `account_id` and `maps_account` to `account` as appropriate.
affects: >=2.0.0
breakingAs of `azure-mgmt-maps` version 2.0.0, long-running operations (LROs) that previously returned `msrest.polling.LROPoller` now return `azure.core.polling.LROPoller` and are consistently prefixed with `begin_`. The `CloudError` exception has also been removed; most exceptions are now `azure.core.exceptions.HttpResponseError`.
fix
Adjust LRO calls to use the `begin_` prefix and handle `azure.core.exceptions.HttpResponseError` for general API errors. Update any custom error handling logic.
affects: >=2.0.0
breakingA beta version `3.0.0b1` introduces significant breaking changes related to 'hybrid models'. Many instance variables (e.g., `provisioning_state`, `storage_units`, `linked_resources`, `cors`, `encryption`) have moved under a `properties` object within models like `CreatorUpdateParameters` and `MapsAccountUpdateParameters`. Enum values like `Kind.GEN1` and `Name.S0`, `Name.S1` were also deleted or renamed.
fix
If upgrading to `3.0.0b1` or later, consult the migration guide for hybrid models and adjust property access accordingly. It's recommended to stick to stable versions unless actively testing beta features.
affects: 3.0.0b1
gotchaTo manage Azure Maps resources, the authenticated identity (e.g., via `DefaultAzureCredential`) must have appropriate Azure RBAC permissions. Roles like 'Maps Contributor' or 'Owner' are typically required to create, update, or delete Maps accounts.
fix
Ensure the service principal or user identity being used has the necessary RBAC roles assigned on the subscription, resource group, or Maps account scope.
affects: All
gotchaWhen creating or updating an Azure Maps account, the `sku` parameter is mandatory. It defines the pricing tier and capabilities (e.g., 'G2' for Gen2, 'S1' for Gen1). Omitting or providing an invalid SKU will result in a deployment error.
fix
Always include a valid `sku` object (e.g., `{"name": "G2"}`) in your account creation or update payload.
affects: All
breakingAfter upgrading to `azure-mgmt-maps` version 2.0.0 or later, users may encounter an `ImportError` stating `cannot import name 'MapsManagementClient' from 'azure.mgmt.maps'`. This indicates that the primary client class `MapsManagementClient` is no longer directly exposed at the top level of the package, or its name or import path has changed.
fix
Adjust the import statement for the Maps management client. Verify the correct class name and its module path within the `azure-mgmt-maps` package for your installed version. For example, it might be necessary to import from a specific submodule or to use a different client class name if it was renamed.
affects: >=2.0.0
breakingThe `MapsManagementClient` class causes an `ImportError` when attempting to import it directly from `azure.mgmt.maps` in `azure-mgmt-maps` versions 2.x. This prevents client instantiation and indicates a breaking change in the client's import path or availability that is not currently documented in the registry warnings.
fix
Review the `azure-mgmt-maps` documentation or inspect the installed package structure (e.g., `site-packages/azure/mgmt/maps`) to determine the correct import path and class name for the management client in version 2.x, and update your import statement accordingly.
affects: >=2.0.0
Upgrade
Version history
2.1.0latest on PyPI · released Sep 12, 2023
Audit
Dependencies
azure-commonrequiredRequired by underlying Azure SDK components.
azure-mgmt-corerequiredRequired by underlying Azure SDK management components.
azure-corerequiredRequired by underlying Azure SDK components.
msrestrequiredRequired for REST client operations.
azure-identityoptionalRecommended for Azure Active Directory authentication.
Agent activity
23 hits · last 30 days
node
18
OpenAI (training)
1
Resources
azure-mgmt-maps — pip install azure-mgmt-maps · libregistry