Azure / Azure/azure-rest-api-specs
Management Lock API throw unexpected error message while creating/getting multiple management locks in the same time
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 424
Description
After tested, I am trying to use resource id like "/subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-mgmtlock-test01/providers/Microsoft.DBforMySQL/servers/acctestmysqlsvr-test01" as lock name to create/get multiple management locks in parallel. But Management Lock API would throw below unexpected error message #A and #B.
1. The first http request:
```
PUT https://management.azure.com//subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-mgmtlock-test01/providers/Microsoft.Authorization/locks//subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-mgmtlock-test01
{"properties":{"level":"CanNotDelete","notes":""}}
```
Error Message - **This is expected error message**:
```
Error: locks.ManagementLocksClient#CreateOrUpdateByScope: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceTypeNotSupported" Message="Unsupported resource type: 'Microsoft.Authorization/locks/xx-xx-xx-xx/acctestRG-mgmtlock-test01'."
```
2. The second http request:
```
PUT https://management.azure.com//subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-mgmtlock-test01/providers/Microsoft.Web/serverfarms/acctestSP-test01/providers/Microsoft.Authorization/locks//subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-mgmtlock-test01/providers/Microsoft.Web/serverfarms/acctestSP-test01
{"properties":{"level":"CanNotDelete","notes":""}}
```
Error Message #A - **This is unexpected error message. I assume api should return the error message like the error message in above first http request**:
```
Error: locks.ManagementLocksClient#CreateOrUpdateByScope: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: error response cannot be parsed: "" error: EOF
```
3. The third http request:
```
GET https://management.azure.com//subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-mgmtlock-test01/providers/Microsoft.DBforMySQL/servers/acctestmysqlsvr-test01/providers/Microsoft.Authorization/locks//subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-mgmtlock-test01/providers/Microsoft.DBforMySQL/servers/acctestmysqlsvr-test01
```
Error Message #B - **This is unexpected error message. I assume it should return error message like "404 Not Found"**:
```
locks.ManagementLocksClient#GetByScope: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="NoRegisteredProviderFound" Message="No registered resource provider found for location 'eastus2' and API version '2016-09-01' for type 'servers'. The supported api-versions are '2017-12-01-preview, 2017-12-01'. The supported locations are 'australiacentral, australiacentral2, australiaeast, australiasoutheast, brazilsouth, canadacentral, canadaeast, centralindia, centralus, eastasia, eastus2, eastus, francecentral, francesouth, germanywestcentral, japaneast, japanwest, koreacentral, koreasouth, northcentralus, northeurope, southafricanorth, southafricawest, southcentralus, southindia, southeastasia, norwayeast, switzerlandnorth, uaenorth, uksouth, ukwest, westcentralus, westeurope, westindia, westus, westus2, centraluseuap, eastus2euap'."
```
BTW, I encountered this issue with [go sdk client](https://github.com/Azure/azure-sdk-for-go/tree/master/services/resources/mgmt/2016-09-01/locks).
Contributor guide
Research direction
Start with the 2016-09-01 management-lock specification and the referenced Go SDK client, focusing on CreateOrUpdateByScope and GetByScope. Compare the documented responses with the three requests and determine the specific specification or generated-client behavior that should change; done means the reported failures produce consistent, documented errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, go, openapi
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100