Users: 30k; Pages Per Session: 2.5p; Avg. Session Duration: 1:35mi
TechDevOps.com
Explore Tools
{Featuring Microsoft Technologies + Enterprise Data + Cloud Computing}



Powershell - Azure Traffic Manager Enable and Disable Endpoints
by BF (Senior MSSQL Operations - Enterprise, Cloud, Strategy)
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