The Import-AzKeyVaultCertificate cmdlet imports a certificate into a key vault.
You can create the certificate to import by using one of the following methods:
The first command uses the ConvertTo-SecureString cmdlet to create a secure password, and then
stores it in the $Password variable.
The second command imports the certificate named ImportCert01 into the ContosoKV01 key vault.
Example 2: Import a key vault certificate by CertificateString
The first command uses the ConvertTo-SecureString cmdlet to create a secure password, and then
stores it in the $Password variable.
The second command reads a certificate as a Base64 encoded representation.
The third command imports the certificate named ImportCert01 into the ContosoKV01 key vault.
Example 3: Import a key vault certificate with PolicyFile
Name : importCert01
Certificate : [Subject]
CN=contoso.com
[Issuer]
CN=contoso.com
[Serial Number]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Not Before]
2/8/2016 3:11:45 PM
[Not After]
8/8/2016 4:21:45 PM
[Thumbprint]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
KeyId : https://ContosoKV01.vault.azure.net/keys/ImportCert01/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SecretId : https://ContosoKV01.vault.azure.net/secrets/ImportCert01/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Thumbprint : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Policy :
Secret Content Type: application/x-pkcs12
Issuer Name : Unknown
Created On : 3/22/2023 6:00:52 AM
Updated On : 4/27/2023 9:52:53 AM
...
RecoveryLevel : Recoverable+Purgeable
Enabled : True
Expires : 6/9/2023 6:20:26 AM
NotBefore : 3/11/2023 6:20:26 AM
Created : 4/24/2023 9:05:51 AM
Updated : 4/24/2023 9:05:51 AM
Tags : {}
VaultName : ContosoKV01
Name : ImportCert01
Version : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Id : https://ContosoKV01.vault.azure.net/certificates/ImportCert01/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The first command uses the ConvertTo-SecureString cmdlet to create a secure password, and then
stores it in the $Password variable.
The second command imports the certificate named ImportCert01 into the ContosoKV01 key vault with
a policy defined by file.
Parameters
-CertificateCollection
Specifies the certificate collection to add to a key vault.
Specifies the certificate name. This cmdlet constructs the fully qualified ___domain name (FQDN) of a
certificate from key vault name, currently selected environment, and certificate name.
Specifies the key vault name into which this cmdlet imports certificates.
This cmdlet constructs the fully qualified ___domain name (FQDN) of a key vault based on the name and currently selected environment.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.