1

I'm following How to add a certificate to an Azure RM website with Powershell and trying to add a certificate with the following Powershell

New-AzureRmWebAppSSLBinding -ResourceGroupName MyResource -WebAppName mysite -Name www.contoso.com -CertificateFilePath "C:\Secure\mycert.pfx" -CertificatePassword plaintextPassword 

But it's returning with

New-AzureRmWebAppSSLBinding : The specified network password is not correct.

However, if I use the Azure portal I can add the certificate successfully from the pfx file, so the password is definitely correct.

Community
  • 1
  • 1
Paul Hatcher
  • 7,342
  • 1
  • 54
  • 51

2 Answers2

1

New-AzureRmWebAppSSLBinding : The specified network password is not correct.

As far as I know, the certificate will be added via REST when we execute New-AzureRmWebAppSSLBinding cmdlet. And I could see this request details if I specify -Debug parameter for New-AzureRmWebAppSSLBinding cmdlet.

enter image description here

And if I provide an incorrect value for -CertificatePassword, It returns the same error.

enter image description here

So please check the CertificatePassword again to make sure you provide the same value (the value of Certificate password input on Azure portal) for New-AzureRmWebAppSSLBinding cmdlet.

Fei Han
  • 26,415
  • 1
  • 30
  • 41
0

I know this is dated. However for anyone else that runs into the issue try the following.

-CertificatePassword "PlainTextPassword"

Don't forget to add the quotes.

To take it a step further, for the sake of security, you can pass in your certificate password via keyvault.

$vaultname = "keyvault"
$secrectname = "keyvaultsecret"
$resourcegroup = "resourcegroupname"
$webappname = "webappname"
$hostname = "example.com"

$secretsecurestring = Get-AzureKeyVaultSecret - 
VaultName $vaultname -Name $secretname
$pfxpass = $secretsecurestring.SecretValueText

New-AzureRmWebAppSSLBinding -ResourceGroupName 
$resourcegroup -WebAppName $webappname - 
CertificateFilePath C:\Certificate.pfx - 
CertificatePassword $pfxpass -Name $hostname