or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

api-management.mdindex.mdpolicy-management.mdservice-management.md
tile.json

tessl/pypi-azure-mgmt-apimanagement

Microsoft Azure API Management Client Library for Python providing comprehensive SDK functionality for managing Azure API Management services.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-mgmt-apimanagement@5.0.x

To install, run

npx @tessl/cli install tessl/pypi-azure-mgmt-apimanagement@5.0.0

index.mddocs/

Azure API Management Client Library

Microsoft Azure API Management Client Library for Python provides comprehensive SDK functionality for programmatically managing and configuring Azure API Management instances. This library enables developers to automate API lifecycle management, implement governance policies, configure authentication systems, manage developer portals, and monitor API usage through Python applications.

Package Information

  • Package Name: azure-mgmt-apimanagement
  • Package Type: pip
  • Language: Python
  • Installation: pip install azure-mgmt-apimanagement
  • Dependencies: isodate>=0.6.1, typing-extensions>=4.6.0, azure-common>=1.1, azure-mgmt-core>=1.3.2, azure-identity (for authentication)

Core Imports

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

Basic Usage

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

# Create client with authentication
credential = DefaultAzureCredential()
client = ApiManagementClient(
    credential=credential,
    subscription_id="your-subscription-id"
)

# List API Management services
services = list(client.api_management_service.list_by_subscription())
for service in services:
    print(f"Service: {service.name}, Location: {service.location}")

# Get a specific API Management service
service = client.api_management_service.get(
    resource_group_name="my-resource-group",
    service_name="my-apim-service"
)

# List APIs in the service
apis = list(client.api.list_by_service(
    resource_group_name="my-resource-group",
    service_name="my-apim-service"
))
for api in apis:
    print(f"API: {api.name}, Path: {api.path}")

Architecture

The Azure API Management Client Library follows Azure SDK design principles:

  • Client: ApiManagementClient serves as the main entry point providing access to all operation groups
  • Operations: Specialized operation classes for different API Management resources (APIs, products, users, policies, etc.)
  • Models: Data transfer objects representing Azure API Management resources and their properties
  • Authentication: Integration with Azure Identity library for secure credential management
  • Long-Running Operations: Support for async operations with polling and result retrieval

The library provides both synchronous and asynchronous clients, comprehensive error handling, automatic retries, logging integration, and follows Azure ARM (Azure Resource Manager) patterns for consistent resource management across Azure services.

Capabilities

Service Management

Core API Management service lifecycle operations including creating, updating, configuring, and monitoring API Management instances. Includes service-level settings, SKU management, network configuration, and backup/restore capabilities.

class ApiManagementServiceOperations:
    def get(self, resource_group_name: str, service_name: str, **kwargs) -> ApiManagementServiceResource: ...
    def begin_create_or_update(self, resource_group_name: str, service_name: str, parameters: ApiManagementServiceResource, **kwargs) -> LROPoller[ApiManagementServiceResource]: ...
    def begin_update(self, resource_group_name: str, service_name: str, parameters: ApiManagementServiceUpdateParameters, **kwargs) -> LROPoller[ApiManagementServiceResource]: ...
    def begin_delete(self, resource_group_name: str, service_name: str, **kwargs) -> LROPoller[None]: ...
    def list_by_subscription(self, **kwargs) -> ItemPaged[ApiManagementServiceResource]: ...
    def list_by_resource_group(self, resource_group_name: str, **kwargs) -> ItemPaged[ApiManagementServiceResource]: ...

Service Management

API Management

Comprehensive API lifecycle management including API creation, versioning, revisions, operations, schemas, policies, and export/import capabilities. Supports REST, SOAP, GraphQL, and WebSocket APIs.

class ApiOperations:
    def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs) -> ApiContract: ...
    def begin_create_or_update(self, resource_group_name: str, service_name: str, api_id: str, parameters: ApiCreateOrUpdateParameter, **kwargs) -> LROPoller[ApiContract]: ...
    def begin_update(self, resource_group_name: str, service_name: str, api_id: str, parameters: ApiUpdateContract, **kwargs) -> LROPoller[ApiContract]: ...
    def delete(self, resource_group_name: str, service_name: str, api_id: str, **kwargs) -> None: ...
    def list_by_service(self, resource_group_name: str, service_name: str, **kwargs) -> ItemPaged[ApiContract]: ...

