Registry / azure / azure-mgmt-privatedns

azure-mgmt-privatedns

JSON →
library2.0.0pypypi✓ verified 24d ago

The Microsoft Azure DNS Private Zones Client Library for Python allows you to create, configure, and manage private DNS zones within your Azure virtual networks. It provides programmatic access to manage private DNS zones, virtual network links, and DNS record sets. The current version is 1.2.0, released on September 23, 2024, and it is part of the Azure SDK for Python, which follows a regular release cadence with frequent updates across its libraries.

pip install azure-mgmt-privatedns azure-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-PRIVATE
A
azure-mgmt-privatedns
azurepythonv2.0.0
Install
3.9s avg
Import
568ms
Disk
43MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.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.598s · 44MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.538s · 44MB
43MB installed
● package 43MB
Code
Verified usage

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

PrivateDnsManagementClient
from azure.mgmt.privatedns import PrivateDnsManagementClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
from azure.common.credentials import ServicePrincipalCredentials
Old credential classes are deprecated and no longer supported; use azure-identity.

This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and then list all Private DNS zones available in your subscription using `PrivateDnsManagementClient`. Ensure your `AZURE_SUBSCRIPTION_ID` environment variable is set for this example to run correctly, along with other necessary Azure Identity environment variables for authentication.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.privatedns import PrivateDnsManagementClient # Set your Azure Subscription ID as an environment variable or replace with your ID # os.environ["AZURE_SUBSCRIPTION_ID"] = "<your-subscription-id>" # Authenticate using DefaultAzureCredential. It will try various methods like environment variables, # managed identity, Azure CLI, etc. For development, ensure AZURE_CLIENT_ID, AZURE_TENANT_ID, # and AZURE_CLIENT_SECRET (or AZURE_CLI_AUTH_TOKEN for CLI login) are set. credential = DefaultAzureCredential() subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "") if not subscription_id: raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.") client = PrivateDnsManagementClient(credential=credential, subscription_id=subscription_id) # Example: List all private DNS zones in the subscription print("Listing Private DNS Zones:") for zone in client.private_zones.list(): print(f" - Zone Name: {zone.name}, Resource Group: {zone.id.split('/')[4]}") # In a real application, ensure proper error handling and resource management (e.g., closing the client if needed). # client.close() # if using an older client or specific scenarios, typically not needed for management clients.
Debug
Known issues
breakingThe credential system was completely revamped. Old `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported.
fix
Migrate authentication to use classes from the `azure-identity` library, such as `DefaultAzureCredential`.
affects: Introduced in 1.0.0b1 (2021-02-09) and later versions.
breakingLong-Running Operations (LRO) pollers and exception handling changed. Operations returning `msrest.polling.LROPoller` now return `azure.core.polling.LROPoller` and are prefixed with `begin_`. Most exceptions are now `azure.core.exceptions.HttpResponseError` instead of `CloudError`.
fix
Update LRO calls to use the `begin_` prefix and `azure.core.polling.LROPoller`. Refactor exception handling to catch `azure.core.exceptions.HttpResponseError`.
affects: Introduced in 1.0.0b1 (2021-02-09) and later versions.
gotchaDeleting a Private DNS zone also deletes all DNS records within it, and this operation cannot be undone. Furthermore, a Private DNS zone cannot be deleted unless all virtual network links to it are first removed.
fix
Before deleting a Private DNS zone, ensure all associated virtual network links are removed, and be aware of the irreversible deletion of all records.
affects: All versions
gotchaThe `PrivateDnsManagementClient` constructor accepts an `api_version` parameter. While it has a default, explicitly overriding it with an unsupported or outdated value can lead to unexpected API behavior or errors.
fix
Only override the `api_version` if you explicitly need to target a specific, compatible API version. Generally, rely on the SDK's default for the latest supported behavior.
affects: All versions
Upgrade
Version history
2.0.0latest on PyPI · released Jul 29, 2026
Audit
Dependencies
azure-identityrequiredRequired for Azure Active Directory token authentication.
Agent activity
44 hits · last 30 days
node
36
OpenAI (training)
1
Resources
azure-mgmt-privatedns — pip install azure-mgmt-privatedns · libregistry