我能够通过使用客户端上的证书及其在Azure AD中的秘密进行身份验证来检索应用令牌。 我的问题是,是否可以自动将应用程序的证书机密上传到Azure AD? 我通过Powershell Cmdlet实现了AD应用程序创建的自动化,现在我正在尝试将自动化推向更高水平。
进一步的问题是,同意过程是否也可以自动化?我知道用户名/密码必须是手动的,但是流程的其他部分可以通过Powershell Cmdlet自动化吗?
答案 0 :(得分:0)
不,原因是出于安全目的;用户应该允许应用程序访问o365租户服务的某些权限。 希望这会有所帮助。
答案 1 :(得分:0)
Mostafa是正确的,没有办法自动化同意过程。
但是,您可以在应用程序上自动设置证书凭据。
使用“connect-msolservice”登录并找到“Get-MsolServicePrincipal”的应用程序主体ID后,您可以执行以下操作在该应用程序上设置证书凭据。
PS C:\windows\system32> $cer = New-Object System.Security.Cryptography.X509Certificates.X509Certificate
PS C:\windows\system32> $cer.Import("Path to Certificate (.cer) file")
PS C:\windows\system32> $binCert = $cer.GetRawCertData()
PS C:\windows\system32> $credValue = [System.Convert]::ToBase64String($binCert);
PS C:\windows\system32> New-MsolServicePrincipalCredential -AppPrincipalId
"Application Principal ID from above" -Type asymmetric -Value $credValue
-StartDate $cer.GetEffectiveDateString() -EndDate $cer.GetExpirationDateString() -Usage verify
之后您可以通过'Get-MsolServicePrincipal'验证是否已成功设置。