Skip to content

Commit acac8fe

Browse files
authored
Merge pull request #47505 from Joseph51D/patch-1
Update service-fabric-powershell-add-application-certificate.md
2 parents 74a585b + 8417664 commit acac8fe

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

articles/service-fabric/scripts/service-fabric-powershell-add-application-certificate.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
title: Add application cert to a cluster in Powershell
33
description: Azure PowerShell Script Sample - Add an application certificate to a Service Fabric cluster.
44
services: service-fabric
@@ -44,9 +44,7 @@ $CertName= ""
4444
$CertPassword= ""
4545
$PathToPFX= ""
4646
47-
$Cert = new-object System.Security.Cryptography.X509Certificates.X509Certificate2 $PathToPFX, $CertPassword
48-
49-
$bytes = [System.IO.File]::ReadAllBytes($ExistingPfxFilePath)
47+
$bytes = [System.IO.File]::ReadAllBytes($PathToPFX)
5048
$base64 = [System.Convert]::ToBase64String($bytes)
5149
$jsonBlob = @{
5250
data = $base64
@@ -70,7 +68,12 @@ $ResourceGroupName = ""
7068
$VMSSName = ""
7169
$CertStore = "My" # Update this with the store you want your certificate placed in, this is LocalMachine\My
7270
71+
# If you have added your certificate to the keyvault certificates, use
7372
$CertConfig = New-AzVmssVaultCertificateConfig -CertificateUrl (Get-AzKeyVaultCertificate -VaultName $VaultName -Name $CertName).SecretId -CertificateStore $CertStore
73+
74+
# Otherwise, if you have added your certificate to the keyvault secrets, use
75+
$CertConfig = New-AzVmssVaultCertificateConfig -CertificateUrl (Get-AzKeyVaultSecret -VaultName $VaultName -Name $CertName).Id -CertificateStore $CertStore
76+
7477
$VMSS = Get-AzVmss -ResourceGroupName $ResourceGroupName -VMScaleSetName $VMSSName
7578
7679
# If this KeyVault is already known by the virtual machine scale set, for example if the cluster certificate is deployed from this keyvault, use
@@ -94,7 +97,8 @@ This script uses the following commands: Each command in the table links to comm
9497
| Command | Notes |
9598
|---|---|
9699
| [New-AzKeyVaultCertificatePolicy](/powershell/module/az.keyvault/New-AzKeyVaultCertificatePolicy) | Creates an in-memory policy representing the certificate |
97-
| [Add-AzKeyVaultCertificate](/powershell/module/az.keyvault/Add-AzKeyVaultCertificate)| Deploys the policy to Key Vault |
100+
| [Add-AzKeyVaultCertificate](/powershell/module/az.keyvault/Add-AzKeyVaultCertificate)| Deploys the policy to Key Vault Certificates |
101+
| [Set-AzKeyVaultSecret](/powershell/module/az.keyvault/Set-AzKeyVaultSecret)| Deploys the policy to Key Vault Secrets |
98102
| [New-AzVmssVaultCertificateConfig](/powershell/module/az.compute/New-AzVmssVaultCertificateConfig) | Creates an in-memory config representing the certificate in a VM |
99103
| [Get-AzVmss](/powershell/module/az.compute/Get-AzVmss) | |
100104
| [Add-AzVmssSecret](/powershell/module/az.compute/Add-AzVmssSecret) | Adds the certificate to the in-memory definition of the virtual machine scale set |

0 commit comments

Comments
 (0)