简体   繁体   中英

Getting error in Linux printing Security group in azure

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)

Assuming you are using latest version of azure-mgmt-security, it works with azure-identity package.

eginstead of from azure.common.credentials import ServicePrincipalCredentials, you can use from azure.identity import ClientSecretCredential.

(I work in MS in the SDK team)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM