Home > Net >  Building an Azure Application Gateway with SSL termination using PowerShell - Can anyone get this to
Building an Azure Application Gateway with SSL termination using PowerShell - Can anyone get this to

Time:01-27

Trying to build an Azure Application Gateway using the following instructions and cannot get it to build without an exception stating that the certificate referenced by the listener cannot be found

https://learn.microsoft.com/en-us/azure/application-gateway/tutorial-ssl-powershell

Can anyone get this to work?

I have tried following the instructions verbatim and it will not work. I can build an Application Gateway without SSL, but not with SSL as described in Microsoft's TLS Termination How-To guide.

CodePudding user response:

@DusDee had the best advice on debugging this! This is now working and integrated with the rest of my scripts. Check the certificate data and make sure it's valid.

CodePudding user response:

The error experienced was because when running New-AzApplicationGatewaySslCertificate, this command can fail for a few reasons:

  • Incorrect PFX password
  • Invalid certificate data

If you assigned this to a variable called $sslCert, trying to evaluate its value when the command fails will return an empty result which is both 'falsey' and not a PSApplicationGatewaySslCertificate object which is what the New-AzApplicationGatewayHttpListener command requires when configuring an HTTPS listener.

This causes the deployment to fail because the listener is referencing a non-existant certificate since it was passed as an empty variable.

  • Related