0
# Pipeline Clients
1
2
ARM-specific pipeline clients that extend Azure Core's pipeline architecture with ARM-specific policies and behaviors. These clients automatically include resource provider registration, ARM-specific logging, and authentication challenge handling.
3
4
## Capabilities
5
6
### ARMPipelineClient
7
8
Synchronous pipeline client designed specifically for Azure Resource Manager operations. Automatically includes ARM-specific policies and handles ARM authentication patterns.
9
10
```python { .api }
11
class ARMPipelineClient(PipelineClient[HTTPRequestType, HTTPResponseType]):
12
"""A pipeline client designed for ARM explicitly.
13
14
:param str base_url: URL for the request.
15
:keyword Pipeline pipeline: If omitted, a Pipeline object is created and returned.
16
:keyword list[HTTPPolicy] policies: If omitted, the standard policies of the configuration object is used.
17
:keyword per_call_policies: If specified, the policies will be added into the policy list before RetryPolicy
18
:paramtype per_call_policies: Union[HTTPPolicy, SansIOHTTPPolicy, list[HTTPPolicy], list[SansIOHTTPPolicy]]
19
:keyword per_retry_policies: If specified, the policies will be added into the policy list after RetryPolicy
20
:paramtype per_retry_policies: Union[HTTPPolicy, SansIOHTTPPolicy, list[HTTPPolicy], list[SansIOHTTPPolicy]]
21
:keyword HttpTransport transport: If omitted, RequestsTransport is used for synchronous transport.
22
"""
23
def __init__(self, base_url: str, **kwargs: Any) -> None: ...
24
```
25
26
#### Usage Example
27
28
```python
29
from azure.mgmt.core import ARMPipelineClient
30
from azure.core.configuration import Configuration
31
from azure.core.credentials import DefaultAzureCredential
32
33
# Create configuration
34
config = Configuration()
35
36
# Create ARM pipeline client
37
client = ARMPipelineClient(
38
base_url="https://management.azure.com",
39
config=config
40
)
41
42
# The client automatically includes:
43
# - ARMAutoResourceProviderRegistrationPolicy
44
# - ARMHttpLoggingPolicy (if not already configured)
45
```
46
47
### AsyncARMPipelineClient
48
49
Asynchronous pipeline client designed specifically for Azure Resource Manager operations. Provides the same ARM-specific enhancements as ARMPipelineClient but for async/await patterns.
50
51
```python { .api }
52
class AsyncARMPipelineClient(AsyncPipelineClient[HTTPRequestType, AsyncHTTPResponseType]):
53
"""A pipeline client designed for ARM explicitly.
54
55
:param str base_url: URL for the request.
56
:keyword AsyncPipeline pipeline: If omitted, a Pipeline object is created and returned.
57
:keyword list[AsyncHTTPPolicy] policies: If omitted, the standard policies of the configuration object is used.
58
:keyword per_call_policies: If specified, the policies will be added into the policy list before RetryPolicy
59
:paramtype per_call_policies: Union[AsyncHTTPPolicy, SansIOHTTPPolicy,
60
list[AsyncHTTPPolicy], list[SansIOHTTPPolicy]]
61
:keyword per_retry_policies: If specified, the policies will be added into the policy list after RetryPolicy
62
:paramtype per_retry_policies: Union[AsyncHTTPPolicy, SansIOHTTPPolicy,
63
list[AsyncHTTPPolicy], list[SansIOHTTPPolicy]]
64
:keyword AsyncHttpTransport transport: If omitted, AioHttpTransport is used for asynchronous transport.
65
"""
66
def __init__(self, base_url: str, **kwargs: Any) -> None: ...
67
```
68
69
#### Usage Example
70
71
```python
72
import asyncio
73
from azure.mgmt.core import AsyncARMPipelineClient
74
from azure.core.configuration import Configuration
75
from azure.core.credentials import DefaultAzureCredential
76
77
async def main():
78
# Create configuration
79
config = Configuration()
80
81
# Create async ARM pipeline client
82
client = AsyncARMPipelineClient(
83
base_url="https://management.azure.com",
84
config=config
85
)
86
87
# The client automatically includes:
88
# - AsyncARMAutoResourceProviderRegistrationPolicy
89
# - ARMHttpLoggingPolicy (if not already configured)
90
91
asyncio.run(main())
92
```
93
94
## Key Features
95
96
### Automatic Policy Injection
97
98
Both pipeline clients automatically inject ARM-specific policies when no explicit policies are provided:
99
100
- **Resource Provider Registration**: Automatically registers unregistered resource providers when encountering 409 errors with `MissingSubscriptionRegistration`
101
- **ARM Logging**: Enhanced HTTP logging with ARM-specific safe headers for rate limiting and request tracking
102
- **Authentication Challenge Handling**: Built-in support for Continuous Access Evaluation (CAE) challenges
103
104
### Configuration Requirements
105
106
Both clients require either:
107
- Explicit `policies` parameter, OR
108
- Valid `config` parameter (Configuration object)
109
110
If neither is provided, a `ValueError` is raised.
111
112
### Policy Order
113
114
When using configuration-based initialization, policies are added in this order:
115
1. Per-call policies (user-provided)
116
2. ARMAutoResourceProviderRegistrationPolicy (automatically added)
117
3. Standard configuration policies
118
4. Per-retry policies (user-provided)
119
120
## Types
121
122
```python { .api }
123
HTTPResponseType = TypeVar("HTTPResponseType")
124
HTTPRequestType = TypeVar("HTTPRequestType")
125
AsyncHTTPResponseType = TypeVar("AsyncHTTPResponseType", bound=AsyncContextManager)
126
```