Skip to main content

Notifications

On-premises certificate rotation

In this post I would like to share field experience on the certificate rotation process for D365 FO on-premises to help prepare for the process. Before you begin the certificates rotation, you need make sure that you are running the process on the supported Service Fabric cluster. Certificate rotation process is well-documented here. Always make sure to always follow the mentioned article as some parts of process may change (e.g. Supported service fabric cluster version).

Preparation steps:

Once you obtained your certificates it is always a good practice to validate if new certs match the expiring certificates. Always double check provider types against deployment documentation. Preparation steps are described here.  The process is very similar to On-premises deployment preparation. Always download the most recent setup scripts from LCS (https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/deployment/setup-deploy-on-premises-pu12#downloadscripts). Unzip the files into the infrastructure folder. When we installed the D365 On-premises we used one of the AOS nodes (AOS1) as the starting point for infrastructure folder and config files. For the certificate rotation we used another node (AOS2) as a starting point, and this is where we unzipped infrastructure scripts into.

Next steps:

  • Copy old config-template and cluster config into new infrastructure folder
  • Import certificates to the corresponding cluster nodes

0753.importCerts.png

  • Edit config-template capturing new certificates thumbprints
  • Run 
    .\Export-PfxFiles.ps1 -ConfigurationFilePath .\ConfigTemplate.xml
     to export new certificates

  • Continue with VM setup 
  • Export scripts that will be run on each vm 
    .\Export-Scripts.ps1 -ConfigurationFilePath .\ConfigTemplate.xml

1488.Export-Scripts.png

6835.Encrypt-credentials.png

  • It is always a good practice to verify encrypted credentials

5100.DecryptCredentials.png

  • Get deployment settings.
    .\Get-DeploymentSettings.ps1 -ConfigurationFilePath .\ConfigTemplate.xml

 

Activate Service fabric certificates (not expired)

The process is described here.

Service fabric cluster should be displaying warning message when SF certificates are close to expiration dates;

5265.SF_2D00_BeforeRotation.png

  • Update clusterconfig.json adding lines for New certificates thumbprints

1602.ClusterConfig_2D00_Certs.png

  • Change clusterConfigurationVersion to a new version

2234.ClusterConfig_2D00_Header.png

  • Save updated configuration files and run the powershell commands from one of the SF nodes that contains clusterconfig.json

 

Connect-ServiceFabricCluster
#To start Cluster upgrade
Start-ServiceFabricClusterConfigurationUpgrade -ClusterConfigPath ClusterConfig.json
Update-ServiceFabricClusterUpgrade -UpgradeReplicaSetCheckTimeoutSec 30 #if running a single SQL Server Reporting services node
Get-ServiceFabricClusterUpgrade #will show upgrade status
 

  •  Service fabric will be showing the upgrade status

7840.SfUpgrade.png

  • Nodes that are showing warnings are pending upgrade

5123.SF_2D00_rotate_2D00_nodes.png

  • You can also see the current upgrade progress in the service fabric explorer

 7024.SF_2D00_DuringUpgrade_2D00_Header.png

Get-ServiceFabricClusterUpgrade
 will return upgrade status as “RollingForwardCompleted” once configuration upgrade is finished.

 1104.get_2D00_upgrade_2D00_Complete.png

Service fabric cluster is upgraded. You can now try to open service fabric explorer using new service fabric client certificate.

 0624.SF_2D00_UpgradeComplete.png

Update LocalAgent Certificate

LocalAgent must be reinstalled if Service Fabric cluster/Service certificate or SF Client certificate or local agent certificate. Steps to update localagent

  • Update localagent-config.json using new serverCertThumbprint and clientCertThumbprint.
  • Run .\LocalAgentCLI.exe Cleanup <path of localagent-config.json> to remove local agent

2626.cleanupLocalAgent.png

Update current deployment settings

Follow the steps to update current deployment configuration as servicing may fail on the cleanup.

Update deployment configuration and LCS settings

Follow the steps to update current deployment configuration as cleanup job may fail during the deployment .Once deployment configuration is updated you can proceed with updating deployment settings in LCS. You will need to update deployment settings with new certificate thumbprints.

0880.LCSSettings_2D00_Update.png

Once preparation is complete you can start the LCS update during which the environment will be unavailable.

Note:

If you are planning to run the process on the old version of service fabric or the version which is not supported – service fabric cluster configuration update may fail. In such cases it may be easier/faster to recreate service fabric cluster or remove all applications and upgrade the cluster prior to rotation. 

Comments

*This post is locked for comments

  • MODISH Profile Picture MODISH 5
    Posted at
    After certification rotation and all certificates were updated, users on the client's domain cannot login. What i noticed is that if there are off their domain network (using a personal network), it connects but as soon as they are connected on their domain network, it doesn't go past the ADFS authentication page. Please help.
  • TechMonkey Profile Picture TechMonkey 20
    Posted at
    edm-msft Eugene! Before starting the upgrade, I like to/recommend testing the new config file in conjunction with the old file. It saves a fair bit of grief. (Sorry I can't find any info on how to format comments, and can't edit after it's posted) `>Test-ServiceFabricConfiguration -ClusterConfigurationFilePath "C:\path\to\newconfig2.0.json" -OldClusterConfigurationFilePath "c:\path\to\oldconfig1.5.json"`
  • Oleksandr Nikolaiev Profile Picture Oleksandr Nikolaiev 1
    Posted at
    Thank you, Eugene. This tutorial is very helpful. In my case, I recreated certs and redeployed the SF cluster. It was done without issues.