Create certificate for Fabric secure cluster

When you’re working on CI/CD security is always important and certificates are quite useful.

Azure Service Fabric management with certificates is very easy, but creating certificate might be a bit confusing.

However, like most everything it can be easily automated with PowerShell and here’s example for you:

	 Created on:   	Jul 2017
	 Created by:   	Dmitriy Kagarlickij
		ServiceFabricRPHelpers module is from:


if ($(Test-Path -Path "C:\Service-Fabric-master") -ne $true) {
    Invoke-WebRequest -Uri -OutFile "C:\"
    Expand-Archive "C:\" -DestinationPath "C:\"
    Remove-Item -Path "C:\"

Import-Module "C:\Service-Fabric-master\Scripts\ServiceFabricRPHelpers\ServiceFabricRPHelpers.psm1"

if ($(Test-Path -Path "C:\AzureCertificates") -ne $true) {
    New-Item -ItemType Directory -Path "C:\" -Name "AzureCertificates"

Invoke-AddCertToKeyVault `
-SubscriptionId "d1b58865-90ce-447e-981d-eaca81001f58" `
-DnsName "" `
-ResourceGroupName "kag-rg1" `
-Location "westus" `
-VaultName "kag-kw1" `
-CertificateName "kagcert1" `
-Password "Password" `
-CreateSelfSignedCertificate `
-OutputPath "C:\AzureCertificates" `
| Out-File "C:\AzureCertificates\certParameters.txt"


When script is done, you’ll get everything you need:

I hope this info will be useful for you, and if you need any help feel free to use contact form on the main page.