This file contains hidden or 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
| # Code sample from: https://docs.microsoft.com/en-us/powershell/module/az.keyvault/get-azkeyvaultcertificate?view=azps-4.6.1#example-2--get-cert-and-save-it-as-pfx | |
| # Accessed 9/10/2020 | |
| $cert = Get-AzKeyVaultCertificate -VaultName "ContosoKV01" -Name "TestCert01" | |
| $secret = Get-AzKeyVaultSecret -VaultName $vaultName -Name $cert.Name | |
| $secretByte = [Convert]::FromBase64String($secret.SecretValueText) | |
| # This will fail with the following error in PowerShell Core: | |
| # MethodInvocationException: Exception calling "Import" with "3" argument(s): "X509Certificate is immutable on this platform. Use the equivalent constructor instead." |