{"id":7033,"library":"azure-mgmt-hybridcompute","title":"Azure Hybrid Compute Management Client Library","description":"The `azure-mgmt-hybridcompute` library is the Microsoft Azure Hybrid Compute Management Client Library for Python. It provides classes and methods to programmatically manage Azure Arc-enabled servers and related resources. The current stable version is 9.0.0, and like other Azure SDKs, it follows an active release cadence with regular updates for new features and bug fixes.","status":"active","version":"9.0.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","management","hybridcompute","arc","cloud","server management","sdk"],"install":[{"cmd":"pip install azure-mgmt-hybridcompute azure-identity","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Required for authenticating with Azure services.","package":"azure-identity"}],"imports":[{"symbol":"HybridComputeManagementClient","correct":"from azure.mgmt.hybridcompute import HybridComputeManagementClient"},{"note":"Old authentication classes like ServicePrincipalCredentials are deprecated; use azure-identity classes like DefaultAzureCredential instead for unified authentication across environments.","wrong":"from azure.common.credentials import ServicePrincipalCredentials","symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.hybridcompute import HybridComputeManagementClient\n\n# Set environment variables for authentication and subscription\n# AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID for service principal or Azure CLI login\n# AZURE_SUBSCRIPTION_ID for your Azure subscription\n\nsubscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID')\n\nif subscription_id == 'YOUR_SUBSCRIPTION_ID':\n    print(\"Please set the AZURE_SUBSCRIPTION_ID environment variable.\")\n    exit(1)\n\ntry:\n    # Acquire a credential object using DefaultAzureCredential\n    # This credential will attempt to authenticate via multiple mechanisms:\n    # Environment variables, Managed Identity, Azure CLI, Visual Studio Code, etc.\n    credential = DefaultAzureCredential()\n\n    # Create a Hybrid Compute Management client\n    client = HybridComputeManagementClient(credential=credential, subscription_id=subscription_id)\n\n    print(f\"Listing all machines in subscription {subscription_id}:\")\n    # Iterate over machines in the subscription\n    for machine in client.machines.list_by_subscription():\n        print(f\"  - Machine Name: {machine.name}, Location: {machine.location}, Status: {machine.status}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Ensure you are authenticated to Azure (e.g., via `az login` or environment variables).\")","lang":"python","description":"This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and then list all Azure Arc-enabled machines within a specified subscription. Ensure `AZURE_SUBSCRIPTION_ID` and other necessary Azure authentication environment variables (like `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID` if using a service principal) are set, or that you are logged in via `az login`."},"warnings":[{"fix":"Migrate to `azure-identity` classes (e.g., `DefaultAzureCredential`) for authentication and update client constructor parameter names. Refer to the Azure SDK for Python authentication documentation.","message":"The credential system has been completely revamped in versions 7.0.0b1 and later. Old authentication classes like `azure.common.credentials` or `msrestazure.azure_active_directory` are no longer supported. The `credentials` parameter for client constructors has been renamed to `credential`.","severity":"breaking","affected_versions":">=7.0.0b1"},{"fix":"Update calls to LRO methods to use the `begin_` prefix and handle `HttpResponseError` for API-related exceptions. The `raw` parameter in operation kwargs is also removed; equivalent functionality is available via the `cls` callback.","message":"Long-running operations (LROs) that previously returned `msrest.polling.LROPoller` now return `azure.core.polling.LROPoller` and are prefixed with `begin_` (e.g., `create_or_update` becomes `begin_create_or_update`). The `CloudError` exception has been removed, replaced by `azure.core.exceptions.HttpResponseError`.","severity":"breaking","affected_versions":">=7.0.0b1"},{"fix":"Review release notes for alternatives or changes in how these functionalities are accessed. It's possible the functionality was integrated into other operations or removed if deprecated upstream.","message":"Version 9.0.0 removed the `AgentVersionOperations`, `HybridIdentityMetadataOperations`, `LicenseProfilesOperations`, and `LicensesOperations` operation groups. If your code uses these, it will break.","severity":"breaking","affected_versions":"9.0.0"},{"fix":"Upgrade your Python environment to Python 3.8 or a newer supported version.","message":"Support for Python 2.7 has officially ended on January 1, 2022. This library, like all new Azure SDK for Python packages, requires Python 3.8 or later.","severity":"gotcha","affected_versions":"<=9.0.0"},{"fix":"Always cross-reference with the official Azure SDK for Python documentation and the library's GitHub repository for the latest supported operations. If an operation is missing, check for newer SDK versions or file an issue on the Azure SDK GitHub.","message":"Some users have reported discrepancies where certain Hybrid Compute API operations documented in the REST API were initially missing or delayed in the Python SDK. While efforts are made to keep SDKs up-to-date, occasional gaps or delays in API parity can occur.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Update your imports to use `azure-identity` for authentication, for example: `from azure.identity import DefaultAzureCredential`.","cause":"Attempting to import old, deprecated authentication modules (e.g., `azure.common.credentials` or `azure.profiles`) which are no longer part of the Azure SDK structure.","error":"ModuleNotFoundError: No module named 'azure.profiles' OR ModuleNotFoundError: No module named 'azure.common.credentials'"},{"fix":"Assign the appropriate RBAC role (e.g., 'Azure Connected Machine Reader' or a custom role with required permissions) to the identity used for authentication on the subscription, resource group, or specific resource scope.","cause":"The authenticated identity (user, service principal, or managed identity) lacks the necessary Azure RBAC permissions to perform the requested operation on the specified scope.","error":"azure.core.exceptions.HttpResponseError: (AuthorizationFailed) The client '...' with object id '...' does not have authorization to perform action 'Microsoft.HybridCompute/machines/read' over scope '/subscriptions/...' or the scope is invalid."},{"fix":"Review the official documentation for version 9.0.0 to identify the correct way to perform the desired operation, as these specific operation groups are no longer available directly.","cause":"Attempting to access an operation group (e.g., `agent_version_operations`, `license_profiles_operations`) that was removed in version 9.0.0.","error":"AttributeError: 'HybridComputeManagementClient' object has no attribute 'agent_version_operations'"}]}