Import-KsCertificate

SYNOPSIS

Imports a PFX/PEM certificate file and returns X509Certificate2.

SYNTAX

Import-KsCertificate [-FilePath] <String> [[-Password] <SecureString>] [[-PrivateKeyPath] <String>]
 [<CommonParameters>]

DESCRIPTION

The Import-KsCertificate function allows you to import a certificate into the Kestrun environment. This may include loading a certificate from a file or other source and adding it to the appropriate certificate store or configuration.

EXAMPLES

EXAMPLE 1

Import-KsCertificate -Path "C:\certs\mycert.pfx" -Password (ConvertTo-SecureString "password" -AsPlainText -Force)
This example imports a certificate from the specified path using the provided password.

PARAMETERS

-FilePath

The path to the certificate file to import.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Password

The password for the certificate file, if applicable.

Type: SecureString
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PrivateKeyPath

The path to the private key file, if applicable.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Security.Cryptography.X509Certificates.X509Certificate2

NOTES

This function is part of the Kestrun PowerShell module.