Managing Traffic Managers
- With Azure PowerShell you can get certain functionality currently unavailable on Azure Portal, like:
- Reconfigure all Traffic Manager's endpoints at once
- Address other services via Azure ResourceId instead of domain name, so you don't need to set Location manually for Azure Endpoints
Prerequisites
- To start you need to login and select RM subscription.
Get TrafficManager profile
- Operations with Traffic Managers via PowerShell are done in three steps:
- Get TM profile:
- Explore and modify TM profile
- Check $profile fields and $profile.Endpoints to see each endpoint's configuration.
- Save changes via Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile.
Change endpoints
- All current endpoints are stored in $profile.Endpoints list, so you can alter them directly by index
- or by name
- To clear all endpoints use
- To delete particular endpoint use
- To add new endpoint use
- As you can see, in the last case we've addressed our azure service via ResourceId rather than domain name.
Keep in mind
- Your changes to TM and it's endpoints are not applied until you'll invoke Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile. That allows you to fully reconfigure TM in one operation.
Traffic Manager is an implementation of DNS and IP address given to clients has some time to live (aka TTL, you can see it's duration in seconds in the $profile.Ttl field). So, after you've reconfigured TM some clients will continue to use old endpoints they cached until that TTL expire.