編集

次の方法で共有


New-AzAutoscaleSetting

Creates or updates an autoscale setting.

Syntax

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

Creates or updates an autoscale setting.

Examples

Example 1: Create autoscale setting for vmss

$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"

Create autoscale setting for vmss

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Enabled

the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'false'.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

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

Type:IAutoscaleIdentity
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Location

Resource location

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

The autoscale setting name.

Type:String
Aliases:AutoscaleSettingName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Notification

the collection of notifications. To construct, see NOTES section for NOTIFICATION properties and create a hash table.

Type:IAutoscaleNotification[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Parameter

The autoscale setting resource. To construct, see NOTES section for PARAMETER properties and create a hash table.

Type:IAutoscaleSettingResource
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PredictiveAutoscalePolicyScaleLookAheadTime

the amount of time to specify by which instances are launched in advance. It must be between 1 minute and 60 minutes in ISO 8601 format.

Type:TimeSpan
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PredictiveAutoscalePolicyScaleMode

the predictive autoscale mode

Type:PredictiveAutoscalePolicyScaleMode
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Profile

the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. To construct, see NOTES section for PROFILE properties and create a hash table.

Type:IAutoscaleProfile[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PropertiesName

the name of the autoscale setting.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group. The name is case insensitive.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TargetResourceLocation

the location of the resource that the autoscale setting should be added to.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TargetResourceUri

the resource identifier of the resource that the autoscale setting should be added to.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

IAutoscaleSettingResource

IAutoscaleIdentity

Outputs

IAutoscaleSettingResource