共用方式為


New-AzureTrafficManagerProfile

建立流量管理員設定檔。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

New-AzureTrafficManagerProfile
   -Name <String>
   -DomainName <String>
   -LoadBalancingMethod <String>
   -MonitorPort <Int32>
   -MonitorProtocol <String>
   -MonitorRelativePath <String>
   -Ttl <Int32>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

New-AzureTrafficManagerProfile Cmdlet 會建立 Microsoft Azure 流量管理員 配置檔。

在您建立配置檔並將 LoadBalancingMethod 值設定為 “Failover”之後,您可以使用 Add-AzureTrafficManagerEndpoint Cmdlet 來判斷新增至配置檔的端點故障轉移順序。 如需詳細資訊,請參閱下面的範例 2。

範例

範例 1:建立 流量管理員 配置檔

PS C:\>New-AzureTrafficManagerProfile -Name "MyProfile" -DomainName "My.profile.trafficmanager.net" -LoadBalancingMethod "RoundRobin" -Ttl 30 -MonitorProtocol "Http" -MonitorPort 80 -MonitorRelativePath "/"

此命令會在指定的 流量管理員 網域中,使用迴圈配置資源負載平衡方法、TTL 30 秒、HTTP 監視通訊協定、監視埠 80 以及指定路徑,在指定的 流量管理員 網域中建立名為 MyProfile 的 流量管理員 配置檔。

範例 2:將端點重新排序為所需的故障轉移順序

PS C:\>$Profile = Get-AzureTrafficManagerProfile -Name "MyProfile"
PS C:\> $Profile.Endpoints[0],$Profile.Endpoints[1] = $Profile.Endpoints[1],$Profile.Endpoints[0]
PS C:\> $Profile = Set-AzureTrafficManagerProfile

此範例會將新增至 MyProfile 的端點重新排序至所需的故障轉移順序。

第一個命令會取得名為 MyProfile 的 流量管理員 配置檔物件,並將物件儲存在$Profile變數中。

第二個命令會將端點從端點陣列重新排序至應該發生故障轉移的順序。

最後一個命令會使用新的端點順序,更新儲存在 $Profile 中的 流量管理員 配置檔。

參數

-DomainName

指定 流量管理員 設定檔的功能變數名稱。 這必須是 trafficmanager.net 的子域。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-LoadBalancingMethod

指定要用來散發連線的負載平衡方法。 有效值為:

  • 效能
  • 容錯移轉
  • RoundRobin
類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-MonitorPort

指定用來監視端點健全狀況的埠。 有效值為大於 0 且小於或等於 65,535 的整數值。

類型:Int32
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-MonitorProtocol

指定用來監視端點健康情況的通訊協定。 有效值為:

  • Http

  • Https

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-MonitorRelativePath

指定要探查健康狀態之端點功能變數名稱的相對路徑。 路徑必須符合下列限制:

  • 路徑必須介於 1 到 1000 個字元之間。

  • 其開頭必須是正斜線 /。

  • 它不得包含任何 XML 元素。 <>

  • 它不得包含雙斜線 /。

  • 它不能包含無效的 HTML 逸出字元。 例如,%XY。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Name

指定要建立 流量管理員 設定檔的名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Ttl

指定 DNS 存留時間(TTL),告知本機 DNS 解析程式快取 DNS 項目的時間長度。 有效值為從 30 到 999,999 的整數。

類型:Int32
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

輸出

Microsoft.WindowsAzure.Commands.Utilities.TrafficManager.Models.IProfileWithDefinition

此 Cmdlet 會產生 流量管理員 設定檔物件。