You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Advisor Python SDK及REST API无法返回安全类建议求助

问题:Azure Advisor Python SDK及REST API无法获取安全类别建议

我使用Azure Advisor Python SDK获取建议,目前SDK仅能返回除**security(安全)**类别外的所有建议。最初用相同代码可以正常获取安全类建议,但突然无法获取该类内容。

在Azure门户中能看到共33条建议(其中30条为安全类,OperationalExcellence、Reliability、Performance类各1条),但运行代码仅得到3条非安全类建议。我也尝试了Azure Advisor REST API,同样无法返回安全类别建议。

相关代码如下:

from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
from azure.mgmt.advisor import AdvisorManagementClient
import sys
import os

SUBSCRIPTION_ID = "xxxx-xxx-xxxx-xxx"

client = CostManagementClient(credential=DefaultAzureCredential())  # noqa: F841
print(client)

advisor_client = AdvisorManagementClient(
        credential=DefaultAzureCredential(),
        subscription_id=SUBSCRIPTION_ID
    )
print(advisor_client)

def call(response, *args, **kwargs):
        return response.http_response
print(call)

response = advisor_client.recommendations.generate(cls=call)  # noqa: F841
print(response)
cached_list = advisor_client.recommendations.list()
for data in cached_list:
    print(data)

截图说明:

  • 截图1:Azure门户中Advisor建议统计界面,显示共33条建议,其中安全类建议30条
  • 截图2:代码运行输出结果,仅显示3条非安全类建议

内容的提问来源于stack exchange,提问作者Manjunath Rao

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 02:25:02