включить автоматическое масштабирование с помощью powershell в облаке Azure - PullRequest
0 голосов
/ 28 июня 2019

у меня есть сценарий powershell, который должен создавать и автоматически масштабировать правило и включать его в конкретном плане обслуживания приложения

$myRuleScaleOut = New-AzureRmAutoscaleRule -MetricName "Percentage CPU" -MetricResourceId "/subscriptions/$sub/resourceGroups/$RG/providers/Microsoft.Web/serverFarms/$FARM/webHostingPlan" -TimeGrain 00:01:00 -MetricStatistic "Average" -TimeWindow 00:05:00 -Operator "GreaterThan" -Threshold 70 -ScaleActionDirection "Increase" –ScaleActionScaleType "ChangeCount" -ScaleActionValue 3 -ScaleActionCooldown 00:05:00 

$myRuleScaleIn = New-AzureRmAutoscaleRule -MetricName "Percentage CPU" -MetricResourceId "/subscriptions/$sub/resourceGroups/$RG/providers/Microsoft.Web/serverFarms/$FARM/webHostingPlan" -Operator "LessThan" -MetricStatistic "Average" -Threshold 30 -TimeGrain 00:01:00 -TimeWindow 00:05:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection "Decrease" –ScaleActionScaleType "ChangeCount" -ScaleActionValue 1

$myScaleProfile = New-AzureRmAutoscaleProfile -DefaultCapacity 2 -MaximumCapacity 10 -MinimumCapacity 2 -Rule $myRuleScaleOut,$myRuleScaleIn -Name "autoprofile" 

$myLocation = "North Europe"

Add-AzureRmAutoscaleSetting -Location "North Europe" -Name "autosetting123" -ResourceGroup $RG -TargetResourceId "/subscriptions/$sub/resourceGroups/$RG/providers/Microsoft.Web/serverFarms/$FArm/webHostingPlan" -AutoscaleProfile $myScaleProfile 

но возвращает эту ошибку:

WARNING: 10:14:31 AM - *** The namespace for all the model classes will change from Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases.
WARNING: 10:14:31 AM - *** The namespace for output classes will be uniform for all classes in future releases to make it independent of modifications in the model classes.
Add-AzureRmAutoscaleSetting : Exception type: ErrorResponseException, Message: Null/Empty, Code: Not Found, Status code:NotFound, Reason phrase: Not Found
At line:1 char:1
+ Add-AzureRmAutoscaleSetting -Location $myLocation -Name test -Resourc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzAutoscaleSetting], PSInvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.Autoscale.AddAzureRmAutoscaleSettingCommand
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...