Azure / Azure/azure-rest-api-specs
[BUG] asyncScalingEnabled changed PATCH behavior when there is capacity issues
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
### API Spec link
https://github.com/Azure/azure-rest-api-specs/blob/17842bc766fcf93b9e18c7c0294761173d7a8b17/specification/web/resource-manager/Microsoft.Web/AppService/stable/2023-01-01/AppServicePlans.json#L263
### API Spec version
2023-01-01
### Describe the bug
When `properties.asyncScalingEnabled=true` on an app service plan, and you send a PATCH for `sku.name`, a 200 is returned and the resource is unchanged when there is not enough capacity.
Previously, this would result in 409. If `sku.capacity` is specified in the PATCH request, then a 409 will be returned.
This is problematic for my use case, because I intentionally want to _avoid_ updating `sku.capacity` when changing `sku.name`. I prefer `sku.capacity` to be fully managed by autoscale profiles combined with `asyncScalingEnabled=true`
If `properties.asyncScalingEnabled=false`, then a PATCH for `sku.name` without `sku.capacity` will return a 409.
### Expected behavior
```
============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://management.azure.com/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Web/serverfarms/redacted?api-version=2022-03-01
Headers: redacted
Body:
{
"sku": {
"name": "P1v4"
}
}
```
```
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Conflict
Headers: redacted
Body:
{
"Code": "Conflict",
"Message": "No available instances to satisfy this request. App Service is attempting to increase capacity. Please retry your request later. If urgent, this can be mitigated by deploying this to a new resource group.",
"Target": null,
"Details": [
{
"Message": "No available instances to satisfy this request. App Service is attempting to increase capacity. Please retry your request later. If urgent, this can be mitigated by deploying this to a new resource group."
},
{
"Code": "Conflict"
},
{
"ErrorEntity": {
"ExtendedCode": "03029",
"MessageTemplate": "No available instances to satisfy this request. App Service is attempting to increase capacity. Please retry your request later. If urgent, this can be mitigated by deploying this to a new resource group.",
"Parameters": [],
"Code": "Conflict",
"Message": "No available instances to satisfy this request. App Service is attempting to increase capacity. Please retry your request later. If urgent, this can be mitigated by deploying this to a new resource group."
}
}
],
"Innererror": null
}
```
### Actual behavior
```
============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://management.azure.com/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Web/serverfarms/redacted?api-version=2022-03-01
Headers: redacted
Body:
{
"sku": {
"name": "P1v4"
}
}
```
```
============================ HTTP RESPONSE ============================
Status Code:
OK
Headers: redacted
Body:
{
"id": "/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Web/serverfarms/redacted",
"name": "redacted",
"type": "Microsoft.Web/serverfarms",
"kind": "app",
"properties": {
redacted
"asyncScalingEnabled": true,
},
"sku": {
"name": "P3v4",
"tier": "PremiumV4",
"size": "P3v4",
"family": "Pv4",
"capacity": 1
}
}
```
### Reproduction Steps
* Set `properties.asyncScalingEnabled=true`
* Be in a region without enough capacity
* Send a PATCH request to update `sku.name`
```
$resourceId = "/subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/serverfarms/{name}"
$asp = (Invoke-AzRestMethod -Method GET -Path "$($resourceId)?api-version=2022-03-01").Content | ConvertFrom-Json -AsHashtable
$asp.properties.asyncScalingEnabled = $true
Invoke-AzRestMethod -Method PUT -Path "$($resourceId)?api-version=2024-11-01" -Payload ( $asp | ConvertTo-Json )
Invoke-AzRestMethod -Method PATCH -Path "$($resourceId)?api-version=2022-03-01" -Payload '{"sku":{"name":"P1v4"}}'
```
### Environment
_No response_
Contributor guide
Research direction
Start with specification/web/resource-manager/Microsoft.Web/AppService/stable/2023-01-01/AppServicePlans.json at the cited PATCH definition, and compare it with the reported server behavior and 2024-11-01 request. The issue does not identify a repository change or test; done requires determining whether this API-service behavior belongs in the specification and obtaining a maintainable, verifiable scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100