Azure / Azure/azure-rest-api-specs
[Subscription] $expand=ancestors is missing in the specs
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 424
Description
Hi,
I opened this issue as recommended from [azure-powershell#12391](https://github.com/Azure/azure-powershell/issues/12391). Azure Portal uses a very helpful parameter and value "$expand=ancestors" to add to the output on where a subscription is located in the management group tree. This parameter and its values sadly is not part of the specs.
Sample API Call with the parameter $expand (managementGroupAncestors is included in the results):
`https://management.azure.com/subscriptions/{SubscriptionId}?api-version=2020-01-01&$expand=ancestors`
```json
{
"id": "/subscriptions/....",
"authorizationSource": "....",
"managementGroupAncestors": [
"management-group-level-2",
"management-group-level-1",
"{myTenantId}"
],
"managedByTenants": [],
"subscriptionId": "*****",
"tenantId": "*****",
"displayName": "MySubscription",
"state": "Enabled",
"subscriptionPolicies": {
"locationPlacementId": "....",
"quotaId": "....",
"spendingLimit": "Off"
}
}
```
Sample API Call without the parameter $expand (managementGroupAncestors is not included in the results):
`https://management.azure.com/subscriptions/{SubscriptionId}?api-version=2020-01-01`
```json
{
"id": "/subscriptions/....",
"authorizationSource": "....",
"managedByTenants": [],
"subscriptionId": "*****",
"tenantId": "*****",
"displayName": "MySubscription",
"state": "Enabled",
"subscriptionPolicies": {
"locationPlacementId": "....",
"quotaId": "....",
"spendingLimit": "Off"
}
}
```
Would be awesome if this parameter could be officially added and described in the specs:
https://github.com/Azure/azure-rest-api-specs/blob/2cd7c6eacc5430d8956885e8d19b87ce3f3ebd6e/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-01/subscriptions.json#L95
Many Thanks!
Contributor guide
Research direction
Start with specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-01/subscriptions.json at the linked subscription operation and compare the documented API response with the supplied examples. Add the missing $expand=ancestors parameter and managementGroupAncestors response detail, then run the repository's specification validation to confirm the updated spec is valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100