Open sscchh2001 opened 4 years ago
@msJinLei , please try the latest API and check if we can get those information?
@sscchh2001 , we didn't find expand query parameter on API swagger. How did you know this usage? If it is a formal, we will raise a request to service team to ask them to define this parameter on Swagger. Then, clients can support it.
@dingmeng-xue , I have found it in https://github.com/Azure/azure-powershell/issues/9799, and tested it working in my environment in Azure China. Please kindly check with service team to enable this parameter, thanks.
I would also appreciate this feature in the cmdlet. It is used by Azure Portal as well. When browsing to a specific subscription the following call is made: https://management.azure.com/subscriptions/{SubscriptionId}?api-version=2019-03-01&$expand=ancestors
Very likely to show the "Parent management group" in the portal ui.
I checked it also using the latest version of the API 2020-01-01 adding it as a parameter works just fine.
Result includes "managementGroupAncestors":
{
"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"
}
}
Hi scratch85, all clients respect Swagger definition. Below link shows that parameter is not officially supported. Please raise Github issue to azure-rest-api-specs
to ask service team update Swagger file if parameter is formal one.
https://github.com/Azure/azure-rest-api-specs/blob/2cd7c6eacc5430d8956885e8d19b87ce3f3ebd6e/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-01/subscriptions.json#L95
Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!
As recommended I opened an issue in azure-rest-api-specs
but there is no answer/comment to it yet.
Hi Scratch85,
For the time being, you can use below script as workaround.
Invoke-AzRestMethod -Method GET -Path "/subscriptions/{SubscriptionId}/?api-version=2019-03-01&$expand=ancestors"
Hi Scratch85,
For the time being, you can use below script as workaround.
Invoke-AzRestMethod -Method GET -Path "/subscriptions/{SubscriptionId}/?api-version=2019-03-01&$expand=ancestors"
Thanks!!
Yepp, we do this already but would prefer it to be available via the cmdlet. Btw, it works with api-version=2020-01-01
as well (just to use the latest version).
any updates here?
Azure PowerShell cmdlet conforms to Swagger spec. We need service to define this parameter. It seems issue is still open.
Any news?
Any news?
Any update here?
@scratch85 , no idea whether service will support your requirement. Could you use Invoke-AzRestMethod to call API directly as workaround?
@scratch85 , no idea whether service will support your requirement. Could you use Invoke-AzRestMethod to call API directly as workaround?
We do this already, but would appreciate if this finds its way into the official documentation and hopefully the cmdlet supports this parameter than as well. Any chance this could make its way into the powershell Az module?
Any update here?
Sorry, we cannot support the service API parameter which is not officially defined.
You can take the following step if you really hope it to be included in Azure PowerShell
Hi scratch85, all clients respect Swagger definition. Below link shows that parameter is not officially supported. Please raise Github issue to
azure-rest-api-specs
to ask service team update Swagger file if parameter is formal one. https://github.com/Azure/azure-rest-api-specs/blob/2cd7c6eacc5430d8956885e8d19b87ce3f3ebd6e/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-01/subscriptions.json#L95
@Service team. The customer request us to officially support $expand=ancestors
for https://management.azure.com/subscriptions/{SubscriptionId}
. Could your team help to support it in the swagger spec so that Azure PowerShell can enable this function officially? Thanks
Description of the new feature
Can Get-AzSubscription provide an -Expand parameter to list its management group ancestors? I know that GET https://management.azure.com/subscriptions/{subID}?api-version=2018-11-01&$expand=ancestors provide the ancestor details, could PowerShell provide the same functionality?
Proposed implementation details (optional)