繁体   English   中英

在 azure 中的 Linux 打印安全组中出现错误

[英]Getting error in Linux printing Security group in azure

我有这段代码,我已经在 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)

假设您使用的是最新版本的 azure-mgmt-security,它适用于 azure-identity 包。

例如,您可以使用 from azure.identity import ClientSecretCredentials 而不是 from azure.common.credentials import ServicePrincipalCredentials。

(我在 SDK 团队的 MS 工作)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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