or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.mdpolicy-governance.mdresource-management.mdresource-protection.mdsubscription-features.md
tile.json

tessl/pypi-azure-mgmt-resource

Microsoft Azure Resource Management Client Library for Python providing comprehensive Azure resource lifecycle, governance, and deployment capabilities.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-mgmt-resource@24.0.x

To install, run

npx @tessl/cli install tessl/pypi-azure-mgmt-resource@24.0.0

index.mddocs/

Azure Resource Management SDK

Microsoft Azure Resource Management Client Library for Python provides comprehensive Azure resource lifecycle, governance, and deployment capabilities. This library enables programmatic management of Azure resources, subscriptions, resource groups, policies, locks, and applications through multiple specialized client classes.

Package Information

  • Package Name: azure-mgmt-resource
  • Package Type: pip
  • Language: Python
  • Installation: pip install azure-mgmt-resource
  • Authentication: pip install azure-identity (required for authentication)

Core Imports

from azure.mgmt.resource import (
    ResourceManagementClient,
    PolicyClient,
    SubscriptionClient,
    FeatureClient,
    ManagementLockClient,
    ManagementLinkClient,
    ApplicationClient,
    DataBoundaryMgmtClient
)

For authentication:

from azure.identity import DefaultAzureCredential

Basic Usage

import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource import ResourceManagementClient

# Authentication
credential = DefaultAzureCredential()
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")

# Create client
client = ResourceManagementClient(
    credential=credential,
    subscription_id=subscription_id
)

# List resource groups
resource_groups = client.resource_groups.list()
for rg in resource_groups:
    print(f"Resource Group: {rg.name} in {rg.location}")

# Get a specific resource group
rg = client.resource_groups.get("my-resource-group")
print(f"Resource Group Tags: {rg.tags}")

Architecture

The Azure Resource Management SDK is organized into specialized client classes, each targeting specific Azure management capabilities:

  • Core Resource Management: ResourceManagementClient for resources, resource groups, deployments, and providers
  • Governance & Compliance: PolicyClient for Azure Policy management and compliance
  • Access Control: ManagementLockClient for resource locks and ManagementLinkClient for resource relationships
  • Service Management: SubscriptionClient for subscription operations and FeatureClient for feature management
  • Application Management: ApplicationClient for managed applications and DataBoundaryMgmtClient for data boundaries

Each client supports multiple API versions, async operations, and follows Azure SDK patterns for authentication, error handling, and pagination.

Authentication Requirements

All clients require Azure credentials. Set these environment variables:

  • AZURE_CLIENT_ID - Azure client ID
  • AZURE_TENANT_ID - Azure tenant ID
  • AZURE_CLIENT_SECRET - Azure client secret
  • AZURE_SUBSCRIPTION_ID - Azure subscription ID

Capabilities

Core Resource Management

Comprehensive resource lifecycle management including deployments, resource groups, providers, and resource operations. This is the primary client for most Azure resource management tasks.

class ResourceManagementClient:
    def __init__(self, credential, subscription_id: str, **kwargs): ...
    
    @property
    def resources(self) -> ResourcesOperations: ...
    @property 
    def resource_groups(self) -> ResourceGroupsOperations: ...
    @property
    def deployments(self) -> DeploymentsOperations: ...
    @property
    def providers(self) -> ProvidersOperations: ...
    @property
    def tags(self) -> TagsOperations: ...

Resource Management

Policy and Governance

Azure Policy management for implementing governance, compliance, and security standards across Azure resources through policy definitions, assignments, and compliance monitoring.

class PolicyClient:
    def __init__(self, credential, subscription_id: str, **kwargs): ...
    
    @property
    def policy_assignments(self) -> PolicyAssignmentsOperations: ...
    @property
    def policy_definitions(self) -> PolicyDefinitionsOperations: ...
    @property
    def policy_set_definitions(self) -> PolicySetDefinitionsOperations: ...

Policy and Governance

Subscription and Feature Management

Subscription operations and Azure feature management including feature registration, tenant-level operations, and subscription metadata management.

class SubscriptionClient:
    def __init__(self, credential, **kwargs): ...
    
    @property
    def subscriptions(self) -> SubscriptionsOperations: ...
    @property
    def tenants(self) -> TenantsOperations: ...

class FeatureClient:
    def __init__(self, credential, subscription_id: str, **kwargs): ...
    
    @property
    def features(self) -> FeaturesOperations: ...
    @property
    def subscription_feature_registrations(self) -> SubscriptionFeatureRegistrationsOperations: ...

Subscription and Features

Resource Protection and Linking

Resource locks for preventing accidental deletion or modification, resource links for creating relationships, managed applications, and data boundary management.

class ManagementLockClient:
    def __init__(self, credential, subscription_id: str, **kwargs): ...
    
    @property
    def management_locks(self) -> ManagementLocksOperations: ...

class ManagementLinkClient:
    def __init__(self, credential, subscription_id: str, **kwargs): ...
    
    @property
    def resource_links(self) -> ResourceLinksOperations: ...

class ApplicationClient:
    def __init__(self, credential, subscription_id: str, **kwargs): ...
    
    @property
    def applications(self) -> ApplicationsOperations: ...
    @property
    def application_definitions(self) -> ApplicationDefinitionsOperations: ...

class DataBoundaryMgmtClient:
    def __init__(self, credential, subscription_id: str, **kwargs): ...
    
    @property
    def data_boundaries(self) -> DataBoundariesOperations: ...

Resource Protection and Linking

Common Types

class Resource:
    """Base resource representation."""
    id: str
    name: str
    type: str
    location: str
    tags: dict

class ResourceGroup:
    """Resource group representation."""
    id: str
    name: str
    location: str
    properties: ResourceGroupProperties
    tags: dict
    managed_by: str

class GenericResource(Resource):
    """Generic resource with extended properties."""
    plan: Plan
    properties: object
    kind: str
    managed_by: str
    sku: Sku
    identity: Identity

# Authentication and client types
class DefaultAzureCredential:
    """Default Azure credential provider."""
    def __init__(self, **kwargs): ...

# Common result types  
class ResourceListResult:
    """Paginated list of resources."""
    value: List[GenericResource]
    next_link: str

class ResourceGroupListResult:
    """Paginated list of resource groups."""
    value: List[ResourceGroup]
    next_link: str

Error Handling

from azure.core.exceptions import (
    HttpResponseError,
    ResourceNotFoundError,
    ResourceExistsError
)

try:
    resource_group = client.resource_groups.get("nonexistent-rg")
except ResourceNotFoundError:
    print("Resource group not found")
except HttpResponseError as e:
    print(f"HTTP error: {e.status_code} - {e.message}")