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 works 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)
CodePudding user response:
Assuming you are using latest version of azure-mgmt-security, it works with azure-identity package.
e.g.instead of from azure.common.credentials import ServicePrincipalCredentials, you can use from azure.identity import ClientSecretCredential.
(I work in MS in the SDK team)