Scripts/Update-FpsCertificate.ps1
# This script installs a certificate, inherits permissions from the previous certificate, # and reconfigures Business Central ServerInstances and IIS Websites where the last certificate is used. # Import Module Install-Module FpsBcDeployment -Force Import-Module FpsBcDeployment -Force # Parameters $CertFilePath = '' # E.g. 'C:\4PS Install\[certificate].pfx' $CertPassword = '' # Plain-text password (not recommended to save to disk) $CertToReplaceThumbprint = '' # E.g. '008CEE1FEA5RANDOM2AF4F603EBPRINTBB0341D1' $CertStorePath = 'cert:\LocalMachine\My' $CertSubjectFilter = '*myBcCertificate*' # Get current deployed certificates Get-FpsCertificate -CertStorePath $CertStorePath -SubjectFilter $CertSubjectFilter # Update the certificate in Microsoft Certificate Store and update the thumbprints on BC ServerInstances + IIS Web Site Bindings. $arguments = @{ 'CertFilePath' = $CertFilePath 'CertPassword' = $CertPassword | ConvertTo-SecureString -AsPlainText -Force 'CertToReplaceThumbprint' = $CertToReplaceThumbprint 'CertStorePath' = $CertStorePath 'RemovePreviousCert' = $false 'AutoRestartServices' = $true } Update-FpsCertificate @arguments |