Azure / Azure/azure-rest-api-specs
[BUG] AKS ManagedClusterUpgradeProfile.agentPoolProfiles is non-nullable in the spec but null in the API
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 37m
- Merged PRs (30d)
- 446
Description
### API Spec link
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2026-05-01/managedClusters.json
### API Spec version
2019-08-01 through 2026-05-01 (latest)
### Describe the bug
The OpenAPI spec for `ManagedClusterUpgradeProfileProperties` lists `agentPoolProfiles` as a required array, but the actual API returns `null` when the cluster is VMSS-backed, resulting in a deserialization error when using the generated `Azure.ResourceManager.ContainerService` package.
Also see this report on the SDK repo from 2023: https://github.com/Azure/azure-sdk-for-net/issues/39249
### Expected behavior
OpenAPI spec and generated SDK should describe the API's actual behavior and handle the returned `"agentPoolProfiles": null`.
### Actual behavior
```
System.InvalidOperationException: The requested operation requires an element of type 'Array', but the target element has type 'Null'.
at System.Text.Json.ThrowHelper.ThrowJsonElementWrongTypeException(JsonTokenType expectedType, JsonTokenType actualType)
at System.Text.Json.JsonElement.EnumerateArray()
at Azure.ResourceManager.ContainerService.ManagedClusterUpgradeProfileData.DeserializeManagedClusterUpgradeProfileData(JsonElement element)
at Azure.ResourceManager.ContainerService.ManagedClustersRestOperations.GetUpgradeProfileAsync(String subscriptionId, String resourceGroupName, String resourceName, CancellationToken cancellationToken)
at Azure.ResourceManager.ContainerService.ManagedClusterUpgradeProfileResource.GetAsync(CancellationToken cancellationToken)
```
### Reproduction Steps
```csharp
ArmClient armClient = new ArmClient(new DefaultAzureCredential());
ContainerServiceManagedClusterResource cluster = armClient.GetContainerServiceManagedClusterResource(
new ResourceIdentifier("/subscriptions//resourceGroups//providers/Microsoft.ContainerService/managedClusters/"));
await cluster.GetManagedClusterUpgradeProfile().GetAsync(); // Throws InvalidOperationException
```
### Environment
_No response_
Contributor guide
Research direction
Start with the managedClusters.json specification linked in the issue and inspect ManagedClusterUpgradeProfileProperties.agentPoolProfiles across the listed API versions. Compare its schema with the reported null response and the generated SDK deserialization failure. Done means the specification represents the API response and the provided GetUpgradeProfileAsync reproduction no longer fails on a null agentPoolProfiles value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100