0
# Endpoint Management
1
2
Management of Traffic Manager endpoints including Azure endpoints, external endpoints, and nested endpoints with full CRUD operations. Endpoints represent the actual services that receive traffic and can be configured with weights, priorities, geographic mappings, and health monitoring settings.
3
4
## Capabilities
5
6
### Create or Update Endpoint
7
8
Creates a new Traffic Manager endpoint or updates an existing one with complete configuration including target, routing settings, and health monitoring parameters.
9
10
```python { .api }
11
def create_or_update(
12
resource_group_name: str,
13
profile_name: str,
14
endpoint_type: Union[str, EndpointType],
15
endpoint_name: str,
16
parameters: Union[Endpoint, IO]
17
) -> Endpoint:
18
"""
19
Creates or updates a Traffic Manager endpoint.
20
21
Args:
22
resource_group_name (str): Name of the resource group
23
profile_name (str): Name of the Traffic Manager profile
24
endpoint_type (Union[str, EndpointType]): Type of endpoint
25
endpoint_name (str): Name of the endpoint
26
parameters (Endpoint): Endpoint configuration
27
28
Returns:
29
Endpoint: The created or updated endpoint
30
"""
31
```
32
33
**Usage Examples:**
34
35
```python
36
from azure.mgmt.trafficmanager.models import Endpoint, EndpointType
37
38
# Azure endpoint (points to Azure resource)
39
azure_endpoint = Endpoint(
40
target_resource_id="/subscriptions/12345/resourceGroups/my-rg/providers/Microsoft.Web/sites/my-web-app",
41
endpoint_status="Enabled",
42
weight=100,
43
priority=1,
44
endpoint_location="East US", # For performance routing
45
custom_headers=[
46
{"name": "X-Forwarded-Host", "value": "original.example.com"}
47
]
48
)
49
50
endpoint = client.endpoints.create_or_update(
51
resource_group_name="my-rg",
52
profile_name="my-profile",
53
endpoint_type=EndpointType.AZURE_ENDPOINTS,
54
endpoint_name="web-app-east",
55
parameters=azure_endpoint
56
)
57
58
# External endpoint (points to external FQDN/IP)
59
external_endpoint = Endpoint(
60
target="external-service.example.com",
61
endpoint_status="Enabled",
62
weight=50,
63
priority=2,
64
endpoint_location="West Europe",
65
geo_mapping=["FR", "DE", "ES"], # For geographic routing
66
subnets=[ # For subnet routing
67
{"first": "192.168.1.0", "scope": 24},
68
{"first": "10.0.0.0", "last": "10.0.0.255"}
69
]
70
)
71
72
external_ep = client.endpoints.create_or_update(
73
resource_group_name="my-rg",
74
profile_name="my-profile",
75
endpoint_type="ExternalEndpoints",
76
endpoint_name="external-service",
77
parameters=external_endpoint
78
)
79
80
# Nested endpoint (points to another Traffic Manager profile)
81
nested_endpoint = Endpoint(
82
target_resource_id="/subscriptions/12345/resourceGroups/nested-rg/providers/Microsoft.Network/trafficManagerProfiles/nested-profile",
83
endpoint_status="Enabled",
84
weight=75,
85
priority=1,
86
min_child_endpoints=2, # Minimum healthy child endpoints
87
min_child_endpoints_i_pv4=1, # Minimum IPv4 endpoints
88
min_child_endpoints_i_pv6=1, # Minimum IPv6 endpoints
89
endpoint_location="Global"
90
)
91
92
nested_ep = client.endpoints.create_or_update(
93
resource_group_name="my-rg",
94
profile_name="my-profile",
95
endpoint_type="NestedEndpoints",
96
endpoint_name="nested-profile",
97
parameters=nested_endpoint
98
)
99
```
100
101
### Get Endpoint
102
103
Retrieves a specific Traffic Manager endpoint with complete configuration details and current health status.
104
105
```python { .api }
106
def get(
107
resource_group_name: str,
108
profile_name: str,
109
endpoint_type: Union[str, EndpointType],
110
endpoint_name: str
111
) -> Endpoint:
112
"""
113
Gets a Traffic Manager endpoint.
114
115
Args:
116
resource_group_name (str): Name of the resource group
117
profile_name (str): Name of the Traffic Manager profile
118
endpoint_type (Union[str, EndpointType]): Type of endpoint
119
endpoint_name (str): Name of the endpoint
120
121
Returns:
122
Endpoint: The Traffic Manager endpoint
123
"""
124
```
125
126
### Update Endpoint
127
128
Updates an existing Traffic Manager endpoint with partial configuration changes while preserving unchanged settings.
129
130
```python { .api }
131
def update(
132
resource_group_name: str,
133
profile_name: str,
134
endpoint_type: Union[str, EndpointType],
135
endpoint_name: str,
136
parameters: Union[Endpoint, IO]
137
) -> Endpoint:
138
"""
139
Updates a Traffic Manager endpoint.
140
141
Args:
142
resource_group_name (str): Name of the resource group
143
profile_name (str): Name of the Traffic Manager profile
144
endpoint_type (Union[str, EndpointType]): Type of endpoint
145
endpoint_name (str): Name of the endpoint
146
parameters (Endpoint): Updated endpoint configuration
147
148
Returns:
149
Endpoint: The updated endpoint
150
"""
151
```
152
153
**Usage Example:**
154
155
```python
156
# Update endpoint weight for traffic shifting
157
endpoint = client.endpoints.get(
158
resource_group_name="my-rg",
159
profile_name="my-profile",
160
endpoint_type="AzureEndpoints",
161
endpoint_name="web-app-east"
162
)
163
164
# Reduce traffic to this endpoint
165
endpoint.weight = 25
166
endpoint.custom_headers.append({"name": "X-Canary", "value": "true"})
167
168
updated_endpoint = client.endpoints.update(
169
resource_group_name="my-rg",
170
profile_name="my-profile",
171
endpoint_type="AzureEndpoints",
172
endpoint_name="web-app-east",
173
parameters=endpoint
174
)
175
```
176
177
### Delete Endpoint
178
179
Deletes a Traffic Manager endpoint permanently, removing it from the traffic routing configuration.
180
181
```python { .api }
182
def delete(
183
resource_group_name: str,
184
profile_name: str,
185
endpoint_type: Union[str, EndpointType],
186
endpoint_name: str
187
) -> Optional[DeleteOperationResult]:
188
"""
189
Deletes a Traffic Manager endpoint.
190
191
Args:
192
resource_group_name (str): Name of the resource group
193
profile_name (str): Name of the Traffic Manager profile
194
endpoint_type (Union[str, EndpointType]): Type of endpoint
195
endpoint_name (str): Name of the endpoint
196
197
Returns:
198
Optional[DeleteOperationResult]: Operation result or None
199
"""
200
```
201
202
## Endpoint Configuration Types
203
204
### Endpoint Types
205
206
```python { .api }
207
class EndpointType(str, Enum):
208
"""Types of Traffic Manager endpoints."""
209
AZURE_ENDPOINTS = "AzureEndpoints" # Azure resources
210
EXTERNAL_ENDPOINTS = "ExternalEndpoints" # External services
211
NESTED_ENDPOINTS = "NestedEndpoints" # Nested Traffic Manager profiles
212
```
213
214
### Endpoint Configuration
215
216
```python { .api }
217
class Endpoint:
218
"""Traffic Manager endpoint configuration."""
219
# Target configuration
220
target_resource_id: str # Azure Resource URI (for Azure/Nested endpoints)
221
target: str # FQDN or IP (for External endpoints)
222
223
# Status and routing
224
endpoint_status: EndpointStatus # Enabled or Disabled
225
endpoint_monitor_status: EndpointMonitorStatus # Health status (read-only)
226
227
# Routing weights and priorities
228
weight: int # Weight for Weighted routing (1-1000)
229
priority: int # Priority for Priority routing (1-1000)
230
231
# Location and geographic mapping
232
endpoint_location: str # Location for Performance routing
233
geo_mapping: List[str] # Geographic codes for Geographic routing
234
235
# Subnet routing
236
subnets: List[EndpointPropertiesSubnetsItem] # Subnet mappings for Subnet routing
237
238
# Nested endpoint configuration
239
min_child_endpoints: int # Minimum healthy child endpoints
240
min_child_endpoints_i_pv4: int # Minimum IPv4 child endpoints
241
min_child_endpoints_i_pv6: int # Minimum IPv6 child endpoints
242
243
# Custom headers and advanced options
244
custom_headers: List[EndpointPropertiesCustomHeadersItem] # Custom HTTP headers
245
always_serve: AlwaysServe # Always serve configuration
246
247
class EndpointPropertiesCustomHeadersItem:
248
"""Custom header for endpoint requests."""
249
name: str # Header name
250
value: str # Header value
251
252
class EndpointPropertiesSubnetsItem:
253
"""Subnet configuration for subnet routing."""
254
first: str # First IP address in range
255
last: str # Last IP address in range (optional)
256
scope: int # Subnet mask bits (optional)
257
```
258
259
### Endpoint Status Types
260
261
```python { .api }
262
class EndpointStatus(str, Enum):
263
"""Endpoint operational status."""
264
ENABLED = "Enabled" # Endpoint accepts traffic
265
DISABLED = "Disabled" # Endpoint does not accept traffic
266
267
class EndpointMonitorStatus(str, Enum):
268
"""Endpoint health monitoring status."""
269
CHECKING_ENDPOINT = "CheckingEndpoint" # Health check in progress
270
ONLINE = "Online" # Endpoint is healthy
271
DEGRADED = "Degraded" # Endpoint has issues
272
DISABLED = "Disabled" # Monitoring disabled
273
INACTIVE = "Inactive" # Endpoint inactive
274
STOPPED = "Stopped" # Endpoint stopped
275
UNMONITORED = "Unmonitored" # Not monitored
276
277
class AlwaysServe(str, Enum):
278
"""Always serve configuration."""
279
ENABLED = "Enabled" # Always serve endpoint
280
DISABLED = "Disabled" # Standard serving logic
281
```
282
283
## Routing Configuration Guidelines
284
285
### Performance Routing
286
287
For performance-based routing, configure `endpoint_location` to match the Azure region or geographic location of the endpoint:
288
289
```python
290
endpoint.endpoint_location = "East US" # Azure region
291
endpoint.endpoint_location = "North America" # Geographic region
292
```
293
294
### Weighted Routing
295
296
For weighted routing, assign weights (1-1000) to distribute traffic proportionally:
297
298
```python
299
endpoint_a.weight = 80 # 80% of traffic
300
endpoint_b.weight = 20 # 20% of traffic
301
```
302
303
### Priority Routing
304
305
For failover routing, assign priorities (1=highest, higher numbers=lower priority):
306
307
```python
308
primary_endpoint.priority = 1 # Primary
309
secondary_endpoint.priority = 2 # Failover
310
```
311
312
### Geographic Routing
313
314
For geographic routing, specify region codes in `geo_mapping`:
315
316
```python
317
# European traffic
318
endpoint.geo_mapping = ["FR", "DE", "IT", "ES", "WORLD-EUR"]
319
320
# North American traffic
321
endpoint.geo_mapping = ["US", "CA", "MX"]
322
```
323
324
### Subnet Routing
325
326
For subnet-based routing, configure IP ranges:
327
328
```python
329
endpoint.subnets = [
330
{"first": "192.168.1.0", "scope": 24}, # CIDR notation
331
{"first": "10.0.0.1", "last": "10.0.0.100"} # Range notation
332
]
333
```
334
335
### MultiValue Routing
336
337
For MultiValue routing, endpoints return multiple healthy endpoints (no special configuration needed on endpoints, configure `max_return` on profile).
338
339
## Advanced Endpoint Configurations
340
341
### Custom Headers
342
343
Add custom headers for endpoint requests:
344
345
```python
346
endpoint.custom_headers = [
347
{"name": "X-Forwarded-Host", "value": "original.example.com"},
348
{"name": "Authorization", "value": "Bearer token123"},
349
{"name": "X-Custom-Header", "value": "custom-value"}
350
]
351
```
352
353
### Nested Endpoint Configuration
354
355
For nested endpoints pointing to child Traffic Manager profiles:
356
357
```python
358
nested_endpoint = Endpoint(
359
target_resource_id="/subscriptions/.../providers/Microsoft.Network/trafficManagerProfiles/child-profile",
360
endpoint_status="Enabled",
361
min_child_endpoints=2, # Require at least 2 healthy children
362
min_child_endpoints_i_pv4=1, # At least 1 IPv4 endpoint
363
min_child_endpoints_i_pv6=0, # No IPv6 requirement
364
endpoint_location="Global" # For performance routing
365
)
366
```