< Back

Import-AzureKeyVaultCertificate

Tue Jan 29, 2019 9:50 pm

NAME Import-AzureKeyVaultCertificate



SYNOPSIS

Imports a certificate to a key vault.





SYNTAX

Import-AzureKeyVaultCertificate [-VaultName] <String> [-Name] <String> [-CertificateCollection] <X509Certificate2Collection> [-DefaultProfile

<IAzureContextContainer>] [-Tag <Hashtable>] [-Confirm] [-WhatIf] [<CommonParameters>]



Import-AzureKeyVaultCertificate [-VaultName] <String> [-Name] <String> -CertificateString <String> [-DefaultProfile <IAzureContextContainer>]

[-Password <SecureString>] [-Tag <Hashtable>] [-Confirm] [-WhatIf] [<CommonParameters>]



Import-AzureKeyVaultCertificate [-VaultName] <String> [-Name] <String> [-DefaultProfile <IAzureContextContainer>] -FilePath <String> [-Password

<SecureString>] [-Tag <Hashtable>] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Import-AzureKeyVaultCertificate cmdlet imports a certificate into a key vault.



You can create the certificate to import by using one of the following methods:



- Use the New-AzureKeyVaultCertificateSigningRequest cmdlet to create a certificate signing request and submit it to a certificate authority.



- Use an existing certificate package file, such as a .pfx or .p12 file, which contains both the certificate and private key.





PARAMETERS

-CertificateCollection <X509Certificate2Collection>

Specifies the certificate collection to add to a key vault.



Required? true

Position? 2

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-CertificateString <String>

Specifies a certificate string.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-FilePath <String>

Specifies the path of the certificate file that this cmdlet imports.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

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.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Password <SecureString>

Specifies the password for a certificate file.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Tag <Hashtable>

Key-value pairs in the form of a hash table. For example:



@{key0="value0";key1=$null;key2="value2"}



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VaultName <String>

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.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificate







NOTES









Example 1: Import a key vault certificate



PS C:\\>$Password = ConvertTo-SecureString -String "123" -AsPlainText -Force

PS C:\\> Import-AzureKeyVaultCertificate -VaultName "ContosoKV01" -Name "ImportCert01" -FilePath "C:\\Users\\contosoUser\\Desktop\\import.pfx"

-Password $Password

Name : importCert01

Certificate : [Subject]

CN=contoso.com



[Issuer]

CN=contoso.com



[Serial Number]

05979C5A2F0741D5A3B6F97673E8A118



[Not Before]

2/8/2016 3:11:45 PM



[Not After]

8/8/2016 4:21:45 PM



[Thumbprint]

3E9B6848AD1834284157D68B060F748037F663C8



Thumbprint : 3E9B6848AD1834284157D68B060F748037F663C8

Tags :

Enabled : True

Created : 2/8/2016 11:50:43 PM

Updated : 2/8/2016 11:50:43 PM



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 CosotosoKV01 key vault.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ertificate

Remove-AzureKeyVaultCertificate