Created
February 14, 2017 13:24
-
-
Save marrobi/12587f8ef038a53103fd976c83651054 to your computer and use it in GitHub Desktop.
Encode PFX as Base64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# path to file | |
$fileName = "C:\tmp\mycert.pfx" | |
# get content of the file as Byte | |
$fileContentBytes = get-content $fileName -Encoding Byte | |
# convert to Base64 | |
$fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes) | |
# convert to secure string | |
$secret = ConvertTo-SecureString -String $filecontentencoded -AsPlainText -Force | |
# store the secret in KeyVault | |
Set-AzureKeyVaultSecret -VaultName $vaultName -Name $certificateName -SecretValue $secret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment