Getting error in Linux printing Security group in azure

Hassan Turi 21 Reputation points
2022-05-20T16:55:53.027+00:00

I have this code and I have written it in windows. and it works fine in windows but when I run it on Linux and I have to run it on Linux as of my project needs and it does not work there and gives me the following error

AttributeError: 'ServicePrincipalCredentials' object has no attribute 'get_token'

from azure.mgmt.security import SecurityCenter
from azure.common.credentials import ServicePrincipalCredentials
import Credentials
from pprint import pprint

client = SecurityCenter(Credentials.credential,Credentials.subscription_id,asc_location="")

for score in client.secure_scores.list():
   print(score)
Community Center | Not monitored
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.