Registry / azure / azure-mgmt-apimanagement

azure-mgmt-apimanagement

JSON →
library5.0.0pypypi✓ verified 25d ago

The Azure API Management Client Library for Python provides programmatic control over Azure API Management (APIM) resources. It enables developers and DevOps engineers to create, update, and manage APIM services, APIs, products, subscriptions, and policies. Currently at version 5.0.0, it is actively maintained as part of the Azure SDK for Python, with a regular release cadence.

pip install azure-mgmt-apimanagement azure-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-APIMANA
A
azure-mgmt-apimanagement
azurepythonv5.0.0
Install
4.6s avg
Import
825ms
Disk
59MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.0.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.95 runs
installs and imports cleanly · install 0.0s · import 0.876s · 58.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.6s · import 0.774s · 59MB
59MB installed
● package 59MB
Code
Verified usage

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

ApiManagementClient
from azure.mgmt.apimanagement import ApiManagementClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential

Initializes the `ApiManagementClient` using `DefaultAzureCredential` and lists all API Management services within the specified Azure subscription. Ensure your Azure authentication environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET) and AZURE_SUBSCRIPTION_ID are set for `DefaultAzureCredential` to work correctly. [1, 2, 7]

import os from azure.identity import DefaultAzureCredential from azure.mgmt.apimanagement import ApiManagementClient # Set environment variables or replace with your actual values # AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET must be set for DefaultAzureCredential # AZURE_SUBSCRIPTION_ID is also required for the client subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID') # Authenticate and create API Management client try: credential = DefaultAzureCredential() client = ApiManagementClient(credential, subscription_id) print(f"Successfully authenticated for subscription: {subscription_id}") # List all API Management services in the subscription print("Listing API Management services...") for service in client.api_management_service.list(): print(f" - Name: {service.name}, Location: {service.location}, SKU: {service.sku.name}") except Exception as e: print(f"An error occurred: {e}") print("Please ensure AZURE_SUBSCRIPTION_ID and Azure authentication environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET) are correctly set.")
Debug
Known issues
breakingStarting June 1, 2024, all Azure API Management service API versions prior to 2021-08-01 are being retired (disabled). Management operations (creation, update, etc.) using older API versions via this SDK will fail. Data plane operations (API gateway) are unaffected. [23]
fix
Update `azure-mgmt-apimanagement` to version 3.0.0 or later and ensure your calls target API version 2021-08-01 or later in your service definitions or client initialization. [23]
affects: < 3.0.0 (when targeting API versions < 2021-08-01)
breakingTrusted service connectivity in API Management gateway will be retired on March 15, 2026. Review Azure guidance to determine if your API Management service is affected. [12]
fix
Consult Azure documentation for migration guidance related to trusted service connectivity retirement. [12]
affects: All versions if your API Management service relies on this feature.
gotcha`DefaultAzureCredential` relies on specific environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`) for token authentication. Misconfiguration of these variables is a common source of authorization errors. [1, 2, 7]
fix
Ensure `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, and `AZURE_SUBSCRIPTION_ID` environment variables are correctly set for `DefaultAzureCredential` to function. [1, 2, 7]
affects: All versions using `azure-identity` for authentication.
breakingVersion 5.0.0 introduced several new operation groups (e.g., `api_gateway`, `api_management_gateway_skus`, `all_policies`). Existing code interacting with these areas in previous versions may require updates to use the new client methods and structures. [1]
fix
Review the release notes for version 5.0.0 and update client calls to leverage the new operation groups and their methods where applicable. [1]
affects: Transitioning from `azure-mgmt-apimanagement` < 5.0.0 to 5.0.0+
Upgrade
Version history
5.0.0latest on PyPI · released Apr 22, 2025
Audit
Dependencies
pythonrequiredRequired Python version
azure-identityrequiredUsed for Azure Active Directory token authentication
azure-mgmt-coreoptionalCommon dependency for Azure management libraries
azure-commonoptionalCommon dependency for Azure libraries
isodateoptionalDependency for date/time parsing
Agent activity
41 hits · last 30 days
node
36
OpenAI (training)
1
Resources
azure-mgmt-apimanagement — pip install azure-mgmt-apimanagement · libregistry