I'm trying to use New-AzWebAppSSLBinding to upload and install a pfx ssl certificate to Azure, however, I'm getting an error:
"New-AzWebAppSSLBinding : Operation returned an invalid status code 'NotFound'".
PSVersion 5.1.14393.2515
PSEdition Desktop
BuildVersion 10.0.14393.2515
CLRVersion 4.0.30319.42000
I'm able to successfully get information about my resources via:
Get-AzResourceGroup -Name $azResourceGroup
Get-AzWebApp -Name $azWebAppName
After successfully connecting to the SPN via:
$azpsw = ConvertTo-SecureString $clientSecret -AsPlainText -Force
$pscredential = New-Object System.Management.Automation.PSCredential($appID, $azpsw)
$azConnect = Connect-AzAccount -ServicePrincipal -Credential $pscredential -TenantId $tenantID -Force
I execute the following command:
New-AzWebAppSSLBinding -ResourceGroupName $azResourceGroup -WebAppName $azWebAppName -Name $azName -CertificateFilePath $azCertPath -CertificatePassword $azCertPsw -Verbose
This results in error:
New-AzWebAppSSLBinding : Operation returned an invalid status code 'NotFound'
I was able to solve my issue by appending the -Debug parameter to New-AzWebAppSSLBinding. My hostname did not match the cert subject name.
This resulted in me setting the correct HostNames via:
Set-AzWebApp -ResourceGroupName $azResourceGroup -Name $azWebAppName -HostNames @("server_name.azurewebsites.net","server_name.my.domain.name")
The first entry has to be there, otherwise Azure PS will throw a Warning.
My issue is resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With