Skip to content

Instantly share code, notes, and snippets.

@sjwaight
Created November 2, 2014 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjwaight/f81771e365877ee1dc39 to your computer and use it in GitHub Desktop.
Save sjwaight/f81771e365877ee1dc39 to your computer and use it in GitHub Desktop.
Example of how to create a new Azure Traffic Manager instance.
# You can download this file as part of this repository: https://github.com/sjwaight/uha-azure-sample/
if($args.Count -eq 0)
{
Write-Host "ERROR: you must supply a unique traffic manager DNS prefix"
Exit 1
}
$tmDomain = "{0}.trafficmanager.net" -f $args[0]
$trafficManProfile = New-AzureTrafficManagerProfile -Name "MusicStoreFoProfile" -DomainName $tmDomain -LoadBalancingMethod Failover -Ttl 300 -MonitorProtocol Http -MonitorPort 80 -MonitorRelativePath "/"
# these hostnames will need to be updated to match your actual ones.
$trafficManProfile = Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $trafficManProfile -DomainName "dmmswaustraliaeast.cloudapp.net" -Status Enabled -Type CloudService
$trafficManProfile = Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $trafficManProfile -DomainName "dmmswaustraliasoutheast.cloudapp.net" -Status Enabled -Type CloudService
Set-AzureTrafficManagerProfile –TrafficManagerProfile $trafficManProfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment