Azure服务负责人-强制到期是故意的吗?

问题描述

Azure服务主体认具有到期日期,并且需要轮换。

但是有没有办法使服务主体无效或强制到期?

解决方法

服务主体进行身份验证时使用的凭据可以存储在服务主体本身上,也可以存储在支持应用程序的对象上(即“应用程序注册”)。

当前不支持更改现有凭证的到期日期。如果要禁用凭据,则应将其删除。 (如果您希望重新启用它,则只需将其重新添加为授权证书即可。)

从应用程序中删除凭据(应用程序注册)

使用Azure门户

  1. 导航到Azure Active Directory>应用程序注册>(选择应用程序)>证书和机密

  2. 在任何证书或客户机密旁边,选择“删除”图标(?️)

    Certificates & secrets in the Azure portal

使用Azure AD PowerShell

remove a key credential(证书):

Remove-AzureADApplicationKeyCredential -ObjectId "{id}" -KeyId "{key-id}"

remove a password credential(客户端密钥):

Remove-AzureADApplicationPasswordCredentia -ObjectId "{id}" -KeyId "{key-id}"

使用Microsoft Graph

remove a key credential(证书):

POST https://graph.microsoft.com/v1.0/applications/{id}/removePassword
Content-type: application/json

{
    "keyId": "{key-id}"
}

remove a password credential(客户密码):

POST https://graph.microsoft.com/v1.0/applications/{id}/removePassword
Content-type: application/json

{
    "keyId": "{key-id}"
}

从服务主体中删除凭据

使用Azure门户

当前无法使用Azure门户来管理直接存储在服务主体上的凭据。

使用Azure AD PowerShell

remove a key credential(证书):

Remove-AzureADServicePrincipalKeyCredential -ObjectId "{id}" -KeyId "{key-id}"

remove a password credential(客户端密钥):

Remove-AzureADMSApplicationPassword -ObjectId "{id}" -KeyId "{key-id}"

使用Microsoft Graph

remove a key credential(证书):

POST https://graph.microsoft.com/v1.0/servicePrincipals/{id}/removeKey
Content-type: application/json

{
    "keyId": "{key-id}"
}

remove a password credential(客户端密钥):

POST https://graph.microsoft.com/v1.0/servicePrincipals/{id}/removePassword
Content-type: application/json

{
    "keyId": "{key-id}"
}