I am using the azure advisor python SDK to fetch advisor recommendations. It is giving me all the recommendations other than 'security'.
When I first used the same code, it used to give me 'security' recommendation as well, but all of a sudden it stopped giving me 'security' recommendations.
From Azure portal: I can see a total of 33 recommendations (30 are security, and remaining are 1 of each -operationalExcellence, Reliability, performance). But when I run the code, I get only 3 recommendations, other than 'security'. Can some one please help me, if any default configurations has to be changed?
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)
I have tried the Azure REST API for Advisor as well, it is also giving all recommendations BUT skipping 'security' category.