{"id":7976,"library":"azure-mgmt-resource-subscriptions","title":"Azure Subscriptions Management Client","description":"The `azure-mgmt-resource-subscriptions` library is the Microsoft Azure Resource Subscriptions Management Client Library for Python. It provides functionality to manage Azure subscriptions programmatically. As of the current release, 1.0.0b1, it is in a beta stage, indicating active development with potential for non-backward compatible changes. It is part of the broader Azure SDK for Python ecosystem, which typically follows a frequent release cadence for both stable and preview packages.","status":"active","version":"1.0.0b1","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/resourcemanager/azure-mgmt-resource-subscriptions","tags":["azure","cloud","management","subscriptions","resource-management"],"install":[{"cmd":"pip install azure-mgmt-resource-subscriptions azure-identity","lang":"bash","label":"Install with Azure Identity"}],"dependencies":[{"reason":"Required for Azure Active Directory token authentication.","package":"azure-identity","optional":false},{"reason":"Requires Python 3.9 or higher.","package":"Python","optional":false}],"imports":[{"note":"The SubscriptionClient was moved to its own package from `azure-mgmt-resource` in newer Azure SDK versions.","wrong":"from azure.mgmt.resource import SubscriptionClient","symbol":"SubscriptionClient","correct":"from azure.mgmt.resource.subscriptions import SubscriptionClient"},{"symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.resource.subscriptions import SubscriptionClient\n\n# Ensure environment variables are set for authentication:\n# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET\n# (or other methods supported by DefaultAzureCredential)\n\ncredential = DefaultAzureCredential()\nclient = SubscriptionClient(credential=credential)\n\nprint(\"Listing Azure subscriptions:\")\nfor subscription in client.subscriptions.list():\n    print(f\"  Name: {subscription.display_name} (ID: {subscription.subscription_id})\")\n","lang":"python","description":"This quickstart demonstrates how to authenticate using `DefaultAzureCredential` and list all accessible Azure subscriptions. Ensure the necessary environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) are configured for `DefaultAzureCredential` to function, or use other authentication methods provided by `azure-identity`."},"warnings":[{"fix":"For production workloads, prefer stable (GA) versions of Azure SDK libraries. If a stable version of this specific functionality is not yet available, use beta versions with caution and be prepared for potential breaking changes upon upgrade. Monitor Azure SDK release notes for GA announcements.","message":"This library is currently in a beta (preview) state (e.g., 1.0.0b1). Beta libraries are not recommended for production use as they may contain bugs or undergo non-backward compatible API changes without prior notice.","severity":"breaking","affected_versions":"1.0.0b1 and other beta releases"},{"fix":"Update import statements to `from azure.mgmt.resource.subscriptions import SubscriptionClient` and ensure `azure-mgmt-resource-subscriptions` is installed.","message":"The `SubscriptionClient` and related subscription management functionalities were separated from the monolithic `azure-mgmt-resource` package into `azure-mgmt-resource-subscriptions`. Direct imports like `from azure.mgmt.resource import SubscriptionClient` will fail in newer SDK versions.","severity":"breaking","affected_versions":"Migrations from older `azure-mgmt-resource` versions to newer SDKs"},{"fix":"Unless specific requirements dictate otherwise, rely on the default `api_version` provided by the SDK or consult official documentation to determine compatible API versions for specific operations.","message":"When constructing a `SubscriptionClient`, an `api_version` parameter is available (defaulting to '2022-12-01'). Explicitly overriding this default to an unsupported or incorrect API version can lead to unexpected behavior or errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your development and deployment environments are running Python 3.9 or a newer compatible version.","message":"The package requires Python 3.9+. Using it with older Python versions will result in installation or runtime errors.","severity":"gotcha","affected_versions":"Python < 3.9"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change the import statement to `from azure.mgmt.resource.subscriptions import SubscriptionClient` and ensure `pip install azure-mgmt-resource-subscriptions` has been run.","cause":"The `SubscriptionClient` class has been moved from the `azure.mgmt.resource` package to its dedicated package `azure.mgmt.resource.subscriptions` as part of the Azure SDK's modularization efforts.","error":"ImportError: cannot import name 'SubscriptionClient' from 'azure.mgmt.resource'"},{"fix":"Verify that your environment variables for Azure authentication are correctly set, or that your Managed Identity has the necessary permissions. Refer to the Azure Identity troubleshooting guide for detailed debugging steps.","cause":"`DefaultAzureCredential` or other credential types failed to authenticate, often due to missing or incorrect environment variables (e.g., `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`), misconfigured Managed Identity, or insufficient permissions.","error":"azure.core.exceptions.ClientAuthenticationError: Authentication failed: AADTokenOperationError: AADTokenOperationError: Token acquisition failed. Correlation ID: ... Message: ManagedIdentityCredential authentication failed. See the troubleshooting guide for details. https://aka.ms/azsdk/python/identity/troubleshoot"},{"fix":"Ensure the correct subscription ID is being used. Verify that the authenticated user or service principal has 'Reader' role (or higher) permissions on the target subscription. If working with multiple tenants, ensure the authentication context is set for the correct tenant.","cause":"The authenticated identity does not have access to the specified subscription ID, the subscription ID is incorrect, or the identity is authenticated to the wrong Azure Active Directory tenant. This is a common issue with Azure SDKs.","error":"azure.core.exceptions.ResourceNotFoundError: The subscription 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' could not be found. (SubscriptionNotFound)"},{"fix":"Register the required resource provider for your subscription using Azure CLI (`az provider register --namespace Microsoft.ResourceProviderName`) or PowerShell. Check the documentation for the specific resource type to confirm supported locations and API versions.","cause":"This error typically occurs when attempting to perform an operation (e.g., deploying a resource) for which the necessary Azure Resource Provider has not been registered in your subscription, or the specified location/API version is unsupported for that provider.","error":"No registered resource provider found for location '{location}' and API version '{api-version}' for type '{resource-type}'."}]}