Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HDInsightManagementClient
✓ from azure.mgmt.hdinsight import HDInsightManagementClient
DefaultAzureCredential
✓ from azure.identity import DefaultAzureCredential
✗ from azure.common.credentials import ServicePrincipalCredentials
DefaultAzureCredential from azure-identity is the modern, recommended authentication method for Azure SDKs.
models
✓ from azure.mgmt.hdinsight.models import Cluster
✗ from azure.mgmt.hdinsight.models import *
It's best practice to import specific models directly for clarity and to avoid namespace pollution.
This quickstart demonstrates how to authenticate with Azure, initialize the `HDInsightManagementClient`, and then list all HDInsight clusters within your subscription, as well as fetch capabilities for a specific location. It uses `DefaultAzureCredential` for flexible authentication.
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
# Set your Azure Subscription ID as an environment variable
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "<your-subscription-id>")
if subscription_id == "<your-subscription-id>":
print("Please set the AZURE_SUBSCRIPTION_ID environment variable or replace the placeholder.")
exit(1)
# Authenticate using DefaultAzureCredential, which tries multiple credential types
# (environment variables, managed identity, VS Code, Azure CLI, etc.)
credential = DefaultAzureCredential()
# Create the HDInsight Management Client
client = HDInsightManagementClient(credential, subscription_id)
print(f"Listing all HDInsight clusters in subscription: {subscription_id}")
try:
# List all clusters in the subscription
clusters = client.clusters.list()
found_clusters = False
for cluster in clusters:
found_clusters = True
print(f"- Cluster Name: {cluster.name}, Location: {cluster.location}, State: {cluster.properties.cluster_state}")
if not found_clusters:
print("No HDInsight clusters found in this subscription.")
except Exception as e:
print(f"An error occurred: {e}")
print("Make sure your AZURE_SUBSCRIPTION_ID is correct and you have appropriate permissions.")
print("\nListing available locations (capabilities) for HDInsight:")
# Note: list_capabilities often requires a specific location as input for context
# We'll use 'eastus' as an example.
# This might list an empty set if the subscription has no capabilities in 'eastus' or permission issues.
locations = client.locations.list_capabilities("eastus")
found_locations = False
for location in locations:
found_locations = True
print(f"- Location: {location.location}, VM Families: {len(location.regions_with_ FVM_families)}, Max Clusters: {location.max_cluster_count}")
if found_locations: # Print only the first one for brevity
break
if not found_locations:
print("No capabilities listed for 'eastus' or an error occurred.")
Debug
Known issues
breakingMajor version releases (e.g., 9.0.0) typically introduce breaking changes in API models, client constructors, or method signatures. Always review the migration guide in the official Azure SDK documentation when upgrading between major versions.fixConsult the `azure-sdk-for-python` changelog and migration guides on GitHub or docs.microsoft.com for specific changes and updated code examples.
affects: 9.0.0+
gotchaMany Azure management operations, such as creating or deleting clusters, are long-running operations (LROs). The SDK returns a poller object (e.g., `LROPoller`). You must call `.result()` on this poller to wait for the operation to complete and get its final outcome.fixAfter invoking an LRO method (e.g., `client.clusters.begin_create(...)`), store the returned poller object and then call `poller.result()` to ensure the operation finishes before proceeding.
affects: All
deprecatedOlder authentication methods like directly using `ServicePrincipalCredentials` or `TokenCredentials` are being deprecated. The `azure-identity` library with `DefaultAzureCredential` is the recommended and most flexible approach for authentication across Azure SDKs.fixMigrate your authentication logic to use `DefaultAzureCredential` from the `azure-identity` library. This allows for seamless authentication across development and production environments.
affects: <9.0.0 (and older versions of `msrestazure`)
gotchaAzure HDInsight management operations are tied to a specific Azure subscription and often a resource group. Ensure you provide the correct `subscription_id` and `resource_group_name` to the client and methods, respectively. Incorrect context will lead to 'ResourceNotFound' or 'PermissionDenied' errors.fixVerify that the `subscription_id` used for client initialization is correct and that the authenticated principal has 'Contributor' or equivalent roles on the target subscription/resource group. For resource-group specific operations, ensure the resource group exists and is correctly named.
affects: All
Upgrade
Version history
9.0.1latest on PyPI · released May 18, 2026
Audit
Dependencies
azure-identityrequiredRecommended for Azure Active Directory authentication.
azure-commonrequiredCommon Azure utilities, often a transitive dependency.
msrestazurerequiredCore Azure client runtime for track 1 SDKs.
Agent activity
0 hits · last 30 days
No traffic data recorded yet.