0
# Profile Management
1
2
Complete lifecycle management of Traffic Manager profiles including creation, configuration, updating, deletion, and listing operations. Profiles define the overall traffic routing strategy, DNS configuration, and health monitoring settings for your traffic management solution.
3
4
## Capabilities
5
6
### Create or Update Profile
7
8
Creates a new Traffic Manager profile or updates an existing one with complete configuration including routing method, DNS settings, monitoring, and endpoints.
9
10
```python { .api }
11
def create_or_update(
12
resource_group_name: str,
13
profile_name: str,
14
parameters: Union[Profile, IO]
15
) -> Profile:
16
"""
17
Creates or updates a Traffic Manager profile.
18
19
Args:
20
resource_group_name (str): Name of the resource group
21
profile_name (str): Name of the Traffic Manager profile
22
parameters (Profile): Profile configuration
23
24
Returns:
25
Profile: The created or updated profile
26
"""
27
```
28
29
**Usage Example:**
30
31
```python
32
from azure.mgmt.trafficmanager.models import Profile, DnsConfig, MonitorConfig
33
34
profile_config = Profile(
35
location="global",
36
tags={"environment": "production", "team": "platform"},
37
profile_status="Enabled",
38
traffic_routing_method="Performance",
39
dns_config=DnsConfig(
40
relative_name="my-app-tm",
41
ttl=60
42
),
43
monitor_config=MonitorConfig(
44
protocol="HTTPS",
45
port=443,
46
path="/health",
47
interval_in_seconds=30,
48
timeout_in_seconds=10,
49
tolerated_number_of_failures=3,
50
custom_headers=[
51
{"name": "Authorization", "value": "Bearer token"},
52
{"name": "User-Agent", "value": "TrafficManager/1.0"}
53
],
54
expected_status_code_ranges=[
55
{"min": 200, "max": 299}
56
]
57
),
58
traffic_view_enrollment_status="Enabled",
59
allowed_endpoint_record_types=["DomainName", "IPv4Address"],
60
max_return=8 # For MultiValue routing
61
)
62
63
profile = client.profiles.create_or_update(
64
resource_group_name="my-rg",
65
profile_name="my-app-profile",
66
parameters=profile_config
67
)
68
```
69
70
### Get Profile
71
72
Retrieves a specific Traffic Manager profile with complete configuration details and current status.
73
74
```python { .api }
75
def get(resource_group_name: str, profile_name: str) -> Profile:
76
"""
77
Gets a Traffic Manager profile.
78
79
Args:
80
resource_group_name (str): Name of the resource group
81
profile_name (str): Name of the Traffic Manager profile
82
83
Returns:
84
Profile: The Traffic Manager profile
85
"""
86
```
87
88
### Update Profile
89
90
Updates an existing Traffic Manager profile with partial configuration changes while preserving unchanged settings.
91
92
```python { .api }
93
def update(
94
resource_group_name: str,
95
profile_name: str,
96
parameters: Union[Profile, IO]
97
) -> Profile:
98
"""
99
Updates a Traffic Manager profile.
100
101
Args:
102
resource_group_name (str): Name of the resource group
103
profile_name (str): Name of the Traffic Manager profile
104
parameters (Profile): Updated profile configuration
105
106
Returns:
107
Profile: The updated profile
108
"""
109
```
110
111
### Delete Profile
112
113
Deletes a Traffic Manager profile and all its associated endpoints permanently.
114
115
```python { .api }
116
def delete(
117
resource_group_name: str,
118
profile_name: str
119
) -> Optional[DeleteOperationResult]:
120
"""
121
Deletes a Traffic Manager profile.
122
123
Args:
124
resource_group_name (str): Name of the resource group
125
profile_name (str): Name of the Traffic Manager profile
126
127
Returns:
128
Optional[DeleteOperationResult]: Operation result or None
129
"""
130
```
131
132
### List Profiles by Resource Group
133
134
Lists all Traffic Manager profiles within a specific resource group with pagination support.
135
136
```python { .api }
137
def list_by_resource_group(resource_group_name: str) -> Iterable[Profile]:
138
"""
139
Lists all profiles in a resource group.
140
141
Args:
142
resource_group_name (str): Name of the resource group
143
144
Returns:
145
Iterable[Profile]: Paginated collection of profiles
146
"""
147
```
148
149
**Usage Example:**
150
151
```python
152
# List and filter profiles
153
profiles = list(client.profiles.list_by_resource_group("my-rg"))
154
enabled_profiles = [p for p in profiles if p.profile_status == "Enabled"]
155
156
for profile in enabled_profiles:
157
print(f"Profile: {profile.name}")
158
print(f" FQDN: {profile.dns_config.fqdn}")
159
print(f" Routing: {profile.traffic_routing_method}")
160
print(f" Endpoints: {len(profile.endpoints or [])}")
161
```
162
163
### List Profiles by Subscription
164
165
Lists all Traffic Manager profiles within the subscription across all resource groups with pagination support.
166
167
```python { .api }
168
def list_by_subscription() -> Iterable[Profile]:
169
"""
170
Lists all profiles in the subscription.
171
172
Returns:
173
Iterable[Profile]: Paginated collection of profiles
174
"""
175
```
176
177
### Check DNS Name Availability
178
179
Checks if a Traffic Manager relative DNS name is available for use in profile creation.
180
181
```python { .api }
182
def check_traffic_manager_relative_dns_name_availability(
183
parameters: Union[CheckTrafficManagerRelativeDnsNameAvailabilityParameters, IO]
184
) -> TrafficManagerNameAvailability:
185
"""
186
Checks DNS name availability.
187
188
Args:
189
parameters: Name availability check parameters
190
191
Returns:
192
TrafficManagerNameAvailability: Availability result
193
"""
194
```
195
196
### Check DNS Name Availability V2
197
198
Enhanced version of DNS name availability check with improved validation and subscription context.
199
200
```python { .api }
201
def check_traffic_manager_name_availability_v2(
202
parameters: Union[CheckTrafficManagerRelativeDnsNameAvailabilityParameters, IO]
203
) -> TrafficManagerNameAvailability:
204
"""
205
Checks DNS name availability (V2).
206
207
Args:
208
parameters: Name availability check parameters
209
210
Returns:
211
TrafficManagerNameAvailability: Availability result
212
"""
213
```
214
215
**Usage Example:**
216
217
```python
218
from azure.mgmt.trafficmanager.models import CheckTrafficManagerRelativeDnsNameAvailabilityParameters
219
220
# Check name availability before creating profile
221
check_params = CheckTrafficManagerRelativeDnsNameAvailabilityParameters(
222
name="my-new-app-tm",
223
type="Microsoft.Network/trafficManagerProfiles"
224
)
225
226
availability = client.profiles.check_traffic_manager_name_availability_v2(check_params)
227
228
if availability.name_available:
229
print("Name is available")
230
else:
231
print(f"Name unavailable: {availability.reason} - {availability.message}")
232
```
233
234
## Profile Configuration Types
235
236
### Traffic Routing Methods
237
238
```python { .api }
239
class TrafficRoutingMethod(str, Enum):
240
"""Traffic routing algorithms for load balancing."""
241
PERFORMANCE = "Performance" # Route to closest endpoint
242
PRIORITY = "Priority" # Failover routing
243
WEIGHTED = "Weighted" # Distribute by weight
244
GEOGRAPHIC = "Geographic" # Route by user location
245
MULTI_VALUE = "MultiValue" # Return multiple healthy endpoints
246
SUBNET = "Subnet" # Route by source IP subnet
247
```
248
249
### DNS Configuration
250
251
```python { .api }
252
class DnsConfig:
253
"""DNS configuration for Traffic Manager profiles."""
254
relative_name: str # DNS name (e.g., "my-app")
255
fqdn: str # Full DNS name (read-only, e.g., "my-app.trafficmanager.net")
256
ttl: int # DNS Time-To-Live in seconds (1-2147483647)
257
```
258
259
### Monitor Configuration
260
261
```python { .api }
262
class MonitorConfig:
263
"""Health monitoring configuration for endpoints."""
264
profile_monitor_status: ProfileMonitorStatus # Overall status
265
protocol: MonitorProtocol # HTTP, HTTPS, or TCP
266
port: int # Port number (1-65535)
267
path: str # Path for HTTP(S) checks
268
interval_in_seconds: int # Check interval (30 or 10)
269
timeout_in_seconds: int # Check timeout (5-10)
270
tolerated_number_of_failures: int # Allowed failures (0-9)
271
custom_headers: List[MonitorConfigCustomHeadersItem] # Custom HTTP headers
272
expected_status_code_ranges: List[MonitorConfigExpectedStatusCodeRangesItem] # Expected status codes
273
274
class MonitorConfigCustomHeadersItem:
275
"""Custom header for health checks."""
276
name: str # Header name
277
value: str # Header value
278
279
class MonitorConfigExpectedStatusCodeRangesItem:
280
"""Expected HTTP status code range."""
281
min: int # Minimum status code
282
max: int # Maximum status code
283
```
284
285
### Profile Status Types
286
287
```python { .api }
288
class ProfileStatus(str, Enum):
289
"""Profile operational status."""
290
ENABLED = "Enabled" # Profile is active
291
DISABLED = "Disabled" # Profile is inactive
292
293
class ProfileMonitorStatus(str, Enum):
294
"""Profile health monitoring status."""
295
CHECKING_ENDPOINTS = "CheckingEndpoints" # Checking endpoint health
296
ONLINE = "Online" # All endpoints healthy
297
DEGRADED = "Degraded" # Some endpoints unhealthy
298
DISABLED = "Disabled" # Monitoring disabled
299
INACTIVE = "Inactive" # Profile inactive
300
301
class TrafficViewEnrollmentStatus(str, Enum):
302
"""Traffic View feature enrollment status."""
303
ENABLED = "Enabled" # Traffic View enabled
304
DISABLED = "Disabled" # Traffic View disabled
305
```
306
307
## Utility Types
308
309
```python { .api }
310
class CheckTrafficManagerRelativeDnsNameAvailabilityParameters:
311
"""Parameters for DNS name availability check."""
312
name: str # Relative name to check
313
type: str # Resource type
314
315
class TrafficManagerNameAvailability:
316
"""DNS name availability response."""
317
name: str # Relative name checked
318
type: str # Resource type
319
name_available: bool # Whether name is available
320
reason: str # Reason if unavailable
321
message: str # Descriptive message
322
323
class DeleteOperationResult:
324
"""Result of delete operations."""
325
operation_result: bool # Success status (read-only)
326
```