共用方式為


New-AzAutoscaleSetting

建立或更新自動調整設定。

語法

New-AzAutoscaleSetting
   -InputObject <IAutoscaleIdentity>
   -Parameter <IAutoscaleSettingResource>
   [-DefaultProfile <PSObject>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzAutoscaleSetting
   -Name <String>
   -ResourceGroupName <String>
   [-SubscriptionId <String>]
   -Location <String>
   -Profile <IAutoscaleProfile[]>
   [-Enabled]
   [-Notification <IAutoscaleNotification[]>]
   [-PredictiveAutoscalePolicyScaleLookAheadTime <TimeSpan>]
   [-PredictiveAutoscalePolicyScaleMode <PredictiveAutoscalePolicyScaleMode>]
   [-PropertiesName <String>]
   [-Tag <Hashtable>]
   [-TargetResourceLocation <String>]
   [-TargetResourceUri <String>]
   [-DefaultProfile <PSObject>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

建立或更新自動調整設定。

範例

範例 1:建立 vms 的自動調整設定

$subscriptionId = (Get-AzContext).Subscription.Id
$rule1=New-AzAutoscaleScaleRuleObject -MetricTriggerMetricName "Percentage CPU" -MetricTriggerMetricResourceUri "/subscriptions/$subscriptionId/resourceGroups/test-group/providers/Microsoft.Compute/virtualMachineScaleSets/test-vmss" -MetricTriggerTimeGrain ([System.TimeSpan]::New(0,1,0)) -MetricTriggerStatistic "Average" -MetricTriggerTimeWindow ([System.TimeSpan]::New(0,5,0)) -MetricTriggerTimeAggregation "Average" -MetricTriggerOperator "GreaterThan" -MetricTriggerThreshold 10 -MetricTriggerDividePerInstance $false -ScaleActionDirection "Increase" -ScaleActionType "ChangeCount" -ScaleActionValue 1 -ScaleActionCooldown ([System.TimeSpan]::New(0,5,0))
$profile1=New-AzAutoscaleProfileObject -Name "adios" -CapacityDefault 1 -CapacityMaximum 10 -CapacityMinimum 1 -Rule $rule1 -FixedDateEnd ([System.DateTime]::Parse("2022-12-31T14:00:00Z")) -FixedDateStart ([System.DateTime]::Parse("2022-12-31T13:00:00Z")) -FixedDateTimeZone "UTC"
$webhook1=New-AzAutoscaleWebhookNotificationObject -Property @{} -ServiceUri "http://myservice.com"
$notification1=New-AzAutoscaleNotificationObject -EmailCustomEmail "gu@ms.com" -EmailSendToSubscriptionAdministrator $true -EmailSendToSubscriptionCoAdministrator $true -Webhook $webhook1
New-AzAutoscaleSetting -Name test-autoscalesetting -ResourceGroupName test-group -Location westeurope -Profile $profile1 -Enabled -Notification $notification1 -PredictiveAutoscalePolicyScaleLookAheadTime ([System.TimeSpan]::New(0,5,0)) -PredictiveAutoscalePolicyScaleMode 'Enabled' -PropertiesName "test-autoscalesetting" -TargetResourceUri "/subscriptions/$subscriptionId/resourceGroups/test-group/providers/Microsoft.Compute/virtualMachineScaleSets/test-vmss"

建立 vmss 的自動調整設定

參數

-Confirm

執行 Cmdlet 之前先提示您確認。

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

-DefaultProfile

DefaultProfile 參數無法運作。 如果針對不同的訂用帳戶執行 Cmdlet,請使用 SubscriptionId 參數。

類型:PSObject
別名:AzureRMContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Enabled

已啟用的旗標。 指定是否為資源啟用自動調整。 默認值為 『false』。

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

-InputObject

Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

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

-Location

資源位置

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

-Name

自動調整設定名稱。

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

-Notification

通知的集合。 若要建構,請參閱 NOTIFICATION 屬性的 NOTES 一節,並建立哈希表。

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

-Parameter

自動調整設定資源。 若要建構,請參閱PARAMETER屬性和建立哈希表的NOTES一節。

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

-PredictiveAutoscalePolicyScaleLookAheadTime

指定要事先啟動實例的時間量。 它必須是 ISO 8601 格式的 1 分鐘到 60 分鐘。

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

-PredictiveAutoscalePolicyScaleMode

預測性自動調整模式

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

-Profile

自動調整配置檔的集合,這些配置檔會針對不同的時間週期指定不同的縮放參數。 最多可以指定20個配置檔。 若要建構,請參閱 PROFILE 屬性的 NOTES 區段並建立哈希表。

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

-PropertiesName

自動調整設定的名稱。

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

-ResourceGroupName

資源群組的名稱。 名稱不區分大小寫。

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

-SubscriptionId

目標訂用帳戶的標識碼。

類型:String
Position:Named
預設值:(Get-AzContext).Subscription.Id
必要:False
接受管線輸入:False
接受萬用字元:False

-Tag

取得或設定用以描述資源的索引鍵/值組清單。 這些標籤可用於檢視和群組此資源(跨資源群組)。 最多可為資源提供 15 個標籤。 每個標記的長度必須不超過 128 個字元,且長度不超過 256 個字元的值。

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

-TargetResourceLocation

應新增自動調整設定的資源位置。

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

-TargetResourceUri

應加入自動調整設定之資源的資源標識碼。

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

-WhatIf

顯示執行 Cmdlet 後會發生的情況。 未執行 Cmdlet。

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

輸入

IAutoscaleSettingResource

IAutoscaleIdentity

輸出

IAutoscaleSettingResource