hi GIRISH PAI
Apologies for the delay
To add multiple listeners, you can loop through your listeners and backend settings using a script like this: please try this above script do let me know if it works:
# Load the Application Gateway
$appgw = Get-AzApplicationGateway -ResourceGroupName "<ResourceGroup>" -Name "<AppGatewayName>"
# Secure password for the new certificate
$password = ConvertTo-SecureString -String "<password>" -Force -AsPlainText
# Define the new certificate path
$certPath = "<PathToNewPfx>"
# List of SSL certificate names to update
$sslCertNames = @("cert1", "cert2", "cert3", "cert4", "cert5", "cert6", "cert7", "cert8", "cert9", "cert10")
foreach ($certName in $sslCertNames) {
Set-AzApplicationGatewaySslCertificate -ApplicationGateway $appgw `
-Name $certName `
-CertificateFile $certPath `
-Password $password
}
# Commit the changes
Set-AzApplicationGateway -ApplicationGateway $appgw
You have 10 SSL certificates named consistently (e.g., cert1 to cert10).
All certificates are being replaced with the same .pfx file and password. If each has a different file, you can use a hashtable instead.