0
# Azure Network Management Python SDK
1
2
Microsoft Azure Network Management Client Library for Python provides comprehensive programmatic access to Azure networking services through the Azure Resource Manager (ARM) API. This SDK enables developers to create, configure, and manage all Azure networking resources including virtual networks, load balancers, firewalls, VPN gateways, and advanced networking features.
3
4
## Package Information
5
6
- **Package Name**: azure-mgmt-network
7
- **Language**: Python
8
- **Installation**: `pip install azure-mgmt-network`
9
- **Version**: 29.0.0
10
- **License**: MIT
11
12
## Core Imports
13
14
```python
15
from azure.mgmt.network import NetworkManagementClient
16
```
17
18
For authentication:
19
20
```python
21
from azure.identity import DefaultAzureCredential
22
```
23
24
For async operations:
25
26
```python
27
from azure.mgmt.network.aio import NetworkManagementClient
28
```
29
30
## Basic Usage
31
32
```python
33
from azure.identity import DefaultAzureCredential
34
from azure.mgmt.network import NetworkManagementClient
35
36
# Initialize credentials and client
37
credential = DefaultAzureCredential()
38
subscription_id = "your-subscription-id"
39
client = NetworkManagementClient(credential, subscription_id)
40
41
# Create a virtual network
42
from azure.mgmt.network.models import VirtualNetwork, AddressSpace
43
44
vnet_params = VirtualNetwork(
45
location="East US",
46
address_space=AddressSpace(address_prefixes=["10.0.0.0/16"])
47
)
48
49
# Create or update virtual network (long-running operation)
50
operation = client.virtual_networks.begin_create_or_update(
51
resource_group_name="my-resource-group",
52
virtual_network_name="my-vnet",
53
parameters=vnet_params
54
)
55
vnet_result = operation.result() # Wait for completion
56
57
# List virtual networks in a resource group
58
vnets = list(client.virtual_networks.list(resource_group_name="my-resource-group"))
59
60
# Get specific virtual network
61
vnet = client.virtual_networks.get(
62
resource_group_name="my-resource-group",
63
virtual_network_name="my-vnet"
64
)
65
```
66
67
## Architecture
68
69
The Azure Network Management SDK follows Azure's Resource Manager architecture with:
70
71
- **NetworkManagementClient**: Main client providing access to all networking operations
72
- **Operations Classes**: 156 specialized operation classes for different Azure networking services
73
- **Models**: 1,066+ data model classes representing Azure network resources and configurations
74
- **Enumerations**: 255+ enum classes for standardized values and options
75
- **Long-running Operations (LRO)**: Automatic polling for operations that take time to complete
76
- **Authentication**: Integration with Azure Identity for secure credential management
77
78
The SDK covers the complete Azure networking ecosystem including core networking, security, connectivity, monitoring, and advanced features like network management and IPAM.
79
80
## Capabilities
81
82
### Virtual Networks and Subnets
83
84
Core virtual networking functionality for creating isolated network environments, managing subnets, configuring address spaces, and handling network peering relationships.
85
86
```python { .api }
87
class VirtualNetworksOperations:
88
def begin_create_or_update(self, resource_group_name: str, virtual_network_name: str, parameters: VirtualNetwork, **kwargs) -> LROPoller[VirtualNetwork]: ...
89
def get(self, resource_group_name: str, virtual_network_name: str, **kwargs) -> VirtualNetwork: ...
90
def begin_delete(self, resource_group_name: str, virtual_network_name: str, **kwargs) -> LROPoller[None]: ...
91
def list(self, resource_group_name: str, **kwargs) -> Iterable[VirtualNetwork]: ...
92
def list_all(self, **kwargs) -> Iterable[VirtualNetwork]: ...
93
94
class SubnetsOperations:
95
def begin_create_or_update(self, resource_group_name: str, virtual_network_name: str, subnet_name: str, subnet_parameters: Subnet, **kwargs) -> LROPoller[Subnet]: ...
96
def get(self, resource_group_name: str, virtual_network_name: str, subnet_name: str, **kwargs) -> Subnet: ...
97
def begin_delete(self, resource_group_name: str, virtual_network_name: str, subnet_name: str, **kwargs) -> LROPoller[None]: ...
98
def list(self, resource_group_name: str, virtual_network_name: str, **kwargs) -> Iterable[Subnet]: ...
99
```
100
101
[Virtual Networks and Subnets](./virtual-networks.md)
102
103
### Load Balancers
104
105
Comprehensive load balancing services including basic and standard load balancers, backend pools, frontend configurations, health probes, and traffic distribution rules.
106
107
```python { .api }
108
class LoadBalancersOperations:
109
def begin_create_or_update(self, resource_group_name: str, load_balancer_name: str, parameters: LoadBalancer, **kwargs) -> LROPoller[LoadBalancer]: ...
110
def get(self, resource_group_name: str, load_balancer_name: str, **kwargs) -> LoadBalancer: ...
111
def begin_delete(self, resource_group_name: str, load_balancer_name: str, **kwargs) -> LROPoller[None]: ...
112
def list(self, resource_group_name: str, **kwargs) -> Iterable[LoadBalancer]: ...
113
def list_all(self, **kwargs) -> Iterable[LoadBalancer]: ...
114
def begin_swap_public_ip_addresses(self, location: str, parameters: LoadBalancerVipSwapRequest, **kwargs) -> LROPoller[None]: ...
115
```
116
117
[Load Balancers](./load-balancers.md)
118
119
### Application Gateways
120
121
Layer 7 load balancing and web application firewall capabilities including SSL termination, URL-based routing, autoscaling, and WAF protection.
122
123
```python { .api }
124
class ApplicationGatewaysOperations:
125
def begin_create_or_update(self, resource_group_name: str, application_gateway_name: str, parameters: ApplicationGateway, **kwargs) -> LROPoller[ApplicationGateway]: ...
126
def get(self, resource_group_name: str, application_gateway_name: str, **kwargs) -> ApplicationGateway: ...
127
def begin_delete(self, resource_group_name: str, application_gateway_name: str, **kwargs) -> LROPoller[None]: ...
128
def list(self, resource_group_name: str, **kwargs) -> Iterable[ApplicationGateway]: ...
129
def begin_start(self, resource_group_name: str, application_gateway_name: str, **kwargs) -> LROPoller[None]: ...
130
def begin_stop(self, resource_group_name: str, application_gateway_name: str, **kwargs) -> LROPoller[None]: ...
131
def begin_backend_health(self, resource_group_name: str, application_gateway_name: str, **kwargs) -> LROPoller[ApplicationGatewayBackendHealth]: ...
132
```
133
134
**Note**: Application Gateway operations provide Layer 7 load balancing with SSL termination, URL-based routing, autoscaling, and WAF protection capabilities.
135
136
### Network Security
137
138
Network security services including Network Security Groups (NSGs), security rules, Application Security Groups (ASGs), and Azure's Network Security Perimeter features.
139
140
```python { .api }
141
class NetworkSecurityGroupsOperations:
142
def begin_create_or_update(self, resource_group_name: str, network_security_group_name: str, parameters: NetworkSecurityGroup, **kwargs) -> LROPoller[NetworkSecurityGroup]: ...
143
def get(self, resource_group_name: str, network_security_group_name: str, **kwargs) -> NetworkSecurityGroup: ...
144
def begin_delete(self, resource_group_name: str, network_security_group_name: str, **kwargs) -> LROPoller[None]: ...
145
def list(self, resource_group_name: str, **kwargs) -> Iterable[NetworkSecurityGroup]: ...
146
def list_all(self, **kwargs) -> Iterable[NetworkSecurityGroup]: ...
147
148
class SecurityRulesOperations:
149
def begin_create_or_update(self, resource_group_name: str, network_security_group_name: str, security_rule_name: str, security_rule_parameters: SecurityRule, **kwargs) -> LROPoller[SecurityRule]: ...
150
def get(self, resource_group_name: str, network_security_group_name: str, security_rule_name: str, **kwargs) -> SecurityRule: ...
151
def begin_delete(self, resource_group_name: str, network_security_group_name: str, security_rule_name: str, **kwargs) -> LROPoller[None]: ...
152
def list(self, resource_group_name: str, network_security_group_name: str, **kwargs) -> Iterable[SecurityRule]: ...
153
```
154
155
[Network Security](./network-security.md)
156
157
### Azure Firewalls
158
159
Next-generation firewall services including Azure Firewall, firewall policies, application and network rules, threat intelligence, and IDPS capabilities.
160
161
```python { .api }
162
class AzureFirewallsOperations:
163
def begin_create_or_update(self, resource_group_name: str, azure_firewall_name: str, parameters: AzureFirewall, **kwargs) -> LROPoller[AzureFirewall]: ...
164
def get(self, resource_group_name: str, azure_firewall_name: str, **kwargs) -> AzureFirewall: ...
165
def begin_delete(self, resource_group_name: str, azure_firewall_name: str, **kwargs) -> LROPoller[None]: ...
166
def list(self, resource_group_name: str, **kwargs) -> Iterable[AzureFirewall]: ...
167
def list_all(self, **kwargs) -> Iterable[AzureFirewall]: ...
168
169
class FirewallPoliciesOperations:
170
def begin_create_or_update(self, resource_group_name: str, firewall_policy_name: str, parameters: FirewallPolicy, **kwargs) -> LROPoller[FirewallPolicy]: ...
171
def get(self, resource_group_name: str, firewall_policy_name: str, **kwargs) -> FirewallPolicy: ...
172
def begin_delete(self, resource_group_name: str, firewall_policy_name: str, **kwargs) -> LROPoller[None]: ...
173
def list(self, resource_group_name: str, **kwargs) -> Iterable[FirewallPolicy]: ...
174
```
175
176
**Note**: Azure Firewall operations provide next-generation firewall services with threat intelligence, IDPS capabilities, and network/application rule management.
177
178
### ExpressRoute
179
180
Private connectivity to Azure through ExpressRoute circuits, peerings, connections, gateways, and cross-connections for hybrid networking scenarios.
181
182
```python { .api }
183
class ExpressRouteCircuitsOperations:
184
def begin_create_or_update(self, resource_group_name: str, circuit_name: str, parameters: ExpressRouteCircuit, **kwargs) -> LROPoller[ExpressRouteCircuit]: ...
185
def get(self, resource_group_name: str, circuit_name: str, **kwargs) -> ExpressRouteCircuit: ...
186
def begin_delete(self, resource_group_name: str, circuit_name: str, **kwargs) -> LROPoller[None]: ...
187
def list(self, resource_group_name: str, **kwargs) -> Iterable[ExpressRouteCircuit]: ...
188
def list_all(self, **kwargs) -> Iterable[ExpressRouteCircuit]: ...
189
190
class ExpressRouteGatewaysOperations:
191
def begin_create_or_update(self, resource_group_name: str, express_route_gateway_name: str, put_express_route_gateway_parameters: ExpressRouteGateway, **kwargs) -> LROPoller[ExpressRouteGateway]: ...
192
def get(self, resource_group_name: str, express_route_gateway_name: str, **kwargs) -> ExpressRouteGateway: ...
193
def begin_delete(self, resource_group_name: str, express_route_gateway_name: str, **kwargs) -> LROPoller[None]: ...
194
def list_by_resource_group(self, resource_group_name: str, **kwargs) -> Iterable[ExpressRouteGateway]: ...
195
def list_by_subscription(self, **kwargs) -> Iterable[ExpressRouteGateway]: ...
196
```
197
198
**Note**: ExpressRoute operations provide private connectivity through circuits, peerings, connections, gateways, and cross-connections for hybrid scenarios.
199
200
### VPN Gateways
201
202
Site-to-site and point-to-site VPN connectivity including virtual network gateways, VPN connections, Virtual WAN, VPN sites, and P2S VPN gateways.
203
204
```python { .api }
205
class VirtualNetworkGatewaysOperations:
206
def begin_create_or_update(self, resource_group_name: str, virtual_network_gateway_name: str, parameters: VirtualNetworkGateway, **kwargs) -> LROPoller[VirtualNetworkGateway]: ...
207
def get(self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs) -> VirtualNetworkGateway: ...
208
def begin_delete(self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs) -> LROPoller[None]: ...
209
def list(self, resource_group_name: str, **kwargs) -> Iterable[VirtualNetworkGateway]: ...
210
def begin_reset(self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs) -> LROPoller[VirtualNetworkGateway]: ...
211
212
class VpnGatewaysOperations:
213
def begin_create_or_update(self, resource_group_name: str, gateway_name: str, vpn_gateway_parameters: VpnGateway, **kwargs) -> LROPoller[VpnGateway]: ...
214
def get(self, resource_group_name: str, gateway_name: str, **kwargs) -> VpnGateway: ...
215
def begin_delete(self, resource_group_name: str, gateway_name: str, **kwargs) -> LROPoller[None]: ...
216
def list_by_resource_group(self, resource_group_name: str, **kwargs) -> Iterable[VpnGateway]: ...
217
def list(self, **kwargs) -> Iterable[VpnGateway]: ...
218
```
219
220
**Note**: VPN Gateway operations provide site-to-site and point-to-site VPN connectivity with Virtual WAN integration.
221
222
### Network Manager
223
224
Centralized network management for large-scale Azure networking including connectivity configurations, security admin configurations, and network grouping.
225
226
```python { .api }
227
class NetworkManagersOperations:
228
def begin_create_or_update(self, resource_group_name: str, network_manager_name: str, parameters: NetworkManager, **kwargs) -> LROPoller[NetworkManager]: ...
229
def get(self, resource_group_name: str, network_manager_name: str, **kwargs) -> NetworkManager: ...
230
def begin_delete(self, resource_group_name: str, network_manager_name: str, **kwargs) -> LROPoller[None]: ...
231
def list(self, resource_group_name: str, **kwargs) -> Iterable[NetworkManager]: ...
232
def list_by_subscription(self, **kwargs) -> Iterable[NetworkManager]: ...
233
234
class ConnectivityConfigurationsOperations:
235
def create_or_update(self, resource_group_name: str, network_manager_name: str, configuration_name: str, connectivity_configuration: ConnectivityConfiguration, **kwargs) -> ConnectivityConfiguration: ...
236
def get(self, resource_group_name: str, network_manager_name: str, configuration_name: str, **kwargs) -> ConnectivityConfiguration: ...
237
def begin_delete(self, resource_group_name: str, network_manager_name: str, configuration_name: str, **kwargs) -> LROPoller[None]: ...
238
def list(self, resource_group_name: str, network_manager_name: str, **kwargs) -> Iterable[ConnectivityConfiguration]: ...
239
```
240
241
**Note**: Network Manager operations provide centralized management for large-scale Azure networking with connectivity and security configurations.
242
243
### Network Interfaces and Public IPs
244
245
Network interface management, IP configurations, public IP addresses, custom IP prefixes, and network interface association operations.
246
247
```python { .api }
248
class NetworkInterfacesOperations:
249
def begin_create_or_update(self, resource_group_name: str, network_interface_name: str, parameters: NetworkInterface, **kwargs) -> LROPoller[NetworkInterface]: ...
250
def get(self, resource_group_name: str, network_interface_name: str, **kwargs) -> NetworkInterface: ...
251
def begin_delete(self, resource_group_name: str, network_interface_name: str, **kwargs) -> LROPoller[None]: ...
252
def list(self, resource_group_name: str, **kwargs) -> Iterable[NetworkInterface]: ...
253
def list_all(self, **kwargs) -> Iterable[NetworkInterface]: ...
254
255
class PublicIPAddressesOperations:
256
def begin_create_or_update(self, resource_group_name: str, public_ip_address_name: str, parameters: PublicIPAddress, **kwargs) -> LROPoller[PublicIPAddress]: ...
257
def get(self, resource_group_name: str, public_ip_address_name: str, **kwargs) -> PublicIPAddress: ...
258
def begin_delete(self, resource_group_name: str, public_ip_address_name: str, **kwargs) -> LROPoller[None]: ...
259
def list(self, resource_group_name: str, **kwargs) -> Iterable[PublicIPAddress]: ...
260
def list_all(self, **kwargs) -> Iterable[PublicIPAddress]: ...
261
```
262
263
[Network Interfaces and Public IPs](./network-interfaces.md)
264
265
### Route Management
266
267
Route tables, custom routes, route filters, route maps, and virtual router configurations for traffic routing and path control.
268
269
```python { .api }
270
class RouteTablesOperations:
271
def begin_create_or_update(self, resource_group_name: str, route_table_name: str, parameters: RouteTable, **kwargs) -> LROPoller[RouteTable]: ...
272
def get(self, resource_group_name: str, route_table_name: str, **kwargs) -> RouteTable: ...
273
def begin_delete(self, resource_group_name: str, route_table_name: str, **kwargs) -> LROPoller[None]: ...
274
def list(self, resource_group_name: str, **kwargs) -> Iterable[RouteTable]: ...
275
def list_all(self, **kwargs) -> Iterable[RouteTable]: ...
276
277
class RoutesOperations:
278
def begin_create_or_update(self, resource_group_name: str, route_table_name: str, route_name: str, route_parameters: Route, **kwargs) -> LROPoller[Route]: ...
279
def get(self, resource_group_name: str, route_table_name: str, route_name: str, **kwargs) -> Route: ...
280
def begin_delete(self, resource_group_name: str, route_table_name: str, route_name: str, **kwargs) -> LROPoller[None]: ...
281
def list(self, resource_group_name: str, route_table_name: str, **kwargs) -> Iterable[Route]: ...
282
```
283
284
**Note**: Route Management operations control traffic routing through route tables, custom routes, route filters, and virtual router configurations.
285
286
### Private Link
287
288
Private endpoint and private link service management for secure, private connectivity to Azure services over the Azure backbone network.
289
290
```python { .api }
291
class PrivateEndpointsOperations:
292
def begin_create_or_update(self, resource_group_name: str, private_endpoint_name: str, parameters: PrivateEndpoint, **kwargs) -> LROPoller[PrivateEndpoint]: ...
293
def get(self, resource_group_name: str, private_endpoint_name: str, **kwargs) -> PrivateEndpoint: ...
294
def begin_delete(self, resource_group_name: str, private_endpoint_name: str, **kwargs) -> LROPoller[None]: ...
295
def list(self, resource_group_name: str, **kwargs) -> Iterable[PrivateEndpoint]: ...
296
def list_by_subscription(self, **kwargs) -> Iterable[PrivateEndpoint]: ...
297
298
class PrivateLinkServicesOperations:
299
def begin_create_or_update(self, resource_group_name: str, service_name: str, parameters: PrivateLinkService, **kwargs) -> LROPoller[PrivateLinkService]: ...
300
def get(self, resource_group_name: str, service_name: str, **kwargs) -> PrivateLinkService: ...
301
def begin_delete(self, resource_group_name: str, service_name: str, **kwargs) -> LROPoller[None]: ...
302
def list(self, resource_group_name: str, **kwargs) -> Iterable[PrivateLinkService]: ...
303
def list_by_subscription(self, **kwargs) -> Iterable[PrivateLinkService]: ...
304
```
305
306
**Note**: Private Link operations provide secure, private connectivity to Azure services through private endpoints and private link services.
307
308
### Network Monitoring
309
310
Network monitoring, diagnostics, and troubleshooting through Network Watcher, packet capture, connection monitoring, and flow logs.
311
312
```python { .api }
313
class NetworkWatchersOperations:
314
def create_or_update(self, resource_group_name: str, network_watcher_name: str, parameters: NetworkWatcher, **kwargs) -> NetworkWatcher: ...
315
def get(self, resource_group_name: str, network_watcher_name: str, **kwargs) -> NetworkWatcher: ...
316
def delete(self, resource_group_name: str, network_watcher_name: str, **kwargs) -> None: ...
317
def list(self, resource_group_name: str, **kwargs) -> Iterable[NetworkWatcher]: ...
318
def list_all(self, **kwargs) -> Iterable[NetworkWatcher]: ...
319
def begin_verify_ip_flow(self, resource_group_name: str, network_watcher_name: str, parameters: VerificationIPFlowParameters, **kwargs) -> LROPoller[VerificationIPFlowResult]: ...
320
def begin_next_hop(self, resource_group_name: str, network_watcher_name: str, parameters: NextHopParameters, **kwargs) -> LROPoller[NextHopResult]: ...
321
def begin_get_security_group_view(self, resource_group_name: str, network_watcher_name: str, parameters: SecurityGroupViewParameters, **kwargs) -> LROPoller[SecurityGroupViewResult]: ...
322
323
class ConnectionMonitorsOperations:
324
def begin_create_or_update(self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, parameters: ConnectionMonitor, **kwargs) -> LROPoller[ConnectionMonitorResult]: ...
325
def get(self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs) -> ConnectionMonitorResult: ...
326
def begin_delete(self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs) -> LROPoller[None]: ...
327
def list(self, resource_group_name: str, network_watcher_name: str, **kwargs) -> Iterable[ConnectionMonitorResult]: ...
328
def begin_start(self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs) -> LROPoller[None]: ...
329
def begin_stop(self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs) -> LROPoller[None]: ...
330
def begin_query(self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs) -> LROPoller[ConnectionMonitorQueryResult]: ...
331
```
332
333
**Note**: Network Monitoring operations provide network diagnostics, troubleshooting, packet capture, connection monitoring, and flow logging capabilities.
334
335
### Virtual WAN and Hubs
336
337
Software-defined WAN architecture with virtual hubs, hub-to-hub connectivity, branch connections, and routing optimization.
338
339
```python { .api }
340
class VirtualWansOperations:
341
def begin_create_or_update(self, resource_group_name: str, virtual_wan_name: str, wan_parameters: VirtualWAN, **kwargs) -> LROPoller[VirtualWAN]: ...
342
def get(self, resource_group_name: str, virtual_wan_name: str, **kwargs) -> VirtualWAN: ...
343
def begin_delete(self, resource_group_name: str, virtual_wan_name: str, **kwargs) -> LROPoller[None]: ...
344
def list_by_resource_group(self, resource_group_name: str, **kwargs) -> Iterable[VirtualWAN]: ...
345
def list(self, **kwargs) -> Iterable[VirtualWAN]: ...
346
347
class VirtualHubsOperations:
348
def begin_create_or_update(self, resource_group_name: str, virtual_hub_name: str, virtual_hub_parameters: VirtualHub, **kwargs) -> LROPoller[VirtualHub]: ...
349
def get(self, resource_group_name: str, virtual_hub_name: str, **kwargs) -> VirtualHub: ...
350
def begin_delete(self, resource_group_name: str, virtual_hub_name: str, **kwargs) -> LROPoller[None]: ...
351
def list_by_resource_group(self, resource_group_name: str, **kwargs) -> Iterable[VirtualHub]: ...
352
def list(self, **kwargs) -> Iterable[VirtualHub]: ...
353
```
354
355
**Note**: Virtual WAN operations provide software-defined WAN architecture with virtual hubs, hub-to-hub connectivity, and routing optimization.
356
357
## Core Types
358
359
```python { .api }
360
class NetworkManagementClient:
361
def __init__(self, credential: TokenCredential, subscription_id: str, base_url: Optional[str] = None, **kwargs): ...
362
def close(self) -> None: ...
363
def __enter__(self) -> "NetworkManagementClient": ...
364
def __exit__(self, *exc_details) -> None: ...
365
366
class LROPoller(Generic[PollingReturnType]):
367
def result(self, timeout: Optional[int] = None) -> PollingReturnType: ...
368
def wait(self, timeout: Optional[int] = None) -> None: ...
369
def done(self) -> bool: ...
370
def status(self) -> str: ...
371
372
# Common resource properties
373
class Resource:
374
def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): ...
375
location: Optional[str]
376
tags: Optional[Dict[str, str]]
377
id: Optional[str] # Read-only
378
name: Optional[str] # Read-only
379
type: Optional[str] # Read-only
380
381
# Common provisioning states
382
class ProvisioningState(str, Enum):
383
SUCCEEDED = "Succeeded"
384
UPDATING = "Updating"
385
DELETING = "Deleting"
386
FAILED = "Failed"
387
```
388
389
## Authentication
390
391
```python { .api }
392
# Required credential types
393
from azure.core.credentials import TokenCredential
394
395
# Common credential implementations
396
from azure.identity import (
397
DefaultAzureCredential,
398
ManagedIdentityCredential,
399
ClientSecretCredential,
400
ClientCertificateCredential,
401
AzureCliCredential
402
)
403
```
404
405
## Error Handling
406
407
The SDK uses Azure Core's error handling with these common exceptions:
408
409
- **ResourceNotFoundError**: Resource doesn't exist (404)
410
- **ResourceExistsError**: Resource already exists (409)
411
- **ClientAuthenticationError**: Authentication failed (401)
412
- **HttpResponseError**: General HTTP errors
413
- **ServiceRequestError**: Request errors
414
- **ServiceResponseError**: Response parsing errors
415
416
## Long-Running Operations
417
418
Many operations return `LROPoller` objects for long-running operations:
419
420
```python
421
# Start operation and get poller
422
poller = client.virtual_networks.begin_create_or_update(rg, name, params)
423
424
# Wait for completion and get result
425
result = poller.result(timeout=300) # 5 minute timeout
426
427
# Check status without blocking
428
if poller.done():
429
result = poller.result()
430
```