Registry / azure / azure-mgmt-resource

azure-mgmt-resource

JSON →
library26.0.0pypypi✓ verified 24d ago

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-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-RESOURC
A
azure-mgmt-resource
azurepythonv26.0.0
Install
3.9s avg
Import
435ms
Disk
43MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v26.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.088s · 44.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.086s · 45MB
43MB installed
● package 43MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ResourceManagementClient
from azure.mgmt.resource import ResourceManagementClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
SubscriptionClient
from azure.mgmt.resource.subscriptions import SubscriptionClient
from azure.mgmt.resource import SubscriptionClient
As of v25.0.0, many modules like 'subscriptions' have been separated into dedicated packages/submodules.
DeploymentsMgmtClient
from azure.mgmt.resource.deployments import DeploymentsMgmtClient
client.deployments.create_or_update(...)
As of v25.0.0, Deployment and DeploymentOperations related clients moved to a new `azure-mgmt-resource-deployments` package and client.

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.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.resource import ResourceManagementClient # Set your Azure Subscription ID as an environment variable: AZURE_SUBSCRIPTION_ID # For local development, also set: AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "") # Acquire a credential object using DefaultAzureCredential. # This will attempt to authenticate in various environments. credential = DefaultAzureCredential() # Create a Resource Management client resource_client = ResourceManagementClient(credential, subscription_id) # Example: List resource groups in the subscription print("Listing resource groups...") for rg in resource_client.resource_groups.list(): print(f" Resource Group: {rg.name} (Location: {rg.location})") # Example: Create a new resource group (uncomment to run) # RESOURCE_GROUP_NAME = "my-new-resource-group" # RESOURCE_GROUP_LOCATION = "eastus" # print(f"Creating resource group '{RESOURCE_GROUP_NAME}' in '{RESOURCE_GROUP_LOCATION}'...") # creation_result = resource_client.resource_groups.begin_create_or_update( # RESOURCE_GROUP_NAME, # {"location": RESOURCE_GROUP_LOCATION} # ).result() # .result() waits for the long-running operation to complete # print(f"Resource group '{creation_result.name}' created.")
Debug
Known issues
breakingVersion 25.0.0 and later packages now exclusively target the latest API-Version available on Azure. If your application relies on a specific, non-latest API-Version, you must pin the package to a previous version to maintain compatibility.
fix
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.
affects: >=25.0.0
breakingMany sub-modules and their corresponding clients, such as `subscriptions`, `features`, `links`, `locks`, `policy`, `managedapplications`, `databoundaries`, `changes`, `privatelinks`, `deploymentstacks`, `deploymentscripts`, and `templatespecs` have been separated from `azure-mgmt-resource` into independent packages or submodules.
fix
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`.
affects: >=25.0.0
gotchaMany Azure operations, especially resource creation or deletion, are asynchronous and return a `Poller` object. Calling `.result()` on the poller is necessary to wait for the operation's completion and retrieve the final result.
fix
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.
affects: All
gotchaThe `DefaultAzureCredential` used for authentication relies on environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`) or other configured authentication mechanisms (like Azure CLI login, Managed Identity) for local development and deployment. Incorrect or missing environment variables will lead to authentication failures.
fix
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.
affects: All
Upgrade
Version history
26.0.0latest on PyPI · released Jun 24, 2026
Audit
Dependencies
azure-identityrequiredRequired for authenticating to Azure services using recommended credential types like DefaultAzureCredential.
Agent activity
49 hits · last 30 days
node
42
OpenAI (training)
1
Resources
azure-mgmt-resource — pip install azure-mgmt-resource · libregistry