API Management

Additional Operations

The library provides extensive additional operations for comprehensive API Management functionality:

  • Product Management: Product lifecycle, API associations, access policies, and subscription management
  • User and Group Management: User accounts, group administration, permissions, and developer portal access
  • Gateway Management: Self-hosted gateways, hybrid deployments, and gateway configuration
  • Authentication and Authorization: Identity providers, OAuth servers, JWT validation, and access policies
  • Backend Configuration: Backend services, load balancing, health monitoring, and service discovery
  • Monitoring and Analytics: Diagnostics, logging, reporting, and integration with Azure Monitor
  • Developer Portal: Portal configuration, customization, content management, and publishing
  • Workspace Management: Multi-workspace organization, resource isolation, and cross-workspace sharing
  • Certificate Management: SSL/TLS certificates, client certificates, and certificate authorities
  • Named Values: Key-value pairs, secrets management, and configuration variables
  • Subscription Management: API subscriptions, access keys, and usage quotas
  • Tag Management: Resource tagging, organization, and metadata management
  • Content Management: Documentation, email templates, and portal content
  • Network Configuration: Virtual networks, private endpoints, and connectivity settings

These operations follow the same patterns as the core capabilities documented above, with comprehensive CRUD operations, entity tag support, and long-running operation handling where applicable.

Policy Management

Comprehensive policy system for implementing cross-cutting concerns including authentication, rate limiting, transformation, caching, and routing. Supports policies at global, product, API, and operation levels.

class PolicyOperations:
    def get(self, resource_group_name: str, service_name: str, policy_id: str, **kwargs) -> PolicyContract: ...
    def create_or_update(self, resource_group_name: str, service_name: str, policy_id: str, parameters: PolicyContract, **kwargs) -> PolicyContract: ...
    def delete(self, resource_group_name: str, service_name: str, policy_id: str, **kwargs) -> None: ...
    def list_by_service(self, resource_group_name: str, service_name: str, **kwargs) -> ItemPaged[PolicyContract]: ...

class PolicyFragmentOperations:
    def get(self, resource_group_name: str, service_name: str, policy_fragment_id: str, **kwargs) -> PolicyFragmentContract: ...
    def begin_create_or_update(self, resource_group_name: str, service_name: str, policy_fragment_id: str, parameters: PolicyFragmentContract, **kwargs) -> LROPoller[PolicyFragmentContract]: ...
    def delete(self, resource_group_name: str, service_name: str, policy_fragment_id: str, **kwargs) -> None: ...
    def list_by_service(self, resource_group_name: str, service_name: str, **kwargs) -> ItemPaged[PolicyFragmentContract]: ...

Policy Management

Asynchronous Client

The library provides full async/await support through the aio module:

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

async def manage_apis():
    credential = DefaultAzureCredential()
    async with ApiManagementClient(credential, "subscription-id") as client:
        # Async operations
        async for service in client.api_management_service.list_by_subscription():
            print(f"Service: {service.name}")

Error Handling

The library uses Azure Core exceptions for consistent error handling:

from azure.core.exceptions import HttpResponseError, ResourceNotFoundError

try:
    service = client.api_management_service.get("rg", "service-name")
except ResourceNotFoundError:
    print("Service not found")
except HttpResponseError as e:
    print(f"HTTP error: {e.status_code} - {e.message}")

Types

All data models, enums, and type definitions are available through the models module:

from azure.mgmt.apimanagement.models import (
    ApiManagementServiceResource,
    ApiContract,
    ApiCreateOrUpdateParameter,
    ProductContract,
    UserContract,
    GroupContract,
    PolicyContract,
    PolicyFragmentContract,
    BackendContract,
    OperationContract,
    SchemaContract,
    # ... and 470+ other model classes
)

# For long-running operations and paging
from azure.core.polling import LROPoller
from azure.core.paging import ItemPaged