我试图在python
上使用azure cli
命令登录,但有一个问题。在
脚本代码是:
from azure.common.credentials import ServicePrincipalCredentials
credentials = ServicePrincipalCredentials(
client_id = 'a1bc23d4-e5fg-6hi7-8901-23456j7kl8mn',
secret = '112233445566',
tenant = 'z0y987x-6543-2w1v-0987-6u5t4s32109r'
)
msrest.except ions.AuthenticationError: , AdalError: Get Token request returned http error: 400 and server response: {"error":"invalid_request","error_description":"ZZBXQH1775: Tenant 'z0y987x-6543-2w1v-0987-6u5t4s32109r' not found. This may happen if there are no active subscriptions for the tenant. Check with your subscription administrator.
我使用visualstudio代码工作
我可以用一个错误的
tenant id
来重现你的问题,如果我使用正确的一个,它就可以工作了。而且,我的租户中没有活动订阅。在导航到门户网站中的},然后使用它重试代码。在
Azure Active Directory
->;App registrations
->;找到你的应用程序并复制下面的{我解决了我的问题使用一个子进程,这个子进程调用shell,然后发送命令az cli
例如:
这个代码对我有用,希望对你有帮助!!在
相关问题 更多 >
编程相关推荐