Powershell 获取AzureKeyVaultSecret时出错:无法检索ServicePrincipal帐户的服务密钥
使用PowerShell,我可以在本地访问我的Azure KeyVault,提供密码并返回存储的密码。我也可以从我启动的虚拟机上实现这一点。此外,我可以从KeyVault访问单个密码,并使用它模拟VSTS生成代理上的用户,但无法访问其余存储的密码。有什么好处 以下是我收到的信息: [错误]获取AzureKeyVaultSecret:无法检索的服务密钥 服务本金账户 [hiddenaccountname]@[companyaccount].com。请登录 再次提供此服务主体的凭据。在里面 PowerShell,执行Azure资源管理器的登录AzurerAccount cmdlet或为服务管理cmdlet添加AzureAccountPowershell 获取AzureKeyVaultSecret时出错:无法检索ServicePrincipal帐户的服务密钥,powershell,azure,azure-pipelines,azure-powershell,Powershell,Azure,Azure Pipelines,Azure Powershell,使用PowerShell,我可以在本地访问我的Azure KeyVault,提供密码并返回存储的密码。我也可以从我启动的虚拟机上实现这一点。此外,我可以从KeyVault访问单个密码,并使用它模拟VSTS生成代理上的用户,但无法访问其余存储的密码。有什么好处 以下是我收到的信息: [错误]获取AzureKeyVaultSecret:无法检索的服务密钥 服务本金账户 [hiddenaccountname]@[companyaccount].com。请登录 再次提供此服务主体的凭据。在里面 Powe
- CategoryInfo:CloseError:(:)[Get-AzureKeyVaultSecret],KeyNotFoundException
- FullyQualifiedErrorId:Microsoft.Azure.Commands.KeyVault.GetAzureKeyVault机密
Login-AzureRmAccount -Credential $AzureCredential -ServicePrincipal -TenantId [abunchofnumbers]
$Password = (Get-AzureKeyVaultSecret -VaultName "[nameOfVault]" -Name "[nameOfSecret]").SecretValueText
登录名接受提供的凭据并让我登录,但Get-AzureKeyVaultSecret cmdlet失败,并且仅在生成期间在VST上失败
有什么想法吗,你这个奇怪而奇妙的开发者?[Resolved-Follow]我的过程包括一个Powershell脚本,通过使用Login AzurerAccount和Get AzureKeyVaultSecret来模拟一个用户,以获取用户的密码,然后是第二个Powershell脚本,以重新登录AzurerAccount以从KeyVault获取更多密码。我交换了这两个脚本的顺序,问题消失了。是否在密钥保管库访问策略中添加服务主体?尝试通过Azure PowerShell任务调用Get-AzureKeyVaultSecret并检查结果。这个问题可能会让你受益:@ShengbaoShui,是的。谢谢你的检查。并检查Get和List。