{"id":1371,"library":"azure-mgmt-maps","title":"Microsoft Azure Maps Client Library for Python","description":"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.","status":"active","version":"2.1.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/maps/azure-mgmt-maps","tags":["azure","cloud","maps","management","sdk"],"install":[{"cmd":"pip install azure-mgmt-maps","lang":"bash","label":"Install core library"},{"cmd":"pip install azure-identity","lang":"bash","label":"Install for Azure AD authentication"}],"dependencies":[{"reason":"Required by underlying Azure SDK components.","package":"azure-common","optional":false},{"reason":"Required by underlying Azure SDK management components.","package":"azure-mgmt-core","optional":false},{"reason":"Required by underlying Azure SDK components.","package":"azure-core","optional":false},{"reason":"Required for REST client operations.","package":"msrest","optional":false},{"reason":"Recommended for Azure Active Directory authentication.","package":"azure-identity","optional":true}],"imports":[{"note":"The client class was renamed from `AzureMapsManagementClient` (pre-2.x) to `MapsManagementClient` in 2.x. While some older documentation or PyPI snippets might still show the old name, `MapsManagementClient` is the current and correct class to import for versions 2.x and later.","wrong":"from azure.mgmt.maps import AzureMapsManagementClient","symbol":"MapsManagementClient","correct":"from azure.mgmt.maps import MapsManagementClient"},{"note":"Used for Azure Active Directory authentication in the Azure SDK for Python.","symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.maps import MapsManagementClient\n\n# Set your Azure Subscription ID as an environment variable (AZURE_SUBSCRIPTION_ID)\nsubscription_id = os.environ.get(\"AZURE_SUBSCRIPTION_ID\", \"\")\nresource_group_name = \"myMapsResourceGroup\" # Replace with your resource group name\nmaps_account_name = \"myUniqueMapsAccount\" # Replace with your desired Maps account name\nlocation = \"eastus\" # Replace with your desired Azure region\n\nif not subscription_id:\n    print(\"Please set the AZURE_SUBSCRIPTION_ID environment variable.\")\nelse:\n    # Authenticate using DefaultAzureCredential\n    # This credential will attempt to authenticate via several mechanisms,\n    # including environment variables, managed identity, and Azure CLI/PowerShell.\n    credential = DefaultAzureCredential()\n\n    # Create a MapsManagementClient\n    maps_client = MapsManagementClient(credential, subscription_id)\n\n    print(f\"Listing existing Maps accounts in subscription '{subscription_id}'...\")\n    for account in maps_client.accounts.list_by_subscription():\n        print(f\"  - {account.name} (Location: {account.location}, SKU: {account.sku.name})\")\n\n    print(f\"\\nCreating or updating Maps account '{maps_account_name}' in resource group '{resource_group_name}'...\")\n    try:\n        # Ensure the resource group exists before creating a Maps account.\n        # This example assumes the resource group already exists.\n        maps_account = maps_client.accounts.begin_create_or_update(\n            resource_group_name=resource_group_name,\n            account_name=maps_account_name,\n            account={\n                \"location\": location,\n                \"sku\": {\"name\": \"G2\"}, # 'S1' (Gen1) or 'G2' (Gen2) are common SKUs\n                \"tags\": {\"environment\": \"development\", \"project\": \"maps-demo\"}\n            }\n        ).result()\n        print(f\"Successfully created/updated Maps account: {maps_account.name} (SKU: {maps_account.sku.name})\")\n\n        print(f\"\\nGetting keys for Maps account '{maps_account_name}'...\")\n        keys = maps_client.accounts.list_keys(resource_group_name, maps_account_name)\n        print(f\"  - Primary Key: {keys.primary_key}\")\n\n        # Optional: Delete the Maps account\n        # print(f\"\\nDeleting Maps account '{maps_account_name}'...\")\n        # maps_client.accounts.begin_delete(resource_group_name, maps_account_name).result()\n        # print(f\"Maps account '{maps_account_name}' deleted successfully.\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\n","lang":"python","description":"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."},"warnings":[{"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.","message":"In `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`.","severity":"breaking","affected_versions":">=2.0.0"},{"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.","message":"Version 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`.","severity":"breaking","affected_versions":">=2.0.0"},{"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.","message":"As 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`.","severity":"breaking","affected_versions":">=2.0.0"},{"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.","message":"A 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.","severity":"breaking","affected_versions":"3.0.0b1"},{"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.","message":"To 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.","severity":"gotcha","affected_versions":"All"},{"fix":"Always include a valid `sku` object (e.g., `{\"name\": \"G2\"}`) in your account creation or update payload.","message":"When 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.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}