Python client library for managing Azure Maps resources through the Azure Resource Manager
npx @tessl/cli install tessl/pypi-azure-mgmt-maps@2.1.0A comprehensive Python client library for managing Azure Maps resources through the Azure Resource Manager. This library provides programmatic access to create, configure, and manage Azure Maps accounts, creators, and related resources with full support for Azure Active Directory authentication and both synchronous and asynchronous operations.
pip install azure-mgmt-maps azure-identityfrom azure.mgmt.maps import AzureMapsManagementClient
from azure.identity import DefaultAzureCredentialAsynchronous client:
from azure.mgmt.maps.aio import AzureMapsManagementClient
from azure.identity.aio import DefaultAzureCredentialModels and types:
from azure.mgmt.maps.models import (
MapsAccount, Creator, MapsAccountProperties,
MapsAccountKeys, MapsAccountSasToken, AccountSasParameters,
MapsAccountUpdateParameters, CreatorUpdateParameters, MapsKeySpecification,
ManagedServiceIdentity, CorsRules, CorsRule, CreatorProperties,
Sku, Kind, KeyType, SigningKey, ManagedServiceIdentityType
)
from typing import IOimport os
from azure.identity import DefaultAzureCredential
from azure.mgmt.maps import AzureMapsManagementClient
from azure.mgmt.maps.models import MapsAccount, Sku, Kind
# Initialize client with Azure credentials
credential = DefaultAzureCredential()
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = AzureMapsManagementClient(
credential=credential,
subscription_id=subscription_id
)
# Create a new Maps account
maps_account = MapsAccount(
location="eastus",
sku=Sku(name="S0"), # Free tier
kind=Kind.GEN2,
properties={} # Use default properties
)
created_account = client.accounts.create_or_update(
resource_group_name="my-resource-group",
account_name="my-maps-account",
maps_account=maps_account
)
print(f"Created Maps account: {created_account.name}")
# List accounts in subscription
accounts = list(client.accounts.list_by_subscription())
print(f"Found {len(accounts)} Maps accounts")
# Get account keys
keys = client.accounts.list_keys(
resource_group_name="my-resource-group",
account_name="my-maps-account"
)
print(f"Primary key: {keys.primary_key}")The Azure Maps Management Client follows the Azure SDK design patterns:
AzureMapsManagementClient serves as the main entry point, managing authentication and providing access to operation groupsaccounts, maps, creators) each handling specific resource typesThe client supports both synchronous and asynchronous operations, enabling integration with various Python applications from simple scripts to high-performance async web services.
Complete lifecycle management of Azure Maps accounts including creation, configuration, monitoring, and deletion. Handles authentication keys, SAS tokens, CORS settings, encryption, and managed identities.
class AccountsOperations:
# Account lifecycle
def create_or_update(self, resource_group_name: str, account_name: str, maps_account: Union[MapsAccount, IO], **kwargs) -> MapsAccount: ...
def update(self, resource_group_name: str, account_name: str, maps_account_update_parameters: Union[MapsAccountUpdateParameters, IO], **kwargs) -> MapsAccount: ...
def delete(self, resource_group_name: str, account_name: str, **kwargs) -> None: ...
def get(self, resource_group_name: str, account_name: str, **kwargs) -> MapsAccount: ...
# Account discovery
def list_by_resource_group(self, resource_group_name: str, **kwargs) -> Iterable[MapsAccount]: ...
def list_by_subscription(self, **kwargs) -> Iterable[MapsAccount]: ...
# Authentication & access
def list_keys(self, resource_group_name: str, account_name: str, **kwargs) -> MapsAccountKeys: ...
def regenerate_keys(self, resource_group_name: str, account_name: str, key_specification: Union[MapsKeySpecification, IO], **kwargs) -> MapsAccountKeys: ...
def list_sas(self, resource_group_name: str, account_name: str, maps_account_sas_parameters: Union[AccountSasParameters, IO], **kwargs) -> MapsAccountSasToken: ...Management of Azure Maps Creator resources for uploading and managing custom map data, including indoor maps, floor plans, and custom geographic datasets.
class CreatorsOperations:
# Creator lifecycle
def create_or_update(self, resource_group_name: str, account_name: str, creator_name: str, creator_resource: Union[Creator, IO], **kwargs) -> Creator: ...
def update(self, resource_group_name: str, account_name: str, creator_name: str, creator_update_parameters: Union[CreatorUpdateParameters, IO], **kwargs) -> Creator: ...
def delete(self, resource_group_name: str, account_name: str, creator_name: str, **kwargs) -> None: ...
def get(self, resource_group_name: str, account_name: str, creator_name: str, **kwargs) -> Creator: ...
# Creator discovery
def list_by_account(self, resource_group_name: str, account_name: str, **kwargs) -> Iterable[Creator]: ...Discovery and metadata operations for Azure Maps service capabilities, providing information about available operations and service specifications.
class MapsOperations:
# Operations discovery
def list_operations(self, **kwargs) -> Iterable[OperationDetail]: ...
def list_subscription_operations(self, **kwargs) -> Iterable[OperationDetail]: ...class AzureMapsManagementClient:
"""
Azure Maps Management Client.
Args:
credential: Azure credential for authentication
subscription_id: Azure subscription ID
base_url: Service endpoint (default: https://management.azure.com)
api_version: API version (default: 2023-06-01)
"""
def __init__(
self,
credential: TokenCredential,
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs
) -> None: ...
# Operation groups
accounts: AccountsOperations
creators: CreatorsOperations
maps: MapsOperations
# Context management
def close(self) -> None: ...
def __enter__(self) -> "AzureMapsManagementClient": ...
def __exit__(self, *exc_details) -> None: ...class MapsAccount:
"""Azure Maps Account resource."""
# Resource properties
id: Optional[str]
name: Optional[str]
type: Optional[str]
location: Optional[str]
tags: Optional[Dict[str, str]]
# Maps-specific properties
sku: Optional[Sku]
kind: Optional[Union[str, Kind]]
identity: Optional[ManagedServiceIdentity]
properties: Optional[MapsAccountProperties]
system_data: Optional[SystemData]
class MapsAccountUpdateParameters:
"""Parameters for updating a Maps Account."""
tags: Optional[Dict[str, str]]
kind: Optional[Union[str, Kind]]
sku: Optional[Sku]
identity: Optional[ManagedServiceIdentity]
properties: Optional[MapsAccountProperties]
class Creator:
"""Azure Maps Creator resource."""
# Resource properties
id: Optional[str]
name: Optional[str]
type: Optional[str]
location: Optional[str]
tags: Optional[Dict[str, str]]
# Creator-specific properties
properties: Optional[CreatorProperties]
system_data: Optional[SystemData]
class CreatorUpdateParameters:
"""Parameters for updating a Creator resource."""
tags: Optional[Dict[str, str]]
properties: Optional[CreatorProperties]
class CreatorProperties:
"""Creator resource properties."""
provisioning_state: Optional[str] # Read-only
storage_units: Optional[int] # Required for creation, range 1-100class MapsAccountKeys:
"""Maps account access keys."""
primary_key: Optional[str] # Read-only
secondary_key: Optional[str] # Read-only
primary_key_last_updated: Optional[str] # Read-only, last updated timestamp
secondary_key_last_updated: Optional[str] # Read-only, last updated timestamp
class MapsAccountSasToken:
"""SAS token for Maps account access."""
account_sas_token: Optional[str]
class AccountSasParameters:
"""Parameters for creating SAS tokens."""
signing_key: Union[str, SigningKey] # Required
principal_id: str # Required
regions: Optional[List[str]] # Optional
max_rate_per_second: int = 500 # Required, default=500, max=500, min>0
start: str # Required, ISO 8601 datetime
expiry: str # Required, ISO 8601 datetimeclass Kind(str, Enum):
"""Maps account kind/generation."""
GEN1 = "Gen1"
GEN2 = "Gen2"
class KeyType(str, Enum):
"""Account key types."""
PRIMARY = "primary"
SECONDARY = "secondary"
class SigningKey(str, Enum):
"""SAS signing key types."""
PRIMARY_KEY = "primaryKey"
SECONDARY_KEY = "secondaryKey"
MANAGED_IDENTITY = "managedIdentity"
class ManagedServiceIdentityType(str, Enum):
"""Managed service identity types."""
NONE = "None"
SYSTEM_ASSIGNED = "SystemAssigned"
USER_ASSIGNED = "UserAssigned"
SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned"
class MapsKeySpecification:
"""Parameters for regenerating account keys."""
key_type: Union[str, KeyType] # Required