英文:
Azure Rest API : "Management group XYZ does not have any valid subscriptions"
问题
I received error message:
{
"error": {
"code": "BadRequest",
"message": "Management group XYZ does not have any valid subscriptions. (Request ID: c6a2b5dc-f198-5365-804e-04240727f3a8)"
}
}
(postman) when I'm trying to get any information related to Azure management group. Example above becomes from url:
My SPN is assigned to "Reader" and "Cost Management Reader" roles for affected management group (marked red circle on screenshot).
what is the cause of the issue?
I have access to another azure environment, and there all works fine with those roles assigned.
英文:
I received error message:
{
"error": {
"code": "BadRequest",
"message": "Management group XYZ does not have any valid subscriptions. (Request ID: c6a2b5dc-f198-5365-804e-04240727f3a8)"
}
}
(postman) when I'm trying to get any information related to Azure management group. Example above becomes from url:
https://management.azure.com/providers/Microsoft.Management/managementGroups/{{managementGroupId}}/providers/Microsoft.CostManagement/query?api-version=2022-10-01
My SPN is assigned to "Reader" and "Cost Management Reader" roles for affected management group (marked red circle on screenshot).
what is the cause of the issue?
I have access to another azure environment, and there all works fine with those roles assigned.
答案1
得分: 0
我创建了一个Azure AD应用程序并授予了API权限,如下所示:
我将**Reader
和Cost Management Reader
**角色分配给了Azure AD应用程序。
我创建了一个管理组,如下所示:
现在,我使用以下参数生成了访问令牌:
https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
client_id:ClientID
client_secret:ClientSecret
scope:https://management.azure.com/.default
grant_type:client_credentials
我执行了查询以获取与Azure管理组相关的任何信息,如下所示:
https://management.azure.com/providers/Microsoft.Management/managementGroups/xxxx/providers/Microsoft.CostManagement/query?api-version=2022-10-01
如果您正在传递的管理组没有有效的订阅,则会出现错误"Management group XYZ does not have any valid subscriptions"。
要解决此问题,请检查以下内容:
- 可能已经删除了曾经与管理组关联的订阅。
- 可能将曾经属于管理组的订阅转移到了其他管理组。
- 可能与管理组关联的订阅无效。这可能是由于许多原因,如已过期或已取消的订阅,或已达到其支出限额的订阅。
英文:
I created an Azure AD Application and granted API permissions like below:
I assigned Reader
and Cost Management Reader
role to the Azure AD Application.
I created a Management Group like below:
Now, I generated access token using below parameters:
https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
client_id:ClientID
client_secret:ClientSecret
scope:https://management.azure.com/.default
grant_type:client_credentials
I executed the query to get any information related to Azure management group like below:
https://management.azure.com/providers/Microsoft.Management/managementGroups/xxxx/providers/Microsoft.CostManagement/query?api-version=2022-10-01
The error "Management group XYZ does not have any valid subscriptions" if you are passing the management group do not have valid subscription.
To resolve the issue, check the below:
- It's possible that the subscriptions that were once associated to the management group have been removed.
- It's possible that the subscriptions that used to belong to the management group have been transferred to another management group.
- It's possible that the subscriptions linked to the management group are invalid. This might be due to number of things, like subscriptions that have expired or been cancelled, or subscriptions that have hit their spending limit.
答案2
得分: 0
“在 CSP 范围内,管理组不受成本管理支持。如果您有 CSP 订阅,并且在成本分析中将范围设置为管理组,则会显示类似以下错误:
管理组
英文:
Here is the MS explanation of my problem : https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/understand-work-scopes#cloud-solution-provider-csp-scopes.
"Management groups in CSP scopes aren't supported by Cost Management. If you have a CSP subscription and you set the scope to a management group in cost analysis, an error similar the following one is shown:
Management group <ManagementGroupName> does not have any valid subscriptions"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论