Microsoft Azure Client Libraries for Python meta-package providing comprehensive access to Azure cloud services and management capabilities
npx @tessl/cli install tessl/pypi-azure@4.0.00
# Azure SDK for Python
1
2
A comprehensive meta-package providing access to Microsoft Azure cloud services and management capabilities for Python applications. This package serves as a convenience bundle that installs a curated set of individual Azure service libraries, enabling developers to access compute, networking, databases, AI services, and management operations through a unified SDK.
3
4
**Note**: This meta-package includes dependencies on Azure Storage packages (`azure-storage-blob`, `azure-storage-queue`, `azure-storage-file`, `azure-cosmosdb-table`, `azure-datalake-store`) that are distributed separately and not included in this repository.
5
6
## Package Information
7
8
- **Package Name**: azure
9
- **Language**: Python
10
- **Installation**: `pip install azure`
11
- **Version**: 4.0.0
12
- **License**: MIT
13
14
## Core Imports
15
16
```python
17
# Import specific service clients as needed
18
from azure.batch import BatchServiceClient
19
from azure.keyvault import KeyVaultClient
20
from azure.servicebus import ServiceBusService
21
from azure.mgmt.compute import ComputeManagementClient
22
```
23
24
Common namespace imports:
25
26
```python
27
import azure.batch
28
import azure.keyvault
29
import azure.mgmt.compute
30
```
31
32
## Basic Usage
33
34
```python
35
# Example: Working with Azure Batch
36
from azure.batch import BatchServiceClient
37
from azure.batch.batch_auth import SharedKeyCredentials
38
39
# Set up authentication
40
credentials = SharedKeyCredentials(account_name, account_key)
41
batch_client = BatchServiceClient(credentials, base_url=batch_url)
42
43
# List pools
44
pools = batch_client.pool.list()
45
for pool in pools:
46
print(f"Pool ID: {pool.id}")
47
48
# Example: Working with Key Vault
49
from azure.keyvault import KeyVaultClient
50
from azure.keyvault.authentication import KeyVaultAuthentication
51
52
# Set up authentication
53
def auth_callback(server, resource, scope):
54
# Implement authentication logic
55
return access_token
56
57
credentials = KeyVaultAuthentication(auth_callback)
58
client = KeyVaultClient(credentials)
59
60
# Get a secret
61
secret = client.get_secret("https://vault.vault.azure.net/", "secret-name", "")
62
print(f"Secret value: {secret.value}")
63
64
# Example: Working with Management Services
65
from azure.mgmt.compute import ComputeManagementClient
66
from azure.common.credentials import ServicePrincipalCredentials
67
68
# Set up authentication
69
credentials = ServicePrincipalCredentials(
70
client_id=client_id,
71
secret=client_secret,
72
tenant=tenant_id
73
)
74
75
# Create management client
76
compute_client = ComputeManagementClient(credentials, subscription_id)
77
78
# List virtual machines
79
vms = compute_client.virtual_machines.list_all()
80
for vm in vms:
81
print(f"VM: {vm.name}")
82
```
83
84
## Architecture
85
86
The Azure SDK for Python follows a modular architecture with three main layers:
87
88
- **Service Clients**: High-level clients for specific Azure services (Batch, Key Vault, Service Bus, etc.)
89
- **Management Clients**: Resource management clients for provisioning and configuring Azure resources
90
- **Common Libraries**: Shared authentication, error handling, and utility components
91
92
Each service provides:
93
- **Client Classes**: Main entry points for service operations
94
- **Models**: Data transfer objects representing Azure resources and request/response structures
95
- **Operations**: Grouped service operations (often auto-generated from Azure REST APIs)
96
- **Authentication**: Service-specific authentication helpers and credential management
97
98
## Capabilities
99
100
### Compute Services
101
102
Batch computing, container services, and compute resource management capabilities.
103
104
```python { .api }
105
class BatchServiceClient:
106
def __init__(self, credentials, base_url=None, **kwargs): ...
107
108
class ComputeManagementClient:
109
def __init__(self, credentials, subscription_id, **kwargs): ...
110
```
111
112
[Compute Services](./compute-services.md)
113
114
### Security and Identity
115
116
Key management, secret storage, and identity/access management services.
117
118
```python { .api }
119
class KeyVaultClient:
120
def __init__(self, credentials, **kwargs): ...
121
122
class GraphRbacManagementClient:
123
def __init__(self, credentials, tenant_id, **kwargs): ...
124
```
125
126
[Security and Identity](./security-identity.md)
127
128
### Messaging and Integration
129
130
Service Bus messaging, Event Grid event handling, and integration services.
131
132
```python { .api }
133
class ServiceBusService:
134
def __init__(self, account_name=None, account_key=None, **kwargs): ...
135
136
class EventGridClient:
137
def __init__(self, credentials, **kwargs): ...
138
```
139
140
[Messaging and Integration](./messaging-integration.md)
141
142
### Monitoring and Analytics
143
144
Application insights, log analytics, and monitoring capabilities.
145
146
```python { .api }
147
class ApplicationInsightsDataClient:
148
def __init__(self, credentials, **kwargs): ...
149
150
class LogAnalyticsDataClient:
151
def __init__(self, credentials, **kwargs): ...
152
```
153
154
[Monitoring and Analytics](./monitoring-analytics.md)
155
156
### Platform Services
157
158
Service Fabric orchestration and legacy service management capabilities.
159
160
```python { .api }
161
class ServiceFabricClientAPIs:
162
def __init__(self, **kwargs): ...
163
164
class ServiceManagementService:
165
def __init__(self, subscription_id, certificate_path, **kwargs): ...
166
```
167
168
[Platform Services](./platform-services.md)
169
170
### Resource Management
171
172
Comprehensive Azure resource management across all service categories including compute, storage, networking, databases, and more.
173
174
```python { .api }
175
# Core resource management
176
class ResourceManagementClient:
177
def __init__(self, credentials, subscription_id, **kwargs): ...
178
179
# Storage management
180
class StorageManagementClient:
181
def __init__(self, credentials, subscription_id, **kwargs): ...
182
183
# Network management
184
class NetworkManagementClient:
185
def __init__(self, credentials, subscription_id, **kwargs): ...
186
```
187
188
[Resource Management](./resource-management.md)
189
190
## Authentication Patterns
191
192
The Azure SDK supports multiple authentication methods:
193
194
```python { .api }
195
# Shared key authentication (for services like Batch)
196
class SharedKeyCredentials:
197
def __init__(self, account_name: str, account_key: str): ...
198
199
# Service principal authentication (for management operations)
200
class ServicePrincipalCredentials:
201
def __init__(self, client_id: str, secret: str, tenant: str): ...
202
203
# Key Vault specific authentication
204
class KeyVaultAuthentication:
205
def __init__(self, authorization_callback: callable): ...
206
207
# Access token for Key Vault authentication callbacks
208
class AccessToken:
209
def __init__(self, token: str): ...
210
token: str # Bearer token value
211
```
212
213
## Common Types
214
215
```python { .api }
216
# Configuration and options
217
class Configuration:
218
def __init__(self, **kwargs): ...
219
220
# Common model base class
221
class Model:
222
def __init__(self, **kwargs): ...
223
224
# Paging and iteration
225
class Paged:
226
def __iter__(self): ...
227
def __next__(self): ...
228
229
# Error types
230
class CloudException(Exception):
231
def __init__(self, message: str, response=None): ...
232
233
class ClientRequestError(Exception):
234
def __init__(self, message: str): ...
235
```