Registry / azure / azure-mgmt-cdn

azure-mgmt-cdn

JSON →
library14.0.0pypypi✓ verified 25d ago

The Azure CDN Management Client Library for Python provides programmatic access to manage Azure Content Delivery Network (CDN) resources. It allows users to create, configure, update, and delete CDN profiles, endpoints, and custom domains. Part of the broader Azure SDK for Python, it follows the SDK's consistent design principles and release cadence, typically receiving updates as new Azure API versions are released or significant changes occur in the underlying service, often with minor version bumps and major version updates for breaking changes.

pip install azure-mgmt-cdn
INSTALL
IMPORT
SIG · AZURE-MGMT-CDN
A
azure-mgmt-cdn
azurepythonv14.0.0
Install
2.8s avg
Import
751ms
Disk
27MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v14.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.808s · 28MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.8s · import 0.694s · 29MB
27MB installed
● package 27MB
Code
Verified usage

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

CdnManagementClient
from azure.mgmt.cdn import CdnManagementClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
from azure.common.credentials import ServicePrincipalCredentials
Old authentication methods (e.g., from `azure-common` or `msrestazure`) are deprecated in favor of `azure-identity`.

This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and list existing CDN profiles in your subscription. Ensure the `AZURE_SUBSCRIPTION_ID` environment variable is set. It highlights the typical pattern for creating the client and iterating over paginated results.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.cdn import CdnManagementClient # --- Configuration --- # Ensure AZURE_SUBSCRIPTION_ID is set in your environment variables. # You can also set AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET for service principal auth. AZURE_SUBSCRIPTION_ID = os.environ.get("AZURE_SUBSCRIPTION_ID", "") if not AZURE_SUBSCRIPTION_ID: print("Please set the AZURE_SUBSCRIPTION_ID environment variable.") exit(1) print(f"Using Subscription ID: {AZURE_SUBSCRIPTION_ID}") # Authenticate with Azure using DefaultAzureCredential # This credential chain attempts to authenticate via various methods: # Environment variables, Managed Identity, Visual Studio Code, Azure CLI, Azure PowerShell. credential = DefaultAzureCredential() # Create a CDN management client # All CDN operations are performed through this client object. client = CdnManagementClient(credential, AZURE_SUBSCRIPTION_ID) print("\nListing CDN Profiles in the subscription...") # List all CDN profiles. This returns an iterator (ItemPaged). # Iterating directly fetches pages as needed. cdn_profiles = client.profiles.list() profile_count = 0 for profile in cdn_profiles: profile_count += 1 print(f" - Profile Name: {profile.name}, Location: {profile.location}, Sku: {profile.sku.name}") if profile_count == 0: print(" No CDN profiles found in this subscription.") else: print(f"Found {profile_count} CDN profile(s).") # Example of a long-running operation (creation of a CDN profile) # This would typically involve a begin_ method and a poller. # resource_group_name = "myResourceGroup" # profile_name = "myUniqueCdnProfile" # profile_parameters = { # "location": "westus", # "sku": {"name": "Standard_Microsoft"} # } # print(f"\nStarting creation of CDN Profile '{profile_name}'...") # poller = client.profiles.begin_create(resource_group_name, profile_name, profile_parameters) # profile = poller.result() # Wait for the operation to complete # print(f"CDN Profile '{profile.name}' created successfully.")
Debug
Known issues
breakingMajor version 13.0.0 introduced significant breaking changes, primarily standardizing on `azure-identity` for authentication and `azure-core` for common client primitives. If upgrading from versions prior to 13.0.0, expect changes to authentication mechanisms and potentially to resource model classes and method signatures.
fix
Update authentication code to use `azure.identity.DefaultAzureCredential` or other `azure-identity` credentials. Review the official changelog for specific API changes to resource models and operations.
affects: <13.0.0
gotchaOperations that create, update, or delete resources (e.g., `profiles.begin_create`) are often long-running operations and return a 'poller' object (e.g., `LROPoller`). You must call `.result()` on the poller to wait for the operation to complete and retrieve the final resource object or status.
fix
Always call `.result()` on the `begin_` method's return value for long-running operations: `poller = client.profiles.begin_create(...); created_profile = poller.result()`.
affects: >=13.0.0
gotchaListing operations (e.g., `client.profiles.list()`, `client.endpoints.list_by_profile()`) return an iterable object (e.g., `ItemPaged`), not a direct list. This object automatically handles pagination internally. Attempting to index directly or treat it as a static list without iterating might lead to unexpected behavior or incomplete data.
fix
Iterate directly over the returned object (e.g., `for profile in client.profiles.list():`) or convert it explicitly to a list if all results are needed at once (e.g., `list(client.profiles.list())`).
affects: >=13.0.0
gotcha`DefaultAzureCredential` attempts multiple authentication methods. While convenient, it can sometimes be unclear which method is being used or why authentication is failing. For production environments or specific scenarios (e.g., CI/CD, Managed Identity), it's often more robust to explicitly use a specific credential type.
fix
For troubleshooting, enable logging for `azure.identity`. For explicit control, use specific credential classes like `EnvironmentCredential`, `ManagedIdentityCredential`, or `ServicePrincipalCredential` from `azure.identity`.
affects: >=13.0.0
breakingA `ModuleNotFoundError` for `azure.identity` indicates that the `azure-identity` package, a critical dependency for authentication, is not installed. This prevents any usage of `azure-identity` credentials.
fix
Ensure the `azure-identity` package is installed. You can install it directly via `pip install azure-identity` or verify it's included as a dependency when installing your specific Azure SDK client library.
affects: *
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'azure.mgmt.cdn.cdn_management_client'
In older versions of `azure-mgmt-cdn`, the `CdnManagementClient` was sometimes imported from `azure.mgmt.cdn.cdn_management_client`. A breaking change in a newer major version (e.g., 10.0.0 or later) moved the client directly under `azure.mgmt.cdn` to simplify imports.
fix
Update your import statement to `from azure.mgmt.cdn import CdnManagementClient`.
DefaultAzureCredential failed to retrieve a token from the included credentials
This error indicates that `DefaultAzureCredential`, which attempts to authenticate using several methods (environment variables, Azure CLI, managed identity, etc.), could not find valid credentials in any of the configured locations. This often happens due to missing environment variables, an unauthenticated Azure CLI session, or incorrect service principal configuration.
fix
Ensure you are logged into Azure CLI (`az login`), or set the necessary environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`). Alternatively, use a more specific credential type if `DefaultAzureCredential` is not suitable for your deployment environment.
In order to create this CDN profile, please ensure that Microsoft.CDN is listed as a registered Resource Provider in your Azure subscription
Before you can deploy CDN resources in an Azure subscription, the `Microsoft.Cdn` resource provider must be registered within that subscription. If it's not registered, Azure doesn't know how to handle CDN-related resource requests.
fix
Register the `Microsoft.Cdn` resource provider using the Azure CLI (`az provider register --namespace Microsoft.Cdn`), Azure PowerShell (`Register-AzResourceProvider -ProviderNamespace Microsoft.Cdn`), or through the Azure portal by navigating to Subscriptions -> Resource Providers and registering 'Microsoft.Cdn'.
The number of profiles created exceeds quota. Please contact support to increase quota. (Code: BadRequest)
Azure subscriptions have default limits (quotas) on the number of certain resources that can be created. This error occurs when you attempt to create a new CDN profile or other CDN-related resource that would exceed your subscription's current quota.
fix
Contact Azure Support to request an increase in your subscription's quota for CDN profiles or the specific CDN resource you are trying to create. Provide your subscription ID and the requested quota limit.
Upgrade
Version history
14.0.0latest on PyPI · released Jul 14, 2026
Audit
Dependencies
azure-identityrequiredRequired for authentication with Azure services using modern credential flows.
azure-corerequiredProvides shared primitives, exceptions, and operations for Azure SDK client libraries.
Agent activity
32 hits · last 30 days
node
24
OpenAI (training)
1
Resources
azure-mgmt-cdn — pip install azure-mgmt-cdn · libregistry