我有一个用于Power平台环境的服务主体,它将被DevOps平台用来部署到这个环境中。
服务主体要求我设置一个客户端秘密,它将由我在DevOps中的服务连接引用
你必须设定一个客户的秘密有效期最长为2年,在此之后,它将无法工作。因此,我需要进入Azure门户,更新客户端机密,然后进入DevOps并更新服务连接。
有什么办法我可以自动完成这件事吗?
发布于 2021-11-01 08:49:30
--你必须将客户的秘密有效期设定为2年,在此之后,它就不能工作了。
实际上,没有必要这样做,在蔚蓝门户,最长为2年,但您可以使用蔚蓝powershell创建一个近乎永久的秘密,例如100年。
如果要自定义秘密值,请使用Az
模块,使用Connect-AzAccount
登录,然后使用New-AzADAppCredential
,如下所示。
$SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force
New-AzADAppCredential -ApplicationId <ApplicationId of the App Registration> -CustomKeyIdentifier "test" -Password $SecureStringPassword -EndDate (Get-Date).AddYears(100)
如果您想要自动生成一个秘密值,请使用AzureAD
模块,使用Connect-AzureAD
登录,然后在下面作为New-AzureADApplicationPasswordCredential
使用。
New-AzureADApplicationPasswordCredential -ObjectId <ObjectId of the App Registration> -EndDate (Get-Date).AddYears(100)
https://stackoverflow.com/questions/69747524
复制相似问题