Search code examples
azureazure-powershellazure-traffic-manager

How to check if Traffic Manager exists globally


I want to check whether a traffic manager is unique or not. I am using Powershell Commandlets to get the information.

$profile = Get-AzureRmTrafficManagerProfile -Name $ResourceName -ResourceGroupName $ResourceGroupName

This command only checks for the traffic manager profile in the specified group. But traffic manager's are deployed globally. So, when I try to deploy with same traffic manager name in different resource group then error is thrown.

To avoid this error, I want to check at first only if that traffic manager exists globally. Didn't find any solution in documentation.

Is there any way to achieve this?


Solution

  • You can use the Test-AzureTrafficManagerDomainName powershell cmdlet.

    C:\> get-help Test-AzureTrafficManagerDomainName
    
    NAME
        Test-AzureTrafficManagerDomainName
    
    SYNOPSIS
        Checks whether a domain name is available as a Traffic Manager profile.
    
    
    SYNTAX
        Test-AzureTrafficManagerDomainName [-DomainName] <String> [<CommonParameters>]
    
    
    DESCRIPTION
        The Test-AzureTrafficManagerDomainName cmdlet checks whether a domain name is available as a Microsoft Azure
        Traffic Manager profile. If the domain name is available, this cmdlet returns a value of $True.
    

    Or you could use a rest call to this endpoint:
    https://management.core.windows.net/SUB_GUID/services/WATM/operations/isavailable/%NAME%.trafficmanager.net