Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions src/KeyVault/KeyVault/help/Get-AzKeyVaultCertificate.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,16 @@ Created : 2/8/2016 11:21:45 PM
Updated : 2/8/2016 11:21:45 PM
```

This command gets the certificate named `TestCert01` from the key vault named `ContosoKV01`

### Example 2: Get cert and save it as pfx
```powershell
$cert = Get-AzKeyVaultCertificate -VaultName $vaultName -Name $certName
$secret = Get-AzKeyVaultSecret -VaultName $vaultName -Name $cert.Name -AsPlainText
# Write to a file
Set-Content -Path cert.pfx -Value $secret -PassThru
```

```output
-----BEGIN PRIVATE KEY-----
******************************
-----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
******************************
-----END CERTIFICATE-----
$CertBase64 = Get-AzKeyVaultSecret -VaultName $vaultName -Name $certName -AsPlainText
$CertBytes = [Convert]::FromBase64String($CertBase64)
Set-Content -Path cert.pfx -Value $CertBytes -AsByteStream
```

This command gets the certificate named `$certName` from the key vault named `$vaultName`. These commands access secret `$cert.Name` and then save the content as a pfx file.
This command gets the certificate named `$certName` from the key vault named `$vaultName`. These commands access secret `$certName` and then save the content as a pfx file.

### Example 3: Get all the certificates that have been deleted but not purged for this key vault.
```powershell
Expand Down