Azure / Azure/azure-rest-api-specs

The VirtualMachineProfile.Sku.capacity of Lab resource should allow to be empty

Open
#22,037 1 comment 0 reactions 0 assignees View on GitHub
Lab Services Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

The `VirtualMachineProfile.Sku.capacity` would be automatically set to the number of members in AAD Group when `activeDirectoryGroupId ` is set in request payload.

Service team from Lab service confirmed, even if the payload is a "1" as the capacity, by design service API would scale it up. And currently service API doesn't allow capacity to be empty.

If so, you could imagine user sets the capacity to "1" and set the activeDirectoryGroupId in request payload, but service API scaled it up. At this time, the capacity isn't the value user expected. User would feel confused.

So, per my understanding, I assume the `capacity` property should allow empty value when the activeDirectoryGroupId is set in request payload. But actually service API always throws error message "'capacity' must not be empty.".

So seems it's a validation bug and service team confirm they will fix it.

The request payload to create lab with activeDirectoryGroupId and without capacity:
```

PUT https://management.azure.com/subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-lslab-test10/providers/Microsoft.LabServices/labs/acctest-lab-test11?api-version=2022-08-01

{
"location": "westeurope",
"properties": {
"autoShutdownProfile": {
"shutdownOnDisconnect": "Disabled",
"shutdownOnIdle": "None",
"shutdownWhenNotConnected": "Disabled"
},
"connectionProfile": {
"clientRdpAccess": "None",
"clientSshAccess": "None",
"webRdpAccess": "None",
"webSshAccess": "None"
},
"description": "Test Description",
"rosterProfile": {
"activeDirectoryGroupId": "xx-xx-xxx-xxx"
},
"securityProfile": {
"openAccess": "Disabled"
},
"title": "Test Title",
"virtualMachineProfile": {
"additionalCapabilities": {
"installGpuDrivers": "Disabled"
},
"adminUser": {
"password": "Password1234!",
"username": "testAdmin"
},
"createOption": "Image",
"imageReference": {
"offer": "xxx",
"publisher": "xxx",
"sku": "xxxx",
"version": "latest"
},
"sku": {
"name": "xxxxx"
},
"usageQuota": "PT10H",
"useSharedPassword": "Enabled"
}
},
"tags": null
}
```

The error message returned by API:
```
{
"error": {
"code": "ValidationError",
"message": "The request is not valid.",
"details": [
{
"message": "'capacity' must not be empty.",
"target": "properties.virtualMachineProfile.sku.capacity",
"details": [],
"additionalInfo": []
}
],
"additionalInfo": []
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the Microsoft.LabServices 2022-08-01 API definition and inspect the VirtualMachineProfile.Sku.capacity validation alongside rosterProfile.activeDirectoryGroupId. Confirm the schema permits an omitted capacity when the group ID is supplied, while preserving validation for other requests; the request payload and returned ValidationError provide the expected behavior.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.