由于提供了无效的客户秘密,Azure Cli无法连接
管道错误代码AADSTS7000215-提供了无效的客户端秘密。但是,提供的客户端秘密是正确的,因为当我本地运行脚本并在.env文件中提供client necret时。但是,使用Azurecli创建YAML文件,我会发现错误。
- task: AzureCLI@2
inputs:
azureSubscription: 'Subscription'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: 'python script.py'
workingDirectory: 'workingdirectory'
完整错误:AADSTS7000215:提供了无效的客户端秘密。确保在请求中发送的秘密是客户的秘密值,而不是客户的秘密ID,用于添加到应用程序中的秘密
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
客户端秘密错误可能与您使用的服务连接有关。
您是否验证了适当配置服务连接和相关SPN?
Client secret error might be related to service connection you use.
Did you verify that service connection and related SPN are properly configured?
服务原理的客户秘密最长的寿命为两年,
有必要不时更新。由于它不是完全直接的,因此,这是关于如何进行“ Azure Resource Manager”连接的快速分步指南。
进入azure devops =>项目设置=>服务连接并找到断裂的连接。
(此步骤是不需要的)从那里选择“管理服务主管”,将您重定向到Azure门户。在Azure Portal中,请转到证书&秘密。在这里,创建一个新的
客户秘密并删除过期的秘密。
在Azure DevOps中返回您的服务连接上的“编辑”。验证按钮仍将显示错误。
更改描述文本框并保存,而无需再次验证新秘密以注册。
现在,编辑窗格中的“验证”按钮应表明您的连接已修复。有时需要一秒钟的尝试,
但最终每次都对我有用。
来源:
学分:Thomas Pentenrieder
Client secrets for Service Principals have a maximum lifetime of two years
it’s necessary to update those from time to time. As it’s not completely straight-forward here’s a quick step-by-step guide on how to do it for connections of the type “Azure Resource Manager”.
Go into Azure DevOps => Project settings => Service connections and find your broken connection.
(this step is sometime not needed) From there select “Manage Service Principal” which will redirect you to the Azure Portal. In the Azure Portal go to Certificates & secrets. Here, create a new
client secret and delete the expired secret.
Back in Azure DevOps click “Edit” on your service connection. The verify button will still show an error.
Make a change to the Description textbox and save without verifying again for the new secret to get registered.
Now the verify button in the Edit pane should show that your connection has been fixed. Sometimes it takes a second and a few tries,
but eventually this has worked for me everytime.
Source: Azure DevOps: Renew expired Service Connection Secret
Credit: Thomas Pentenrieder