{"id":3902,"library":"azure-mgmt","title":"Azure Management Client Libraries","description":"The `azure-mgmt` package is a meta-package providing Microsoft Azure Resource Management Client Libraries for Python. It aggregates all individual `azure-mgmt-xxx` packages, allowing Python applications to programmatically manage Azure resources like virtual machines, storage accounts, and networks. The current version is 5.0.0, following the 'Track 2' design guidelines for the Azure SDK. It typically follows a continuous release cadence with updates to individual service clients.","status":"active","version":"5.0.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","cloud","management","sdk","resource-management"],"install":[{"cmd":"pip install azure-mgmt azure-identity","lang":"bash","label":"Install full meta-package and identity"},{"cmd":"pip install azure-mgmt-resource azure-identity","lang":"bash","label":"Install specific service client and identity"}],"dependencies":[],"imports":[{"note":"The `azure-mgmt` package is a meta-package. Client classes are found in specific sub-packages (e.g., `azure.mgmt.resource`, `azure.mgmt.compute`), not directly under `azure.mgmt`.","wrong":"from azure.mgmt import ResourceManagementClient","symbol":"ResourceManagementClient","correct":"from azure.mgmt.resource import ResourceManagementClient"},{"note":"Authentication classes are provided by the separate `azure-identity` package, which must be installed alongside `azure-mgmt` or its sub-packages.","symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.resource import ResourceManagementClient\n\n# Set your Azure Subscription ID as an environment variable\n# E.g., export AZURE_SUBSCRIPTION_ID='YOUR_SUBSCRIPTION_ID'\nsubscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', '')\n\nif not subscription_id:\n    print(\"Please set the AZURE_SUBSCRIPTION_ID environment variable.\")\nelse:\n    try:\n        # Authenticate using DefaultAzureCredential (looks for env vars, managed identity, etc.)\n        credential = DefaultAzureCredential()\n\n        # Create a ResourceManagementClient\n        resource_client = ResourceManagementClient(credential, subscription_id)\n\n        print(f\"Listing resource groups in subscription: {subscription_id}\")\n        for rg in resource_client.resource_groups.list():\n            print(f\"- {rg.name} ({rg.location})\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Ensure you have authenticated (e.g., `az login` or appropriate environment variables).\")","lang":"python","description":"This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and list all resource groups within a specified subscription. It requires the `AZURE_SUBSCRIPTION_ID` environment variable to be set and the `azure-identity` package installed. The `ResourceManagementClient` is imported from `azure.mgmt.resource`, which is part of the `azure-mgmt` meta-package."},"warnings":[{"fix":"Refer to the Azure SDK for Python migration guide for detailed steps on updating client instantiation, authentication, and operation calls. This often involves changes in imports (e.g., `azure.mgmt.resource` instead of `azure.mgmt.resource.resources`), credential handling (using `azure-identity`), and method signatures.","message":"Major API redesign between 'Track 1' (older) and 'Track 2' (current) versions. `azure-mgmt` versions 5.0.0 and later are 'Track 2' which includes unified authentication, asynchronous support, and consistent client construction. Code written for older `azure-mgmt` versions (pre-5.0.0) will not be compatible.","severity":"breaking","affected_versions":"< 5.0.0 vs >= 5.0.0"},{"fix":"Instead of `pip install azure-mgmt`, install specific packages like `pip install azure-mgmt-resource azure-mgmt-compute azure-identity` to reduce the dependency footprint and potential for conflicts.","message":"The `azure-mgmt` package is a meta-package that installs *all* individual `azure-mgmt-xxx` packages (e.g., `azure-mgmt-resource`, `azure-mgmt-compute`). While convenient, this can lead to a large number of dependencies. For production applications, it is often more efficient to install only the specific `azure-mgmt-SERVICE_NAME` packages required.","severity":"gotcha","affected_versions":"All versions of `azure-mgmt`."},{"fix":"Always install `azure-identity` (`pip install azure-identity`) and pass a credential object (e.g., `DefaultAzureCredential()`) to the client constructor.","message":"Authentication is handled by the separate `azure-identity` library. `azure-mgmt` client libraries do not include authentication mechanisms directly. Attempting to use clients without an `azure-identity` credential object will result in authentication errors.","severity":"gotcha","affected_versions":"All versions of `azure-mgmt`."}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}