Skip to content

Commit 6eff4cf

Browse files
authored
Update Import-AzKeyVaultCertificate.md (#20180)
1 parent 79080ce commit 6eff4cf

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

src/KeyVault/KeyVault/help/Import-AzKeyVaultCertificate.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,46 @@ The first command uses the ConvertTo-SecureString cmdlet to create a secure pass
7979
stores it in the $Password variable.
8080
The second command imports the certificate named ImportCert01 into the CosotosoKV01 key vault.
8181

82+
### Example 2: Import a key vault certificate by CertificateString
83+
```powershell
84+
$Password = ConvertTo-SecureString -String "123" -AsPlainText -Force
85+
$Base64String = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes("import.pfx"))
86+
Import-AzKeyVaultCertificate -VaultName "ContosoKV01" -Name "ImportCert01" -CertificateString $Base64String -Password $Password
87+
88+
```
89+
90+
```output
91+
Name : importCert01
92+
Certificate : [Subject]
93+
CN=contoso.com
94+
95+
[Issuer]
96+
CN=contoso.com
97+
98+
[Serial Number]
99+
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
100+
101+
[Not Before]
102+
2/8/2016 3:11:45 PM
103+
104+
[Not After]
105+
8/8/2016 4:21:45 PM
106+
107+
[Thumbprint]
108+
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
109+
110+
Thumbprint : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
111+
Tags :
112+
Enabled : True
113+
Created : 2/8/2016 11:50:43 PM
114+
Updated : 2/8/2016 11:50:43 PM
115+
```
116+
117+
The first command uses the ConvertTo-SecureString cmdlet to create a secure password, and then
118+
stores it in the $Password variable.
119+
The second command reads a certificate as a Base64 encoded representation.
120+
The third command imports the certificate named ImportCert01 into the CosotosoKV01 key vault.
121+
82122
## PARAMETERS
83123

84124
### -CertificateCollection
@@ -256,4 +296,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
256296
257297
[Remove-AzKeyVaultCertificate](./Remove-AzKeyVaultCertificate.md)
258298
259-
[Creating and merging CSR in Key Vault](https://docs.microsoft.com/azure/key-vault/certificates/create-certificate-signing-request)
299+
[Creating and merging CSR in Key Vault](https://docs.microsoft.com/azure/key-vault/certificates/create-certificate-signing-request)

0 commit comments

Comments
 (0)