【问题标题】:Service principal credentials, set custom identifier?服务主体凭据,设置自定义标识符?
【发布时间】:2017-06-01 12:42:48
【问题描述】:

我们正在将个人开发者证书链接到某个服务主体。 当开发人员离开我们的团队时,我们将从服务主体中删除该凭据。

这很好用,但有点麻烦,因为开发者的名字没有与凭据相关联。

我注意到它们是凭据上的 customIdentifierKey 属性...但我找不到如何设置 customIdentifierKey。

有人知道怎么做吗?

New-AzureRmADAppCredential -ApplicationId $appId -CertValue $keyValue -EndDate $cert.NotAfter -StartDate $cert.NotBefore 

【问题讨论】:

  • 请问,我的回答有帮助吗?还是没有解决你的问题?如果有,你能把它标记为答案吗?

标签: azure azure-active-directory service-principal


【解决方案1】:

您可以使用Azure AD v2 cmdlets 设置和获取自定义密钥标识符。

我在这里添加一个证书:

New-AzureADApplicationKeyCredential -ObjectId 2648416a-aaaa-4bc0-9190-aaaab6165710 -CustomKeyIdentifier 'Your key name' -StartDate '2017/06/01' -EndDate '2018/06/01' -Type AsymmetricX509Cert -Usage Verify -Value $keyValue

假设您的 $keyValue 包含 X509 证书。如果是对称密钥,可以使用Symmetric作为Type。

自定义密钥标识符存储为字节,以 ASCII 编码。

所以当你得到一个时,你需要通过解码来运行它:

$cred = Get-AzureADApplicationKeyCredential -ObjectId 2648416a-aaaa-4bc0-9190-aaaab6165710
[System.Text.Encoding]::ASCII.GetString($cred.CustomKeyIdentifier)

有趣的是,如果您通过 Azure 门户在 PasswordCredential(客户端密码)上设置标识符,它会将其编码为 Unicode。

【讨论】:

    猜你喜欢
    • 2011-04-14
    • 2020-12-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-23
    • 1970-01-01
    • 2021-05-25
    • 2013-02-10
    • 2017-09-01
    相关资源
    最近更新 更多