@@ -94,16 +94,33 @@ Certificate : [Subject]
94
94
[Thumbprint]
95
95
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
96
96
97
+ KeyId : https://contoso.vault.azure.net:443/keys/TestCert01/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
98
+ SecretId : https://contoso.vault.azure.net:443/secrets/TestCert01/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
97
99
Thumbprint : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
98
100
Tags :
99
101
Enabled : True
100
102
Created : 2/8/2016 11:21:45 PM
101
103
Updated : 2/8/2016 11:21:45 PM
102
104
```
103
105
104
- This command gets the certificate named TestCert01 from the key vault named ContosoKV01.
106
+ ### Example 2: Get cert and save it as pfx
107
+ This command gets the certificate named TestCert01 from the key vault named ContosoKV01. To download the certificate as pfx file, run following command. These commands access SecretId and then save the content as a pfx file.
105
108
106
- ### Example 2: Get all the certificates that have been deleted but not purged for this key vault.
109
+ ``` powershell
110
+ $cert = Get-AzKeyVaultCertificate -VaultName "ContosoKV01" -Name "TestCert01"
111
+ $secret = Get-AzKeyVaultSecret -VaultName $vaultName -Name $cert.SecretId
112
+
113
+ $secretByte = [Convert]::FromBase64String($secret.SecretValueText)
114
+ $x509Cert = new-object System.Security.Cryptography.X509Certificates.X509Certificate2
115
+ $x509Cert.Import($secretByte, "", "Exportable,PersistKeySet")
116
+ $type = [System.Security.Cryptography.X509Certificates.X509ContentType]::Pfx
117
+ $pfxFileByte = $x509Cert.Export($type, $password)
118
+
119
+ # Write to a file
120
+ [System.IO.File]::WriteAllBytes("KeyValt.pfx", $pfxFileByte)
121
+ ```
122
+
123
+ ### Example 3: Get all the certificates that have been deleted but not purged for this key vault.
107
124
``` powershell
108
125
PS C:\> Get-AzKeyVaultCertificate -VaultName 'contoso' -InRemovedState
109
126
@@ -135,7 +152,7 @@ Id : https://contoso.vault.azure.net:443/certificates/test2
135
152
136
153
This command gets all the certificates that have been previously deleted, but not purged, in the key vault named Contoso.
137
154
138
- ### Example 3 : Gets the certificate MyCert that has been deleted but not purged for this key vault.
155
+ ### Example 4 : Gets the certificate MyCert that has been deleted but not purged for this key vault.
139
156
``` powershell
140
157
PS C:\> Get-AzKeyVaultCertificate -VaultName 'contoso' -Name 'test1' -InRemovedState
141
158
@@ -178,7 +195,7 @@ Id : https://contoso.vault.azure.net:443/certificates/test1/7fe4
178
195
This command gets the certificate named 'MyCert' that has been previously deleted, but not purged, in the key vault named Contoso.
179
196
This command will return metadata such as the deletion date, and the scheduled purging date of this deleted certificate.
180
197
181
- ### Example 4 : List certificates using filtering
198
+ ### Example 5 : List certificates using filtering
182
199
``` powershell
183
200
PS C:\> Get-AzKeyVaultCertificate -VaultName "ContosoKV01" -Name "test*"
184
201
0 commit comments