@@ -49,7 +49,7 @@ New-AzResourceGroup -Name MyRG -Location "West US"
49
49
To create a Traffic Manager profile, use the ` New-AzTrafficManagerProfile ` cmdlet:
50
50
51
51
``` powershell
52
- $profile = New-AzTrafficManagerProfile -Name MyProfile -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName contoso -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
52
+ $TmProfile = New-AzTrafficManagerProfile -Name MyProfile -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName contoso -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
53
53
```
54
54
55
55
The following table describes the parameters:
@@ -72,7 +72,7 @@ The cmdlet creates a Traffic Manager profile in Azure and returns a correspondin
72
72
To retrieve an existing Traffic Manager profile object, use the ` Get-AzTrafficManagerProfle ` cmdlet:
73
73
74
74
``` powershell
75
- $profile = Get-AzTrafficManagerProfile -Name MyProfile -ResourceGroupName MyRG
75
+ $TmProfile = Get-AzTrafficManagerProfile -Name MyProfile -ResourceGroupName MyRG
76
76
```
77
77
78
78
This cmdlet returns a Traffic Manager profile object.
@@ -90,9 +90,9 @@ All profile properties can be changed except the profile's RelativeDnsName. To c
90
90
The following example demonstrates how to change the profile's TTL:
91
91
92
92
``` powershell
93
- $profile = Get-AzTrafficManagerProfile -Name MyProfile -ResourceGroupName MyRG
94
- $profile .Ttl = 300
95
- Set-AzTrafficManagerProfile -TrafficManagerProfile $profile
93
+ $TmProfile = Get-AzTrafficManagerProfile -Name MyProfile -ResourceGroupName MyRG
94
+ $TmProfile .Ttl = 300
95
+ Set-AzTrafficManagerProfile -TrafficManagerProfile $TmProfile
96
96
```
97
97
98
98
There are three types of Traffic Manager endpoints:
@@ -125,12 +125,12 @@ In each case:
125
125
In this example, we create a Traffic Manager profile and add two App Service endpoints using the ` Add-AzTrafficManagerEndpointConfig ` cmdlet.
126
126
127
127
``` powershell
128
- $profile = New-AzTrafficManagerProfile -Name myprofile -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName myapp -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
128
+ $TmProfile = New-AzTrafficManagerProfile -Name myprofile -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName myapp -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
129
129
$webapp1 = Get-AzWebApp -Name webapp1
130
- Add-AzTrafficManagerEndpointConfig -EndpointName webapp1ep -TrafficManagerProfile $profile -Type AzureEndpoints -TargetResourceId $webapp1.Id -EndpointStatus Enabled
130
+ Add-AzTrafficManagerEndpointConfig -EndpointName webapp1ep -TrafficManagerProfile $TmProfile -Type AzureEndpoints -TargetResourceId $webapp1.Id -EndpointStatus Enabled
131
131
$webapp2 = Get-AzWebApp -Name webapp2
132
- Add-AzTrafficManagerEndpointConfig -EndpointName webapp2ep -TrafficManagerProfile $profile -Type AzureEndpoints -TargetResourceId $webapp2.Id -EndpointStatus Enabled
133
- Set-AzTrafficManagerProfile -TrafficManagerProfile $profile
132
+ Add-AzTrafficManagerEndpointConfig -EndpointName webapp2ep -TrafficManagerProfile $TmProfile -Type AzureEndpoints -TargetResourceId $webapp2.Id -EndpointStatus Enabled
133
+ Set-AzTrafficManagerProfile -TrafficManagerProfile $TmProfile
134
134
```
135
135
### Example 2: Adding a publicIpAddress endpoint using ` New-AzTrafficManagerEndpoint `
136
136
@@ -156,10 +156,10 @@ When specifying external endpoints:
156
156
In this example, we create a Traffic Manager profile, add two external endpoints, and commit the changes.
157
157
158
158
``` powershell
159
- $profile = New-AzTrafficManagerProfile -Name myprofile -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName myapp -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
160
- Add-AzTrafficManagerEndpointConfig -EndpointName eu-endpoint -TrafficManagerProfile $profile -Type ExternalEndpoints -Target app-eu.contoso.com -EndpointLocation "North Europe" -EndpointStatus Enabled
161
- Add-AzTrafficManagerEndpointConfig -EndpointName us-endpoint -TrafficManagerProfile $profile -Type ExternalEndpoints -Target app-us.contoso.com -EndpointLocation "Central US" -EndpointStatus Enabled
162
- Set-AzTrafficManagerProfile -TrafficManagerProfile $profile
159
+ $TmProfile = New-AzTrafficManagerProfile -Name myprofile -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName myapp -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
160
+ Add-AzTrafficManagerEndpointConfig -EndpointName eu-endpoint -TrafficManagerProfile $TmProfile -Type ExternalEndpoints -Target app-eu.contoso.com -EndpointLocation "North Europe" -EndpointStatus Enabled
161
+ Add-AzTrafficManagerEndpointConfig -EndpointName us-endpoint -TrafficManagerProfile $TmProfile -Type ExternalEndpoints -Target app-us.contoso.com -EndpointLocation "Central US" -EndpointStatus Enabled
162
+ Set-AzTrafficManagerProfile -TrafficManagerProfile $TmProfile
163
163
```
164
164
165
165
### Example 2: Adding external endpoints using ` New-AzTrafficManagerEndpoint `
@@ -189,7 +189,7 @@ In this example, we create new Traffic Manager child and parent profiles, add th
189
189
$child = New-AzTrafficManagerProfile -Name child -ResourceGroupName MyRG -TrafficRoutingMethod Priority -RelativeDnsName child -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
190
190
$parent = New-AzTrafficManagerProfile -Name parent -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName parent -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
191
191
Add-AzTrafficManagerEndpointConfig -EndpointName child-endpoint -TrafficManagerProfile $parent -Type NestedEndpoints -TargetResourceId $child.Id -EndpointStatus Enabled -EndpointLocation "North Europe" -MinChildEndpoints 2
192
- Set-AzTrafficManagerProfile -TrafficManagerProfile $profile
192
+ Set-AzTrafficManagerProfile -TrafficManagerProfile $parent
193
193
```
194
194
195
195
For brevity in this example, we did not add any other endpoints to the child or parent profiles.
@@ -209,7 +209,7 @@ Traffic Manager can work with endpoints from different subscriptions. You need t
209
209
210
210
``` powershell
211
211
Set-AzContext -SubscriptionId $EndpointSubscription
212
- $ip = Get-AzPublicIpAddress -Name $IpAddresName -ResourceGroupName $EndpointRG
212
+ $ip = Get-AzPublicIpAddress -Name $IpAddressName -ResourceGroupName $EndpointRG
213
213
214
214
Set-AzContext -SubscriptionId $trafficmanagerSubscription
215
215
New-AzTrafficManagerEndpoint -Name $EndpointName -ProfileName $ProfileName -ResourceGroupName $TrafficManagerRG -Type AzureEndpoints -TargetResourceId $ip.Id -EndpointStatus Enabled
@@ -227,10 +227,10 @@ There are two ways to update an existing Traffic Manager endpoint:
227
227
In this example, we modify the priority on two endpoints within an existing profile.
228
228
229
229
``` powershell
230
- $profile = Get-AzTrafficManagerProfile -Name myprofile -ResourceGroupName MyRG
231
- $profile .Endpoints[0].Priority = 2
232
- $profile .Endpoints[1].Priority = 1
233
- Set-AzTrafficManagerProfile -TrafficManagerProfile $profile
230
+ $TmProfile = Get-AzTrafficManagerProfile -Name myprofile -ResourceGroupName MyRG
231
+ $TmProfile .Endpoints[0].Priority = 2
232
+ $TmProfile .Endpoints[1].Priority = 1
233
+ Set-AzTrafficManagerProfile -TrafficManagerProfile $TmProfile
234
234
```
235
235
236
236
### Example 2: Updating an endpoint using ` Get-AzTrafficManagerEndpoint ` and ` Set-AzTrafficManagerEndpoint `
@@ -306,8 +306,8 @@ This cmdlet prompts for confirmation. This prompt can be suppressed using the '-
306
306
The profile to be deleted can also be specified using a profile object:
307
307
308
308
``` powershell
309
- $profile = Get-AzTrafficManagerProfile -Name MyProfile -ResourceGroupName MyRG
310
- Remove-AzTrafficManagerProfile -TrafficManagerProfile $profile [-Force]
309
+ $TmProfile = Get-AzTrafficManagerProfile -Name MyProfile -ResourceGroupName MyRG
310
+ Remove-AzTrafficManagerProfile -TrafficManagerProfile $TmProfile [-Force]
311
311
```
312
312
313
313
This sequence can also be piped:
0 commit comments