info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



Powershell - Azure Traffic Manager Enable and Disable Endpoints
by BF (Principal Consultant; Architecture; Engineering)
2016-05-31







Solution:


Powershell:


Authenticate to Azure Portal:

Login-AzureRmAccount


Set the tenant, subscription & environment for cmdlets to use in the current session:

Set-AzureRmContext -SubscriptionName "InsertSubscriptionNameHere"
#Get-AzureRmSubscription -SubscriptionName "InsertSubscriptionNameHere"
#Select-AzureRmSubscription -SubscriptionName "InsertSubscriptionNameHere"


View Get-AzureRmTrafficManagerProfile:

Get-AzureRmTrafficManagerProfile -ResourceGroupName InsertResourceGroupNameHere -Name InsertTrafficManagerProfileNameHere


Store Traffic Manager Profile in a variable:
$profiles = Get-AzureRmTrafficManagerProfile -ResourceGroupName InsertResourceGroupNameHere -Name InsertTrafficManagerProfileNameHere


View Traffic Manager Endpoints status:

$profiles.Endpoints | Format-Table

$profiles.Endpoints[0].EndpointStatus

$profiles.Endpoints[1].EndpointStatus


To Disable an EndPoint:

$profiles.Endpoints[0].EndpointStatus = "Disabled"

Set-AzureRMTrafficManagerProfile –TrafficManagerProfile $profiles


To Enable an EndPoint:

$profiles.Endpoints[0].EndpointStatus = "Enabled"

Set-AzureRMTrafficManagerProfile –TrafficManagerProfile $profiles



Resources:

Microsoft Azure

Azure Traffic Manager Cmdlets

Azure Traffic Manager External Endpoints and Weighted Round Robin via PowerShell