Skip to content

Instantly share code, notes, and snippets.

@matejskubic
Last active April 9, 2024 03:59
Show Gist options
  • Save matejskubic/1cf5f24a7c1d9ec45daaed49314879ac to your computer and use it in GitHub Desktop.
Save matejskubic/1cf5f24a7c1d9ec45daaed49314879ac to your computer and use it in GitHub Desktop.
Renew Self Signed certificate

To rotate certificates on machines created from the Dynamics 365 for Finance and Operations downloadable VHD, complete the following steps for each certificate. Sample PowerShell scripts are provided where applicable.

  1. Identify which certificates will expire in the next two months.

    Get-ChildItem -path Cert:\LocalMachine\My | Where {$_.NotAfter -lt $(get-date).AddMonths(2)} | Sort NotAfter | Format-Table Subject, Thumbprint, NotAfter

  2. Record the thumbprint of the certificate that needs to be replaced. You will need this in the next step.

  3. Obtain a new certificate for the expired certificate.

    Set-Location -Path "cert:\LocalMachine\My" $OldCert = (Get-ChildItem -Path ) New-SelfSignedCertificate -CloneCert $OldCert

Note: The thumbprint must be entered without spaces. For more information and an example, see the New-SelfSignedCertificate Powershell documentation.

  1. Find and replace all references to the thumbprint of the expired certificate with the thumbprint of the newly created certificate in the configuration files below. These files can be found under C:\AOSService\webroot.
  • web.config
  • wif.config
  • wif.services.config
  1. Restart the IIS.

    iisreset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment