The `azure-mgmt-resource` library is the Microsoft Azure Resource Management Client Library for Python. It provides programmatic access to the Azure Resource Manager (ARM) API, enabling developers to create, update, query, and delete Azure resources and resource groups. Part of the comprehensive Azure SDK for Python, it's currently at version 25.0.0 and maintains an active development and release cadence.
pip install azure-mgmt-resource azure-identityVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to authenticate with `DefaultAzureCredential` and create an instance of `ResourceManagementClient` to list existing resource groups and shows an example of how to create a new one. Ensure required environment variables like `AZURE_SUBSCRIPTION_ID` are set.
Pin your `azure-mgmt-resource` package version to a previous release (e.g., `<25.0.0`) if you depend on an older API version. Otherwise, update your code to reflect changes in the latest API version if necessary.
Update your import statements. For example, `from azure.mgmt.resource import SubscriptionClient` should become `from azure.mgmt.resource.subscriptions import SubscriptionClient`. Similarly, operations like `client.deployments` have moved to a new client type, `DeploymentsMgmtClient`, in a dedicated package `azure-mgmt-resource-deployments`.
Always use `.begin_` methods for long-running operations (e.g., `resource_groups.begin_create_or_update`) and then call `.result()` on the returned poller object to ensure the operation completes before proceeding.
Ensure the necessary environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` for service principal, and `AZURE_SUBSCRIPTION_ID` for the client) are correctly configured in your development or deployment environment.