你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
New-AzAutoscaleProfile
创建自动缩放配置文件。
语法
New-AzAutoscaleProfile
-Name <String>
-DefaultCapacity <String>
-MaximumCapacity <String>
-MinimumCapacity <String>
-Rule <System.Collections.Generic.List`1[Microsoft.Azure.Management.Monitor.Management.Models.ScaleRule]>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzAutoscaleProfile
-Name <String>
-DefaultCapacity <String>
-MaximumCapacity <String>
-MinimumCapacity <String>
-StartTimeWindow <DateTime>
-EndTimeWindow <DateTime>
-TimeWindowTimeZone <String>
-Rule <System.Collections.Generic.List`1[Microsoft.Azure.Management.Monitor.Management.Models.ScaleRule]>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzAutoscaleProfile
-Name <String>
-DefaultCapacity <String>
-MaximumCapacity <String>
-MinimumCapacity <String>
-RecurrenceFrequency <RecurrenceFrequency>
-ScheduleDay <System.Collections.Generic.List`1[System.String]>
-ScheduleHour <System.Collections.Generic.List`1[System.Nullable`1[System.Int32]]>
-ScheduleMinute <System.Collections.Generic.List`1[System.Nullable`1[System.Int32]]>
-ScheduleTimeZone <String>
-Rule <System.Collections.Generic.List`1[Microsoft.Azure.Management.Monitor.Management.Models.ScaleRule]>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
New-AzAutoscaleProfile cmdlet 创建自动缩放配置文件。
示例
示例 1:使用固定日期创建单个配置文件
PS C:\>$Rule = New-AzAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "1"
PS C:\> $Profile = New-AzAutoscaleProfile -DefaultCapacity "1" -MaximumCapacity "10" -MinimumCapacity "1" -StartTimeWindow 2015-03-05T14:00:00 -EndTimeWindow 2015-03-05T14:30:00 -TimeWindowTimeZone GMT -Rule $Rule -Name "Profile01"
Capacity : Microsoft.Azure.Management.Insights.Models.ScaleCapacity
FixedDate : Microsoft.Azure.Management.Insights.Models.TimeWindow
Name : adios
Recurrence :
Rules : {Microsoft.Azure.Management.Insights.Models.ScaleRule,
Microsoft.Azure.Management.Insights.Models.ScaleRule}
第一个命令创建名为 Requests 的自动缩放规则,然后将其存储在$Rule变量中。 第二个命令使用$Rule中的规则创建名为 Profile01 的配置文件,其中包含固定日期。
示例 2:使用计划创建配置文件
PS C:\>$Rule = New-AzAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "1"
PS C:\> $Profile = New-AzAutoscaleProfile -DefaultCapacity "1" -MaximumCapacity "10" -MinimumCapacity "1" -Rule $Rule -Name "SecondProfileName" -RecurrenceFrequency Minute -ScheduleDay "1", "2", "3" -ScheduleHour 5, 10, 15 -ScheduleMinute 15, 30, 45 -ScheduleTimeZone GMT
Capacity : Microsoft.Azure.Management.Insights.Models.ScaleCapacity
FixedDate :
Name : secondProfileName
Recurrence : Microsoft.Azure.Management.Insights.Models.Recurrence
Rules : {Microsoft.Azure.Management.Insights.Models.ScaleRule,
Microsoft.Azure.Management.Insights.Models.ScaleRule}
第一个命令创建名为 Requests 的自动缩放规则,然后将其存储在$Rule变量中。 第二个命令使用$Rule中的规则创建名为 SecondProfileName 的配置文件,其中包含定期计划。
示例 3:使用两个规则创建配置文件
PS C:\>$Rule1 = New-AzAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "1"
PS C:\> $Rule2 = New-AzAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:10:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "2"
PS C:\> $Profile1 = New-AzAutoscaleProfile -DefaultCapacity "1" -MaximumCapacity "10" -MinimumCapacity "1" -StartTimeWindow 2015-03-05T14:00:00 -EndTimeWindow 2015-03-05T14:30:00 -TimeWindowTimeZone GMT -Rule $Rule1, $Rule2 -Name "ProfileName"
PS C:\> $Profile2 = New-AzAutoscaleProfile -DefaultCapacity "1" -MaximumCapacity "10" -MinimumCapacity "1" -Rule $Rule1, $Rule2 -Name "SecondProfileName" -RecurrenceFrequency Week -ScheduleDay "1" -ScheduleHour 5 -ScheduleMinute 15 -ScheduleTimeZone UTC
Capacity : Microsoft.Azure.Management.Insights.Models.ScaleCapacity
FixedDate : Microsoft.Azure.Management.Insights.Models.TimeWindow
Name : profileName
Recurrence :
Rules : {Microsoft.Azure.Management.Insights.Models.ScaleRule,
Microsoft.Azure.Management.Insights.Models.ScaleRule}
Capacity : Microsoft.Azure.Management.Insights.Models.ScaleCapacity
FixedDate :
Name : secondProfileName
Recurrence : Microsoft.Azure.Management.Insights.Models.Recurrence
Rules : {Microsoft.Azure.Management.Insights.Models.ScaleRule,
Microsoft.Azure.Management.Insights.Models.ScaleRule}
前两个命令创建规则,并将其分别存储在变量$Rule 1 和$Rule 2 中。 第三个命令使用 Rule1 和 Rule2 中的规则创建名为 ProfileName 的配置文件,然后将其存储在 $Profile 1 变量中。 最后一个命令使用 Rule1 和 Rule2 中的规则创建名为 SecondProfileName 的配置文件,然后将其存储在 $Profile 2 变量中。
示例 4:创建没有计划或固定日期的配置文件
PS C:\>$Rule = New-AzAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "1"
PS C:\> $Profile = New-AzAutoscaleProfile -DefaultCapacity "1" -MaximumCapacity "10" -MinimumCapacity "1" -Rule $Rule -Name "ProfileName"
第一个命令创建名为 Requests 的自动缩放规则,然后将其存储在$Rule变量中。 第二个命令创建没有计划或固定日期的配置文件,然后将其存储在$Profile变量中。
参数
-DefaultCapacity
指定默认容量。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-DefaultProfile
用于与 azure 通信的凭据、帐户、租户和订阅
类型: | IAzureContextContainer |
别名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-EndTimeWindow
指定时间窗口的结束时间。
类型: | DateTime |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-MaximumCapacity
指定最大容量。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-MinimumCapacity
指定最小容量。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Name
指定要创建的配置文件的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-RecurrenceFrequency
指定重复周期的频率。 此参数的可接受值为:
- 无
- Second
- Minute
- 小时
- 日
- 周
- 月
- 年份不支持所有这些值。
类型: | RecurrenceFrequency |
接受的值: | None, Second, Minute, Hour, Day, Week, Month, Year |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Rule
-ScheduleDay
-ScheduleHour
指定计划的小时数。
类型: | List<T>[Nullable<T>[Int32]] |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ScheduleMinute
指定计划的分钟数。
类型: | List<T>[Nullable<T>[Int32]] |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ScheduleTimeZone
指定计划的时区。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-StartTimeWindow
指定时间窗口的开始。
类型: | DateTime |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-TimeWindowTimeZone
指定时间窗口的时区。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
输入
List<T>[[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
List<T>[[System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
List<T>[[Microsoft.Azure.Management.Monitor.Management.Models.ScaleRule, Microsoft.Azure.PowerShell.Cmdlets.Monitor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]