Azure B2C and Multiple certificates

Gola, Mariusz 45 Reputation points
2023-09-12T19:57:25.27+00:00

Hi,

In Azure B2C is there a way to publish the new certificate in parallel with the old certificate in the metadata, so SPs have time to update before rolling over to the new certificate. We have few SP that have the x509 hard coded in config files. What is the best practice?

thank you

Microsoft Security Microsoft Entra Microsoft Entra ID
{count} votes

Accepted answer
  1. Shweta Mathur 30,296 Reputation points Microsoft Employee Moderator
    2023-09-13T06:44:48.08+00:00

    Hi @Gola, Mariusz ,

    Thanks for reaching out.

    It is possible to store multiple certificates in a policy key container, but only one will be picked up at a time.

    The keys in a keyset are not replaceable or removable. If you need to change an existing key:

    • We recommend adding a new key with the activation date set to the current date and time. Azure AD B2C will activate the new key and stop using the prior active key.

    The policy key container configures the nbf (not before) and exp (expiration) parameters based on certificate issuance and expiry dates. To enable automatic rollover, it's necessary to upload a new certificate to the same policy key container before the current certificate expires. Once the current certificate reaches its expiration date, and the key container holds a new certificate with valid nbf and exp times, the new certificate will seamlessly become active.

    Reference - https://learn.microsoft.com/en-us/azure/active-directory-b2c/policy-keys-overview?pivots=b2c-custom-policy#key-rollover

    Hope this will help.

    Thanks,

    Shweta


    Please remember to "Accept Answer" if answer helped you.


1 additional answer

Sort by: Most helpful
  1. Deepanshukatara-6769 16,565 Reputation points Moderator
    2023-09-13T05:52:34.02+00:00

    Hi , Hope doing good!

    Add the New Certificate: First, you should add the new certificate that you plan to use for token signing to your Azure AD B2C configuration.

    Configure Metadata with Both Certificates: Ensure that the metadata published by Azure AD B2C includes both the old and new certificates. This way, SPs that support metadata updates can retrieve the new certificate information.

    Notify Relying Parties: Notify your SPs about the certificate rotation and the presence of the new certificate in the metadata. Encourage them to update their configurations to include the new certificate.

    Monitor the Transition Period: Allow some time for SPs to update their configurations to include the new certificate. During this transition period, both certificates (old and new) should be valid and included in the metadata.

    Set Expiry on the Old Certificate: After a reasonable amount of time has passed and you believe most SPs have updated their configurations, you can set an expiry date on the old certificate. This effectively forces SPs to use the new certificate for token validation once the old one expires.

    1. Remove the Old Certificate: Once the old certificate has expired and you are confident that all SPs have updated their configurations, you can safely remove the old certificate from your Azure AD B2C configuration and metadata.

    This approach allows you to maintain compatibility with SPs during the transition period, especially for those that rely on the metadata for certificate information. SPs that have hard-coded the X.509 certificate in their configurations will need to update their settings manually or programmatically to use the new certificate.

    It's essential to communicate with your SPs throughout this process, providing clear instructions and timelines for the certificate rotation. Additionally, you should carefully plan and coordinate the transition to minimize disruptions to your applications and services.

    Please fine MS doc for ref:

    https://learn.microsoft.com/en-us/azure/active-directory-b2c/tokens-overview

    Also , kindly accept answer if helps, Thankyou!

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.