简体   繁体   English

到期时自动更新服务主体客户端密码?

[英]Automatically update Service Principal client secret on expiry?

I have a Service Principal for a Power Platform environment which will be used by a DevOps platform to make deployments to this environment.我有一个 Power Platform 环境的服务主体,DevOps 平台将使用它来部署到这个环境。

The service principal requires me to set a client secret which will be referenced by my Service Connection in DevOps服务主体要求我设置一个客户端密码,该密码将由我在 DevOps 中的服务连接引用

在此处输入图片说明

You must set a client secret expiry date of up to 2 years and after that time, it won't work.您必须设置最多 2 年的客户端机密到期日期,在此之后,它就不起作用了。 So I would need to go into the Azure portal, update the client secret and then into DevOps and update the service connection.所以我需要进入 Azure 门户,更新客户端机密,然后进入 DevOps 并更新服务连接。

Is there a way I can do this automatically?有没有办法可以自动执行此操作?

You must set a client secret expiry date of up to 2 years and after that time, it won't work.您必须设置最多 2 年的客户端机密到期日期,在此之后,它就不起作用了。

Actually, no need to do that, in azure portal, the maximum is 2 years, but you could use azure powershell to create a near-permanent secret, eg 100 years.其实没必要这样做,在azure portal中,最长是2年,但是你可以用azure powershell来创建一个近乎永久的秘密,比如100年。

If you want to custom the secret value, use Az module, login with Connect-AzAccount , then use New-AzADAppCredential as below.如果要自定义密钥值,请使用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)

在此处输入图片说明

If you want to generate a secret value automatically, use AzureAD module, login with Connect-AzureAD , then use as New-AzureADApplicationPasswordCredential below.如果要自动生成机密值,请使用AzureAD模块,使用Connect-AzureAD登录,然后使用下面的New-AzureADApplicationPasswordCredential

New-AzureADApplicationPasswordCredential -ObjectId <ObjectId of the App Registration> -EndDate (Get-Date).AddYears(100)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Active Directory 应用服务主体更新客户端机密 - Azure Active Directory App service Principal update client secret Terraform Azure 服务主体客户端机密过期 - Terraform Azure Service Principal Client Secret expiration Terraform 通过服务主体和客户机密对 Azure 进行身份验证 - Terraform authenticating to azure by service principal and client secret 即使在机密到期后,az login 使用服务主体也能正常工作的任何情况? - any situation where az login using Service principal works even after secret expiry? 将服务主要客户ID和密码传递给ARM模板 - Pass Service Principal Client Id and Secret to ARM Template 使用 powershell 重置 Azure 服务主体的客户端密码 - Reset the client secret of Azure Service Principal using powershell 如何从现有的 Azure 服务主体获取客户端密码 - How to get client secret from existing Azure service principal 如何使用 Terraform 为 Azure 服务主体创建客户端密码 - How to create client secret for Azure Service Principal using Terraform 是否可以使用Terraform回收azurerm_kubernetes_cluster service_principal:client_secret - Is it possible to use Terraform to recycle the azurerm_kubernetes_cluster service_principal:client_secret only Azure 使用服务主体登录失败并出现 401 - 提供的客户端密码无效 - Azure Login Using Service Principal is failing with 401 - Invalid client secret provided
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM