有没有办法使用 PowerShell 检索 Azure AD 应用程序的客户端机密?

时间:2021-04-14 20:57:28

标签: azure azure-active-directory

是否可以使用 PowerShell 以纯文本形式从 Azure AD 应用程序中检索客户端密钥?

我尝试了以下命令,但它只返回密钥的类型,而不是实际值。

$objectID = "00000-00000-00000-00000"
$keyID = "00000-00000-00000-00000"
$secret = Get-AzADAppCredential -ObjectId $objectID | Where-Object {$_.KeyId -eq $keyID}
$secret

enter image description here

1 个答案:

答案 0 :(得分:0)

不能以任何方式检索创建的客户端密钥的值。

secretText 的解释:

<块引用>

生成的密码值仅在初始 POST 期间返回 请求添加密码。没有办法找回这个密码 未来。

唯一的方法是 add new Client Secret 并安全地存储新值。

$SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force
New-AzADAppCredential -ObjectId 1f89cf81-0146-4f4e-beae-2007d0668416 -Password $SecureStringPassword