Azure Traffic Manager可以与API管理一起使用吗?

时间:2015-02-11 16:29:52

标签: azure

当我向Traffic Manager添加端点时,只有网站和云服务可供选择。我可以将API管理服务与流量管理器结合使用吗?

1 个答案:

答案 0 :(得分:3)

是的,除Azure网站和Azure云服务之外,还可以将外部端点添加到Azure Traffic Manager配置文件中。您需要使用Azure PowerShell模块来设置自定义端点。

  1. 安装Azure PowerShell模块:https://github.com/azure/azure-powershell/releases
  2. 运行以下脚本(将$Username变量替换为您自己的帐户名称)
  3. https://azure.microsoft.com/en-us/documentation/articles/traffic-manager-overview/

    ### Authenticate to Azure from PowerShell
    $Username = 'posh@trevorsullivan.net';
    $AzureCredential = Get-Credential -Credential $Username;
    Add-AzureAccount -Credential $AzureCredential;
    
    ### Select the appropriate Azure subscription, if you have multiple
    Select-AzureSubscription -SubscriptionName 'Visual Studio Ultimate with MSDN';
    
    ### Retrieve the Traffic Manager profile (if already created)
    $TrafficManagerProfile = Get-AzureTrafficManagerProfile -Name trevor;
    
    ### Add custom endpoints to the Traffic Manager Profile
    Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $TrafficManagerProfile -DomainName www.microsoft.com -Type Any -Status Enabled;
    Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $TrafficManagerProfile -DomainName trevorsullivan.net -Type Any -Status Enabled;
    
    ### Commit the changes to your Azure Traffic Manager Profile
    Set-AzureTrafficManagerProfile -TrafficManagerProfile $TrafficManagerProfile;
    

    它与上面的代码完全匹配,但这里是我的“流量管理器”个人资料命名为" Trevor"看起来像它的两个端点。

    Traffic Manager Profile