This article is contributed. See the original author and article here.
How to set up new password for the cluster certificate to connect to Service Fabric Cluster in the VSTS Pipeline
This article helps you to set up new password for the cluster certificate which one can use in release pipeline to deploy your application to SF cluster.
Scenario : Adding the base-64 encoding of the client certificate file which is NOT PASSWORD protected when setting up the “New Service Fabric Connection” in the release pipeline will lead to deployment failure.
Below is the sample of the error:
“2020-10-15T20:58:45.3232533Z ##[debug]System.Management.Automation.RuntimeException: An error occurred attempting to import the certificate. Ensure that your service endpoint is configured properly with a correct certificate value and, if the certificate is password-protected, a valid password. Error message: Exception calling ‘Import’ with ‘3’ argument(s): ‘The specified network password is not correct.”
Steps to set new password for Cluster certificate:
- Download the relevant cluster certificate from the Key vault to local machine.
AzurePortal- > Key Vaults Resource -> Certificate- > Select the cluster certificate.
- Install the certificate to local machine store with marking key as exportable.
- To set up new password, follow below PowerShell Script:
a. # Retrieve the Certificate object from the certificate store
$SelfSignedCert = Get-ChildItem Cert:LocalMachineMy -DnsName “<clustername>.<clusteregion>.cloudapp.azure.com”
Note: Now the Client/ Cluster certificate is password protected, one can convert into base-64 encode(Step 4) to use in the Release pipeline
- Convert the certificate into base-64 encoded representation of the certificate using PowerShell.
Please refer to below article to Deploy an application with CI/CD to a Service Fabric cluster:
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.