secureScores endpoint returning None

146 Views Asked by At

I am working on Microsoft Graph API (python3). The get_alerts() and get_secure_score_control_profiles() returns results but get_secure_score() is returning 'None'.

The Azure portal shows Secure Scores but the function returns despite the response status is 200. Any pointers?

def get_secure_score():

    base_url = 'https://graph.microsoft.com/beta/security/secureScores'
    #or 
    #base_url = 'https://graph.microsoft.com/v1.0/security/secureScores'
    secure_scores = MSGRAPH.get(base_url).json()
    print(secure_scores)
    secure_scores = secure_scores.json()
    print(secure_scores)

    if b'' in secure_scores:
        print("Please Sign-in using a on.microsoft.com account for demo data")
        secure_scores = None
    elif 'error' in secure_scores:
        secure_scores = None
    elif len(secure_scores.get('value')) > 0:
        secure_scores = secure_scores.get('value')[0]
    else:
        secure_scores = None
    return secure_scores
  • url: https://graph.microsoft.com/beta/security/secureScores
  • response: Response [200]
  • response_output:
    {
      '@odata.context': 'https://graph.microsoft.com/beta/$metadata#Security/secureScores', 
      'value': []
    }
    
1

There are 1 best solutions below

0
Chi Nguyen On

When you first signed up your app on Azure, your secure scores might not be available right away, but you will still have other info such as alerts and control profile. If you still haven't got your securescore data, you can also reach out and file a Github issue here