如何检查流量管理器是否全局存在

How to check if Traffic Manager exists globally

我想检查流量管理器是否唯一。 我正在使用 Powershell Commandlets 来获取信息。

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

此命令仅检查指定组中的流量管理器配置文件。但是流量管理器是全球部署的。因此,当我尝试在不同的资源组中使用相同的流量管理器名称进行部署时,会抛出错误。

为了避免这个错误,我只想首先检查该流量管理器是否存在于全球范围内。在文档中未找到任何解决方案。

有什么办法可以实现吗?

您可以使用 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.

或者您可以对这个端点使用 rest 调用:
https://management.core.windows.net/SUB_GUID/services/WATM/operations/isavailable/%NAME%.trafficmanager.net