【问题标题】:New-AzureRmWebAppSSLBinding - The specified network password is not correctNew-AzureRmWebAppSSLBinding - 指定的网络密码不正确
【发布时间】:2017-01-14 11:47:20
【问题描述】:
我正在关注How to add a certificate to an Azure RM website with Powershell 并尝试使用以下 Powershell 添加证书
New-AzureRmWebAppSSLBinding -ResourceGroupName MyResource -WebAppName mysite -Name www.contoso.com -CertificateFilePath "C:\Secure\mycert.pfx" -CertificatePassword plaintextPassword
但它会返回
New-AzureRmWebAppSSLBinding : The specified network password is not correct.
但是,如果我使用 Azure 门户,我可以从 pfx 文件中成功添加证书,所以密码肯定是正确的。
【问题讨论】:
标签:
azure-web-app-service
azure-resource-manager
azure-powershell
【解决方案1】:
New-AzureRmWebAppSSLBinding : 指定的网络密码不正确。
据我所知,the certificate will be added via REST 当我们执行 New-AzureRmWebAppSSLBinding cmdlet 时。如果我为 New-AzureRmWebAppSSLBinding cmdlet 指定 -Debug 参数,我可以看到此请求详细信息。
如果我为 -CertificatePassword 提供了不正确的值,它会返回相同的错误。
所以请再次检查 CertificatePassword 以确保您为 New-AzureRmWebAppSSLBinding cmdlet 提供相同的值(在 Azure 门户上输入的证书密码的值)。
【解决方案2】:
我知道这已经过时了。但是,对于遇到此问题的其他任何人,请尝试以下操作。
-CertificatePassword "PlainTextPassword"
别忘了加上引号。
更进一步,为了安全起见,您可以通过 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