首页 > 解决方案 > Azure DevOps Pipeline 脚本中的租户 ID 已审查

问题描述

我有一个管道可以进入密钥库并将生成的字符串打印到 ADO 执行日志。部分字符串包含租户 ID,莫名其妙地被替换为“***”。

https://login.microsoftonline.com/***/oauth2/token

代码并不复杂:

$var = Get-AzKeyVaultSecret -VaultName $(vaultname) -Name $(secretname) -AsPlainText
Write-Host $var

撇开管道安全问题的固有问题不谈,我如何防止它被审查?

标签: powershellazure-devopsazure-pipelines

解决方案


看起来您的一个秘密与您的 tentnat id 具有相同的值。在这种情况下,您无法克服这一点,因为秘密被掩盖,不会在日志中显示它们。但是,这仅用于日志记录,并且幕后 url 是正确的。

在此处查看

echo "You can use macro replacement to get secrets, and they'll be masked in the log: $(secretSauce)"

产生:

You can use macro replacement to get secrets, and they'll be masked in the log: ***

推荐阅读