Closed bhanuprakash-1 closed 4 months ago
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Hi @bhanuprakash-1, The reason for your issue is that a property named TargetResourceId
was missing, which exists in AutoscaleSettingData
.
You can refer to the following code snippet:
AutoscaleSettingData autoscaleSettingData = new AutoscaleSettingData(AzureLocation.WestUS2, autoscaleProfiles)
{
TargetResourceId = appServicePlan.Data.Id,
};
Additionally, there are some minor issues in your code.
MonitorScaleCapacity scaleCapacity = new MonitorScaleCapacity(minimum: 3, maximum: 30, @default: 3);
The range of values for minimum and maximum is generally 1 to 10.
monitorScaleActionScaleUp.Value = "100";
This an invalid scale action value. You should provide a scale value less than or equal to the difference between the capacity maximum and the capacity minimum. Thank you for your feedback.
Library name and version
Azure.ResourceManager.Monitor 1.3.1, Azure.ResourceManager 1.11.1, Azure.Identity 1.11.2
Describe the bug
I'm trying to create a AutoScaleSetting for my already existing App Service plan using the .NET SDKs Azure.ResourceManager.Monitor and Azure.ResourceManager. I was able to create other resources like App service, Web App etc in the same Resource group successfully. I'm using the DefaultAzureCredential() and my own identity(I'm logged into visual studio, where this code is running as a console app) and I'm also owner of the subscription and Resource group and App service plan, for which I'm trying to create the AutoScale setting.
But I'm getting exception and exception details are: the 400 error response is not clear on what exactly is the error.
Below is the error response:
My code which I'm using to configure Autoscale setting resource is:
Expected behavior
400 error response should have a clear error message. Or the exception thrown by the .NET SDK should clear out what the user error is.
Actual behavior
Added exception message and x-ms-correlation id above.
Reproduction Steps
Have added code above. Use the code to repro.
Environment
OS Windows 11, Visual studio Enterprise 2022 (64-bit), version 17.9.6