Add-AzApplicationGatewaySslCertificate

Adds an SSL certificate to an application gateway.

Syntax

Add-AzApplicationGatewaySslCertificate
   -ApplicationGateway <PSApplicationGateway>
   -Name <String>
   [-CertificateFile <String>]
   [-Password <SecureString>]
   [-KeyVaultSecretId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Add-AzApplicationGatewaySslCertificate cmdlet adds an SSL certificate to an application gateway.

Examples

Example 1: Add an SSL certificate using pfx to an application gateway.

$AppGW = Get-AzApplicationGateway -Name "ApplicationGateway01" -ResourceGroupName "ResourceGroup01"
$password = ConvertTo-SecureString $passwordPlainString -AsPlainText -Force
$AppGW = Add-AzApplicationGatewaySslCertificate -ApplicationGateway $AppGW -Name "Cert01" -CertificateFile "D:\cert01.pfx" -Password $password

This command gets an application gateway named ApplicationGateway01 and then adds an SSL certificate named Cert01 to it.

Example 2: Add an SSL certificate using KeyVault Secret (version-less secretId) to an application gateway.

$AppGW = Get-AzApplicationGateway -Name "ApplicationGateway01" -ResourceGroupName "ResourceGroup01"
$secret = Get-AzKeyVaultCertificate -VaultName "keyvault01" -Name "sslCert01"
$secretId = $secret.Id.Replace($secret.Version, "") # https://<keyvaultname>.vault.azure.net/secrets/
$AppGW = Add-AzApplicationGatewaySslCertificate -ApplicationGateway $AppGW -Name "Cert01" -KeyVaultSecretId $secretId

Get the secret and reference it in the Add-AzApplicationGatewaySslCertificate to add it to the Application Gateway with name Cert01. Note: As version-less secretId is provided here, Application Gateway will sync the certificate in regular intervals with the KeyVault.

Example 3: Add an SSL certificate using KeyVault Secret (versioned secretId) to an application gateway.

$AppGW = Get-AzApplicationGateway -Name "ApplicationGateway01" -ResourceGroupName "ResourceGroup01"
$secret = Get-AzKeyVaultCertificate -VaultName "keyvault01" -Name "sslCert01"
$secretId = $secret.Id # https://<keyvaultname>.vault.azure.net/secrets/<hash>
$AppGW = Add-AzApplicationGatewaySslCertificate -ApplicationGateway $AppGW -Name "Cert01" -KeyVaultSecretId $secretId

Get the secret and reference it in the Add-AzApplicationGatewaySslCertificate to add it to the Application Gateway with name Cert01. Note: If it is required that Application Gateway syncs the certificate with the KeyVault, please provide the version-less secretId.

Parameters

-ApplicationGateway

Specifies the name of application gateway to which this cmdlet adds an SSL certificate.

Type:PSApplicationGateway
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-CertificateFile

Specifies the .pfx file of an SSL certificate that this cmdlet adds.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-KeyVaultSecretId

SecretId (uri) of the KeyVault Secret. Use this option when a specific version of secret needs to be used.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the SSL certificate that this cmdlet adds.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Password

Specifies the password of the SSL certificate that this cmdlet adds.

Type:SecureString
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSApplicationGateway

Outputs

PSApplicationGateway