Azure - 无法使用服务主体登录

问题描述 投票:0回答:1

我正在尝试在应用程序注册后使用服务主体登录。

我有以下用于登录的详细信息

az login --service-principal -u <secret_value> -p <application_clientId> --tenant <tenantID>

但是我遇到了以下错误


AADSTS700016: Application with identifier 'erfhfgOs~SPAghgrr45hgf' was not found in the directory 'Default Directory'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

我尝试使用新应用程序,但始终因上述错误而失败

任何解决方案

azure-devops azure-active-directory azure-service-principal
1个回答
1
投票

最初我遇到了与以下相同的错误:

az login --service-principal -u <secret_value> -p <application_clientId> --tenant <tenantID>

enter image description here

在目录“默认目录”中找不到标识符为“erfhfgOs~SPAghgrr45hgf”的应用程序。如果应用程序尚未由租户管理员安装或未得到租户中任何用户的同意,则可能会发生这种情况。您可能已将身份验证请求发送给了错误的租户

如果您传递无效或错误的参数值,通常会发生此错误。

我同意@cedric,您正在传递客户端ID参数(u)的客户端秘密和客户端秘密参数(p)的客户端ID。

要解决该错误,通过传递正确的值来修改命令:

az login --service-principal -u <application_clientId> -p <secret_value>--tenant <tenantID>

我能够成功登录 az cli,如下所示:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.