To add an endpoint to an existing Traffic Manager profile, you need to first retrieve the profile and store it within a variable by running the following cmdlet:
$profile = Get-AzureRmTrafficManagerProfile -Name PacktProfile -ResourceGroupName PacktPub
Then, you need to retrieve the resource you want to distribute the traffic across. For example, a public IP address assigned to a Load Balancer. You can do so by running the following cmdlet:
$PIP = Get-AzureRmPublicIpAddress -Name "PIP" -ResourceGroupName PacktPub
Now, you can add the endpoint by running the following cmdlet:
Add-AzureRmTrafficManagerEndpointConfig -EndpointName LB1 -TrafficManagerProfile $profile -Type AzureEndpoints -TargetResourceId $pip.Id -EndpointStatus Enabled
Finally, do not forget to save that by running the following cmdlet:
Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile