Microsoft Azure Client Libraries for Python meta-package providing comprehensive access to Azure cloud services and management capabilities
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Azure Resource Management provides comprehensive Azure resource management capabilities across all service categories. This includes the azure-mgmt meta-package that bundles 40+ management clients for compute, storage, networking, databases, AI services, and more.
The azure-mgmt meta-package installs a comprehensive set of Azure Resource Manager clients, enabling programmatic management of Azure resources through the Azure Resource Manager APIs. Each service area provides dedicated management clients with full CRUD operations, configuration management, and monitoring capabilities.
Central client for Azure Resource Manager operations including resource groups, deployments, and resource management.
class ResourceManagementClient:
"""
Client for Azure Resource Manager operations.
Parameters:
- credentials: Authentication credentials (ServicePrincipalCredentials)
- subscription_id: str, Azure subscription ID
"""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def resource_groups(self): ... # Resource group operations
@property
def resources(self): ... # Resource operations
@property
def providers(self): ... # Resource provider operations
@property
def features(self): ... # Feature operations
@property
def tags(self): ... # Tag operations
@property
def deployments(self): ... # Deployment operations
@property
def deployment_operations(self): ... # Deployment operation trackingclass SubscriptionClient:
"""Client for Azure subscription management operations."""
def __init__(self, credentials, **kwargs): ...
@property
def subscriptions(self): ... # Subscription operations
@property
def tenants(self): ... # Tenant operationsclass ComputeManagementClient:
"""
Client for Azure Compute resource management.
Parameters:
- credentials: Authentication credentials
- subscription_id: str, Azure subscription ID
"""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def virtual_machines(self): ... # VM operations
@property
def virtual_machine_scale_sets(self): ... # VM Scale Set operations
@property
def availability_sets(self): ... # Availability Set operations
@property
def virtual_machine_sizes(self): ... # VM Size operations
@property
def images(self): ... # Image operations
@property
def usage(self): ... # Usage operations
@property
def disks(self): ... # Managed Disk operations
@property
def snapshots(self): ... # Snapshot operations
@property
def galleries(self): ... # Shared Image Gallery operations
@property
def gallery_images(self): ... # Gallery Image operations
@property
def gallery_image_versions(self): ... # Gallery Image Version operationsclass ContainerServiceClient:
"""Client for Azure Container Service management."""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def container_services(self): ... # Container service operations
class ContainerInstanceManagementClient:
"""Client for Azure Container Instances management."""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def container_groups(self): ... # Container group operations
@property
def container_group_usage(self): ... # Usage operations
class ContainerRegistryManagementClient:
"""Client for Azure Container Registry management."""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def registries(self): ... # Registry operations
@property
def operations(self): ... # Available operations
@property
def replications(self): ... # Registry replication operations
@property
def webhooks(self): ... # Webhook operationsclass StorageManagementClient:
"""
Client for Azure Storage account management.
Parameters:
- credentials: Authentication credentials
- subscription_id: str, Azure subscription ID
"""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def storage_accounts(self): ... # Storage account operations
@property
def usage(self): ... # Storage usage operations
@property
def management_policies(self): ... # Lifecycle management policies
@property
def blob_inventory_policies(self): ... # Blob inventory policies
@property
def private_endpoint_connections(self): ... # Private endpoint operations
@property
def private_link_resources(self): ... # Private link resources
@property
def object_replication_policies(self): ... # Object replication policies
@property
def encryption_scopes(self): ... # Encryption scope operationsclass NetworkManagementClient:
"""
Client for Azure Virtual Network management.
Parameters:
- credentials: Authentication credentials
- subscription_id: str, Azure subscription ID
"""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def virtual_networks(self): ... # Virtual network operations
@property
def subnets(self): ... # Subnet operations
@property
def network_interfaces(self): ... # Network interface operations
@property
def public_ip_addresses(self): ... # Public IP operations
@property
def network_security_groups(self): ... # NSG operations
@property
def security_rules(self): ... # Security rule operations
@property
def route_tables(self): ... # Route table operations
@property
def routes(self): ... # Route operations
@property
def load_balancers(self): ... # Load balancer operations
@property
def application_gateways(self): ... # Application gateway operations
@property
def virtual_network_gateways(self): ... # VPN gateway operations
@property
def local_network_gateways(self): ... # Local network gateway operations
@property
def virtual_network_gateway_connections(self): ... # VPN connections
@property
def express_route_circuits(self): ... # ExpressRoute circuit operations
@property
def express_route_circuit_authorizations(self): ... # ExpressRoute authorizations
@property
def express_route_circuit_peerings(self): ... # ExpressRoute peering operations
@property
def network_watchers(self): ... # Network Watcher operations
@property
def packet_captures(self): ... # Packet capture operations
@property
def connection_monitors(self): ... # Connection monitor operationsclass TrafficManagerManagementClient:
"""Client for Azure Traffic Manager management."""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def profiles(self): ... # Traffic Manager profile operations
@property
def endpoints(self): ... # Endpoint operations
@property
def geographic_hierarchies(self): ... # Geographic hierarchy operations
@property
def heat_map(self): ... # Traffic heat map operations
@property
def traffic_manager_user_metrics_keys(self): ... # User metrics operationsclass SqlManagementClient:
"""
Client for Azure SQL Database management.
Parameters:
- credentials: Authentication credentials
- subscription_id: str, Azure subscription ID
"""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def servers(self): ... # SQL Server operations
@property
def server_connection_policies(self): ... # Connection policy operations
@property
def database_threat_detection_policies(self): ... # Threat detection policies
@property
def backup_short_term_retention_policies(self): ... # Backup retention policies
@property
def restore_points(self): ... # Restore point operations
@property
def recoverable_databases(self): ... # Recoverable database operations
@property
def restorable_dropped_databases(self): ... # Dropped database operations
@property
def databases(self): ... # Database operations
@property
def elastic_pools(self): ... # Elastic pool operations
@property
def recommended_elastic_pools(self): ... # Recommended pool operations
@property
def replication_links(self): ... # Replication link operations
@property
def server_azure_ad_administrators(self): ... # Azure AD admin operations
@property
def server_communication_links(self): ... # Server communication operations
@property
def service_objectives(self): ... # Service objective operations
@property
def firewall_rules(self): ... # Firewall rule operations
@property
def elastic_pool_activities(self): ... # Pool activity operations
@property
def elastic_pool_database_activities(self): ... # Pool database activities
@property
def service_tier_advisors(self): ... # Service tier advisor operations
@property
def transparent_data_encryptions(self): ... # TDE operations
@property
def transparent_data_encryption_activities(self): ... # TDE activities
@property
def server_usage_metrics(self): ... # Server usage metrics
@property
def database_usage_metrics(self): ... # Database usage metricsclass CosmosDBManagementClient:
"""Client for Azure Cosmos DB management."""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def database_accounts(self): ... # Database account operations
@property
def operations(self): ... # Available operations
@property
def database(self): ... # Database operations
@property
def collection(self): ... # Collection operations
@property
def collection_region(self): ... # Collection region operations
@property
def database_account_region(self): ... # Account region operations
@property
def percentile_source_target(self): ... # Percentile operations
@property
def percentile_target(self): ... # Target percentile operations
@property
def percentile(self): ... # Percentile metrics
@property
def collection_partition_region(self): ... # Partition region operations
@property
def collection_partition(self): ... # Partition operations
@property
def partition_key_range_id(self): ... # Partition key range operations
@property
def partition_key_range_id_region(self): ... # Partition key range region operations
@property
def sql_resources(self): ... # SQL API resources
@property
def mongo_db_resources(self): ... # MongoDB API resources
@property
def table_resources(self): ... # Table API resources
@property
def cassandra_resources(self): ... # Cassandra API resources
@property
def gremlin_resources(self): ... # Gremlin API resources
@property
def notebook_workspaces(self): ... # Notebook workspace operations
@property
def private_endpoint_connections(self): ... # Private endpoint operations
@property
def private_link_resources(self): ... # Private link resources
@property
def restorable_database_accounts(self): ... # Restorable account operations
@property
def restorable_sql_databases(self): ... # Restorable SQL database operations
@property
def restorable_sql_containers(self): ... # Restorable SQL container operations
@property
def restorable_sql_resources(self): ... # Restorable SQL resource operations
@property
def restorable_mongodb_databases(self): ... # Restorable MongoDB database operations
@property
def restorable_mongodb_collections(self): ... # Restorable MongoDB collection operations
@property
def restorable_mongodb_resources(self): ... # Restorable MongoDB resource operationsclass KeyVaultManagementClient:
"""Client for Azure Key Vault management."""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def vaults(self): ... # Key Vault operations
@property
def private_endpoint_connections(self): ... # Private endpoint operations
@property
def private_link_resources(self): ... # Private link resources
@property
def managed_hsms(self): ... # Managed HSM operations
@property
def mhsm_private_endpoint_connections(self): ... # HSM private endpoints
@property
def mhsm_private_link_resources(self): ... # HSM private link resources
@property
def keys(self): ... # Key operations
@property
def secrets(self): ... # Secret operationsclass CognitiveServicesManagementClient:
"""Client for Azure Cognitive Services management."""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def accounts(self): ... # Cognitive Services account operations
@property
def resource_skus(self): ... # Available SKU operations
@property
def operations(self): ... # Available operations
@property
def check_domain_availability(self): ... # Domain availability operations
@property
def private_endpoint_connections(self): ... # Private endpoint operations
@property
def private_link_resources(self): ... # Private link resources
@property
def deployments(self): ... # Model deployment operationsclass MonitorManagementClient:
"""Client for Azure Monitor management."""
def __init__(self, credentials, subscription_id: str, **kwargs): ...
@property
def autoscale_settings(self): ... # Autoscale setting operations
@property
def operations(self): ... # Available operations
@property
def alert_rule_incidents(self): ... # Alert rule incident operations
@property
def alert_rules(self): ... # Alert rule operations
@property
def log_profiles(self): ... # Log profile operations
@property
def diagnostic_settings(self): ... # Diagnostic setting operations
@property
def diagnostic_settings_category(self): ... # Diagnostic category operations
@property
def action_groups(self): ... # Action group operations
@property
def activity_log_alerts(self): ... # Activity log alert operations
@property
def activity_logs(self): ... # Activity log operations
@property
def event_categories(self): ... # Event category operations
@property
def tenant_activity_logs(self): ... # Tenant activity log operations
@property
def metric_definitions(self): ... # Metric definition operations
@property
def metrics(self): ... # Metric operations
@property
def metric_alerts(self): ... # Metric alert operations
@property
def metric_alerts_status(self): ... # Metric alert status operations
@property
def scheduled_query_rules(self): ... # Scheduled query rule operations
@property
def metric_namespaces(self): ... # Metric namespace operations
@property
def vm_insights(self): ... # VM insights operationsfrom azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.network import NetworkManagementClient
from azure.common.credentials import ServicePrincipalCredentials
# Set up authentication
credentials = ServicePrincipalCredentials(
client_id=client_id,
secret=client_secret,
tenant=tenant_id
)
# Create management clients
resource_client = ResourceManagementClient(credentials, subscription_id)
compute_client = ComputeManagementClient(credentials, subscription_id)
network_client = NetworkManagementClient(credentials, subscription_id)
# Create resource group
resource_group_params = {
'location': 'East US',
'tags': {
'environment': 'production',
'project': 'myproject'
}
}
resource_group = resource_client.resource_groups.create_or_update(
'myresourcegroup',
resource_group_params
)
print(f"Created resource group: {resource_group.name}")
# List resource groups
resource_groups = resource_client.resource_groups.list()
for rg in resource_groups:
print(f"Resource Group: {rg.name}, Location: {rg.location}")from azure.mgmt.compute.models import VirtualMachine, HardwareProfile, StorageProfile, OSProfile
# Create a virtual machine
vm_parameters = VirtualMachine(
location='East US',
hardware_profile=HardwareProfile(vm_size='Standard_B1s'),
storage_profile=StorageProfile(
image_reference={
'publisher': 'Canonical',
'offer': 'UbuntuServer',
'sku': '18.04-LTS',
'version': 'latest'
}
),
os_profile=OSProfile(
computer_name='myvm',
admin_username='azureuser',
admin_password='MyPassword123!'
),
network_profile={
'network_interfaces': [{
'id': network_interface_id
}]
}
)
# Create the VM
vm_operation = compute_client.virtual_machines.create_or_update(
'myresourcegroup',
'myvm',
vm_parameters
)
vm_result = vm_operation.result()
print(f"Created VM: {vm_result.name}")
# List VMs
vms = compute_client.virtual_machines.list('myresourcegroup')
for vm in vms:
print(f"VM: {vm.name}, Status: {vm.provisioning_state}")
# Start/Stop VM
print("Starting VM...")
start_operation = compute_client.virtual_machines.start('myresourcegroup', 'myvm')
start_operation.wait()
print("Stopping VM...")
stop_operation = compute_client.virtual_machines.power_off('myresourcegroup', 'myvm')
stop_operation.wait()from azure.mgmt.storage import StorageManagementClient
from azure.mgmt.storage.models import StorageAccountCreateParameters, Sku, Kind
storage_client = StorageManagementClient(credentials, subscription_id)
# Create storage account
storage_account_params = StorageAccountCreateParameters(
sku=Sku(name='Standard_LRS'),
kind=Kind.storage_v2,
location='East US',
tags={
'environment': 'production'
}
)
storage_operation = storage_client.storage_accounts.create(
'myresourcegroup',
'mystorageaccount',
storage_account_params
)
storage_account = storage_operation.result()
print(f"Created storage account: {storage_account.name}")
# Get storage account keys
keys = storage_client.storage_accounts.list_keys('myresourcegroup', 'mystorageaccount')
primary_key = keys.keys[0].value
print(f"Primary key: {primary_key}")
# List storage accounts
storage_accounts = storage_client.storage_accounts.list_by_resource_group('myresourcegroup')
for account in storage_accounts:
print(f"Storage Account: {account.name}, SKU: {account.sku.name}")from azure.mgmt.sql import SqlManagementClient
from azure.mgmt.sql.models import Server, ServerForCreate, Database
sql_client = SqlManagementClient(credentials, subscription_id)
# Create SQL Server
server_params = Server(
location='East US',
administrator_login='sqladmin',
administrator_login_password='MyPassword123!',
version='12.0'
)
server_operation = sql_client.servers.create_or_update(
'myresourcegroup',
'mysqlserver',
server_params
)
server = server_operation.result()
print(f"Created SQL Server: {server.name}")
# Create database
database_params = Database(
location='East US',
requested_service_objective_name='S0'
)
database_operation = sql_client.databases.create_or_update(
'myresourcegroup',
'mysqlserver',
'mydatabase',
database_params
)
database = database_operation.result()
print(f"Created database: {database.name}")
# List databases
databases = sql_client.databases.list_by_server('myresourcegroup', 'mysqlserver')
for db in databases:
if db.name != 'master': # Skip system database
print(f"Database: {db.name}, Status: {db.status}")from azure.mgmt.monitor import MonitorManagementClient
from datetime import datetime, timedelta
monitor_client = MonitorManagementClient(credentials, subscription_id)
# Get metrics for a resource
resource_uri = f"/subscriptions/{subscription_id}/resourceGroups/myresourcegroup/providers/Microsoft.Compute/virtualMachines/myvm"
# Define time range
end_time = datetime.utcnow()
start_time = end_time - timedelta(hours=1)
# Get CPU percentage metrics
metrics = monitor_client.metrics.list(
resource_uri,
timespan=f"{start_time.isoformat()}/{end_time.isoformat()}",
interval='PT5M', # 5-minute intervals
metricnames='Percentage CPU',
aggregation='Average'
)
for metric in metrics.value:
print(f"Metric: {metric.name.value}")
for timeseries in metric.timeseries:
for data_point in timeseries.data:
print(f" {data_point.time_stamp}: {data_point.average}%")
# List available metrics for a resource
metric_definitions = monitor_client.metric_definitions.list(resource_uri)
print("Available metrics:")
for metric_def in metric_definitions:
print(f" {metric_def.name.value} ({metric_def.unit})")Install with Tessl CLI
npx tessl i tessl/pypi-azure