Azure Active Directory应用程序服务主体更新客户端机密

Azure Active Directory应用程序服务主体更新客户端机密,azure,azure-active-directory,Azure,Azure Active Directory,我已通过Powershell创建了Azure Active Directory应用程序主体。应用程序主体的默认客户端机密到期期限为一年。如何在到期后更新客户端密码 PS C:\Users\user> $msolcred = Get-Credential cmdlet Get-Credential at command pipeline position 1 Supply values for the following parameters: Credential PS C:\User

我已通过Powershell创建了Azure Active Directory应用程序主体。应用程序主体的默认客户端机密到期期限为一年。如何在到期后更新客户端密码

PS C:\Users\user> $msolcred = Get-Credential

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential

PS C:\Users\user>  Connect-MsolService -credential $msolcred

PS C:\Users\user> $bytes = New-Object Byte[] 32

PS C:\Users\user> $rand = [System.Security.Cryptography.RandomNumberGenerator]::Create()

PS C:\Users\user>  $rand.GetBytes($bytes)

PS C:\Users\user> $rand.Dispose()

PS C:\Users\user>  $newClientSecret = [System.Convert]::ToBase64String($bytes)

PS C:\Users\user> New-MsolServicePrincipal -DisplayName "DemoSP" -Type password -Value $newClientSecret



DisplayName           : DemoSP

ServicePrincipalNames : {6e2b0328-87b3-459f-a874-e9e76704c71f}

ObjectId              : 525da0c9-6548-42ea-a2ce-457bd42c0cfa

AppPrincipalId        : 6e2b0328-87b3-459f-a874-e9e76704c71f

TrustedForDelegation  : False

AccountEnabled        : True

Addresses             : {}

KeyType               : Password

KeyId                 : 6f15cddf-5ffd-448d-b359-be4756e6165e

StartDate             : 3/29/2017 6:18:33 PM

EndDate               : 3/29/2018 6:18:33 PM

Usage                 : Verify
你在找那个。您不更新秘密,而是创建一个新的秘密


您是否知道您正在使用Azure Active Directory的旧MSOnline V1 PowerShell模块?您可以考虑切换到

是否意味着为同一服务主体创建新的客户端机密?是的,创建新的秘密