Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

huangapple go评论102阅读模式
英文:

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:

https://management.azure.com/providers/Microsoft.Management/managementGroups/{{managementGroupId}}/providers/Microsoft.CostManagement/query?api-version=2022-10-01

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

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

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

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权限,如下所示:

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

我将**ReaderCost Management Reader**角色分配给了Azure AD应用程序。

我创建了一个管理组,如下所示:

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

现在,我使用以下参数生成了访问令牌

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 Rest API: “管理组 XYZ 没有任何有效的订阅”

我执行了查询以获取与Azure管理组相关的任何信息,如下所示:

https://management.azure.com/providers/Microsoft.Management/managementGroups/xxxx/providers/Microsoft.CostManagement/query?api-version=2022-10-01

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

如果您正在传递的管理组没有有效的订阅,则会出现错误"Management group XYZ does not have any valid subscriptions"。

要解决此问题,请检查以下内容:

  • 可能已经删除了曾经与管理组关联的订阅。
  • 可能将曾经属于管理组的订阅转移到了其他管理组。
  • 可能与管理组关联的订阅无效。这可能是由于许多原因,如已过期或已取消的订阅,或已达到其支出限额的订阅。
英文:

I created an Azure AD Application and granted API permissions like below:

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

I assigned Reader and Cost Management Reader role to the Azure AD Application.

I created a Management Group like below:

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

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

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

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

Azure Rest API: “管理组 XYZ 没有任何有效的订阅”

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"

huangapple
  • 本文由 发表于 2023年5月13日 15:32:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76241577.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定