0

我正在从 Azure Advisor Rest Api 提取建议,但无法检索 extendedProperties 值。

具体来说,我正在从“成本”类别的建议中寻找节省数据。

在以下 58 秒的视频中,有一个预期响应的示例。

https://www.youtube.com/watch?v=hAxrdmOAB8s

是否需要为我的帐户提供特定权限才能提取数据,或者 API 是否无法提供这些值?

我可以在门户中看到数据,但 extendedProperties 属性始终为空。

4

1 回答 1

0

我假设您正在尝试Recommendations - List API。

从本质上讲,扩展属性公开了有关 Azure 顾问建议的附加信息。

AFAIK,他们不需要出现在每个推荐中,并且不需要额外的权限来列出。可能只是您收到的推荐类型没有要列出的情况。

这是我收到的一个示例响应,其中包含两者:

[
    {
        "properties": {
            "category": "Cost",
            "impact": "Medium",
            "impactedField": "Microsoft.Network/publicIPAddresses",
            "impactedValue": "foo",
            "lastUpdated": "2020-03-20T14:10:24.6928024Z",
            "recommendationTypeId": "1b4dd958-c202-47af-af97-99bfc98376a5",
            "shortDescription": {
                "problem": "Delete Public IP address not associated to a running Azure resource",
                "solution": "Delete Public IP address not associated to a running Azure resource"
            },
            "extendedProperties": {}
        },
        "id": "xxx",
        "type": "Microsoft.Advisor/recommendations",
        "name": "xxx"
    },
    {
        "properties": {
            "category": "Cost",
            "impact": "Medium",
            "impactedField": "Microsoft.Sql/servers/databases",
            "impactedValue": "bar",
            "lastUpdated": "2020-03-20T13:27:35.8394386Z",
            "recommendationTypeId": "b83241d3-47ba-4603-8d5a-a1b3331e74f4",
            "shortDescription": {
                "problem": "Right-size underutilized SQL Databases",
                "solution": "Right-size underutilized SQL Databases"
            },
            "extendedProperties": {
                "ServerName": "fooserver",
                "DatabaseName": "fooDB",
                "IsInReplication": "1",
                "ResourceGroup": "xyz",
                "DatabaseSize": "6",
                "Region": "East US 2",
                "ObservationPeriodStartDate": "03/04/2020 00:00:00",
                "ObservationPeriodEndDate": "03/19/2020 00:00:00",
                "Recommended_DTU": "10",
                "Recommended_SKU": "S0",
                "HasRecommendation": "true"
            }
        }
    }
]
于 2020-03-20T17:24:02.533 回答