{"library":"azure-mgmt-msi","title":"Azure MSI Management Client Library","description":"The Microsoft Azure Msi Management Client Library for Python provides functionality to manage Managed Service Identities (MSI) within Azure. These identities facilitate secure, credential-less authentication for Azure resources. It is part of the actively developed Azure SDK for Python, with a consistent release cadence for both stable and preview versions. The current stable version is 7.1.0.","status":"active","version":"7.1.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","management","identity","msi","managed-identity"],"install":[{"cmd":"pip install azure-mgmt-msi","lang":"bash","label":"Install core library"},{"cmd":"pip install azure-identity","lang":"bash","label":"Install authentication library"}],"dependencies":[{"reason":"Required for Azure Active Directory token authentication with `DefaultAzureCredential` and other credential types.","package":"azure-identity","optional":false}],"imports":[{"symbol":"ManagedServiceIdentityClient","correct":"from azure.mgmt.msi import ManagedServiceIdentityClient"},{"note":"Older Azure SDK versions used `azure.common.credentials` or `msrestazure.azure_active_directory` for authentication. The current standard is `azure-identity`.","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.msi import ManagedServiceIdentityClient\n\n# Set environment variables for authentication:\n# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET\n# And AZURE_SUBSCRIPTION_ID\n\nsubscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', '')\n\nif not subscription_id:\n    raise ValueError(\"AZURE_SUBSCRIPTION_ID environment variable not set.\")\n\n# Authenticate using DefaultAzureCredential\ncredential = DefaultAzureCredential()\n\n# Create the MSI management client\n# For production, consider specifying api_version for stability, e.g., api_version='2023-01-31'\nclient = ManagedServiceIdentityClient(credential=credential, subscription_id=subscription_id)\n\n# Example: List user-assigned identities in a subscription\nprint(f\"Listing user-assigned identities in subscription: {subscription_id}\")\nfor identity in client.user_assigned_identities.list_by_subscription():\n    print(f\"  Identity Name: {identity.name}, Location: {identity.location}\")\n\nprint(\"Quickstart finished successfully.\")","lang":"python","description":"Initializes the `ManagedServiceIdentityClient` using `DefaultAzureCredential` for authentication, requiring environment variables for Azure AD credentials and subscription ID. It then demonstrates listing user-assigned identities in the specified subscription."},"warnings":[{"fix":"Migrate your authentication code to use classes from the `azure-identity` package, such as `DefaultAzureCredential`. Update client instantiation to use the `credential` parameter.","message":"Authentication in versions 6.0.0b1 and later transitioned from legacy modules (e.g., `azure.common.credentials`, `msrestazure.azure_active_directory`) to the `azure-identity` library. The `credentials` parameter was also renamed to `credential`.","severity":"breaking","affected_versions":">=6.0.0b1"},{"fix":"Consult the official Azure SDK for Python migration guides, specifically for hybrid models (https://aka.ms/azsdk/python/migrate/hybrid-models) and operation changes (https://aka.ms/azsdk/python/migrate/operations).","message":"Major architectural changes were introduced in versions 6.0.0b1 and later, including the adoption of 'hybrid models' (which behave as both dictionaries and objects) and significant changes to method signatures. Long-running operations (LROs) are now prefixed with `begin_` (e.g., `create_or_update` becomes `begin_create_or_update`), and most exceptions are now `azure.core.exceptions.HttpResponseError` instead of `CloudError`.","severity":"breaking","affected_versions":">=6.0.0b1"},{"fix":"Ensure your development and deployment environments use Python 3.9 or a newer compatible version.","message":"Python 2.7 support was officially dropped, and Python < 3.7.0 support was removed in version 7.1.0b1. The current stable version 7.1.0 requires Python 3.9+.","severity":"breaking","affected_versions":">=7.1.0b1"},{"fix":"Pass the `api_version` parameter with a specific date string (e.g., `api_version='2023-01-31'`) to the `ManagedServiceIdentityClient` constructor.","message":"The `ManagedServiceIdentityClient` is a multi-API version client. While it defaults to the latest API version, it's a best practice for production applications to explicitly pin to a specific API version in the client constructor for consistent behavior and to avoid unexpected changes from new API versions.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-06T00:00:00.000Z","next_check":"2026-07-05T00:00:00.000Z"}