Install & Compatibility
Where this runs
tested against v9.0.1 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.580s · 43.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.7s · import 0.508s · 44MB
43MB installed
● package 43MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AdvisorManagementClient
✓ from azure.mgmt.advisor import AdvisorManagementClient
✗ from azure.mgmt.advisor.advisor_management_client import AdvisorManagementClient
For versions prior to 3.0.0, the client was imported from a sub-module. Version 3.0.0 and later require direct import from `azure.mgmt.advisor`.
DefaultAzureCredential
✓ from azure.identity import DefaultAzureCredential
✗ from azure.common.credentials import get_azure_cli_credentials
As of v9.0.0b1 and later, `azure.common.credentials` and `msrestazure.azure_active_directory` are no longer supported for authentication. Use classes from `azure-identity` like `DefaultAzureCredential` instead.
This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and list Azure Advisor recommendations for a given subscription. Ensure your Azure credentials and `AZURE_SUBSCRIPTION_ID` are set in your environment variables or via `az login`.
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.advisor import AdvisorManagementClient
# --- Authentication ---
# For more info, see https://learn.microsoft.com/en-us/azure/developer/python/sdk/authentication-overview
# Set AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET, and AZURE_SUBSCRIPTION_ID environment variables,
# or authenticate via Azure CLI (az login).
try:
credential = DefaultAzureCredential()
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "")
if not subscription_id:
raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.")
except Exception as e:
print(f"Authentication setup failed: {e}")
print("Please ensure you have authenticated to Azure (e.g., via `az login`) and set AZURE_SUBSCRIPTION_ID.")
exit(1)
# --- Client Initialization ---
print(f"Initializing AdvisorManagementClient for subscription: {subscription_id}")
client = AdvisorManagementClient(credential, subscription_id)
# --- Fetching Recommendations ---
print("Listing Advisor recommendations:")
try:
# The list() method returns an iterator over recommendations.
for recommendation in client.recommendations.list():
print(f" Category: {recommendation.category}")
print(f" Impact: {recommendation.impact}")
# Accessing nested properties like short_description.problem
if recommendation.short_description:
print(f" Problem: {recommendation.short_description.problem}")
print(f" Solution: {recommendation.short_description.solution}")
print("-" * 20)
except Exception as e:
print(f"Failed to list recommendations: {e}")
Debug
Known issues
breakingThe credential system was completely revamped in `9.0.0b1`. Legacy authentication methods like `azure.common.credentials` or `msrestazure.azure_active_directory` are no longer supported. You must use classes from `azure-identity` (e.g., `DefaultAzureCredential`).fixMigrate your authentication code to use `azure-identity`. Install it with `pip install azure-identity` and replace old credential types with `DefaultAzureCredential` or other appropriate `azure-identity` classes.
affects: 9.0.0b1 and later
breakingClient initialization parameters changed in `9.0.0b1`. The `credentials` parameter was renamed to `credential`, and the `config` attribute no longer exists on client objects. Configuration should now be passed as keyword arguments to the client constructor.fixUpdate client instantiation from `Client(credentials, subscription_id, config=...)` to `Client(credential, subscription_id, enable_logging=...)` or similar keyword arguments supported by `azure-core`.
affects: 9.0.0b1 and later
breakingLong-running operations (LROs) now return an `azure.core.polling.LROPoller` object (instead of `msrest.polling.LROPoller`) and are typically prefixed with `begin_`.fixReview calls to LRO-initiating methods. Ensure they are prefixed with `begin_` (e.g., `client.resource.begin_create_or_update()`) and handle the new `LROPoller` return type from `azure.core.polling`.
affects: 9.0.0b1 and later
breakingThe exception hierarchy has been simplified. Most exceptions now inherit from `azure.core.exceptions.HttpResponseError`. The `CloudError` class has been removed.fixUpdate exception handling blocks to catch `azure.core.exceptions.HttpResponseError` instead of `CloudError` or other specific HTTP-related exceptions.
affects: 9.0.0b1 and later
gotchaHTTP connection pooling is enabled by default. To ensure proper resource management and avoid potential issues, client objects should ideally be used as context managers or have their `close()` method explicitly called when they are no longer needed.fixWrap client usage in a `with` statement (e.g., `with AdvisorManagementClient(...) as client:`) or explicitly call `client.close()` when done.
affects: 3.0.0 and later
gotchaIf you are not seeing expected Advisor recommendations for certain categories (e.g., 'Security'), ensure that there are actual recommendations in that category for your resources. You might need to explicitly filter the list operation if only specific categories are desired.fixVerify in the Azure Portal if recommendations exist for the specific category. When listing recommendations via SDK, you can apply a filter (e.g., `client.recommendations.list(filter="Category eq 'Security'")`) to narrow down results.
affects: All versions
breakingThe `azure-mgmt-advisor` library or one of its internal dependencies requires the `six` package, which was not found. This typically indicates a missing dependency that needs to be explicitly installed.fixInstall the `six` package: `pip install six`.
affects: All versions
breakingThe library failed to import due to `ModuleNotFoundError: No module named 'six'`. This indicates that the `six` package, a dependency of `azure-mgmt-advisor` or one of its sub-dependencies, was not automatically installed.fixInstall the `six` package manually: `pip install six`.
affects: All versions
Upgrade
Version history
9.0.1latest on PyPI · released May 13, 2026
Audit
Dependencies
azure-identityrequiredRequired for authentication with Azure services using modern credential flows.
azure-corerequiredCore shared classes and HTTP pipeline for Azure SDK libraries.