graph sdk how to update secret for deployed application

Huimin ZHANG 40 Reputation points
2024-06-19T10:38:26.8133333+00:00

I use ClientSecretCrendential as crendential, as we know, secret will be expired, then our team will generate a new one before old secret expired. so my question is how to use the latest secret to update graphServiceClient instance without downtime.

final ClientSecretCredential credential = new ClientSecretCredentialBuilder()
        .clientId(clientId).tenantId(tenantId).clientSecret(clientSecret)
        .httpClient(authClient).build();
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,197 questions
{count} votes

Accepted answer
  1. CarlZhao-MSFT 39,256 Reputation points
    2024-06-20T08:55:56.3933333+00:00

    Hi @Huimin ZHANG

    As far as I know, client secrets are not automatically updated, which means you have to restart your application to upload a new secret after the client secret expires. In addition, you can also use a script to create a client secret that never expires, but I don't recommend it because it may create some security risks.

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful