0

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?

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Amruta
  • 701
  • 4
  • 15
  • 38

1 Answers1

2

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

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • I tried executing this command : Test-AzureTrafficManagerDomainName -DomainName "tmgr.trafficmanager.net"....but getting error as Test-AzureTrafficManagerDomainName : No default subscription has been designated. Use Select-AzureSubscription -Default to set the default subscription.....How to resolve this.. – Amruta May 24 '17 at 11:03
  • that is a completely different question, i would suggest you accept this answer as a valid one and look for your error. but i would suggest you do what the error text is saying @Amruta – 4c74356b41 May 24 '17 at 11:04
  • this is the answer to your question, like it or not, the issue you are having is you are either not logged in or need to set default subscription, it all says it in the error, you try to read. and being offended like that doesn't make any sense. I don't owe you anything whatsoever, yet I'm answering your question. – 4c74356b41 May 24 '17 at 13:30
  • `Test-AzureTrafficManagerDomainName` is the right answer. – Jason Ye May 25 '17 at 06:10
  • Yes this command Test-AzureTrafficManagerDomainName gives right answer. But still could not use it, as it is an Azure Service Manager commandlet. Is there any Azure Resource Manager commandlet available for this? – Amruta May 25 '17 at 06:33
  • no, but you could just query the endpoint - https://learn.microsoft.com/en-us/rest/api/trafficmanager/profiles#Profiles_CheckTrafficManagerRelativeDnsNameAvailability @Amruta – 4c74356b41 May 25 '17 at 07:35
  • Using the [above endpoint](https://learn.microsoft.com/en-us/rest/api/trafficmanager/profiles#Profiles_CheckTrafficManagerRelativeDnsNameAvailability) (check Traffic Manager Name Availability V2) returns false for every name I provide. – zz3star90 Jul 03 '23 at 13:41