我有这段代码,我把它写在了windows上。而且它在windows中运行良好,但是当我在Linux上运行它时,我必须根据我的项目需要在Linux上运行它,但是它在那里不起作用,并给出了以下错误
AttributeError:“ServicePrincipalCredentials”对象没有属性“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)发布于 2022-05-20 17:53:37
假设您使用的是最新版本的azure-mgmt-安全性,它适用于蔚蓝标识包。
从e.g.instead从azure.common.credentials导入ServicePrincipalCredentials,您可以使用从azure.identity导入ClientSecretCredential。
(我在SDK团队工作)
https://stackoverflow.com/questions/72321773
复制相似问题