我正在尝试使用New-AzWebAppSSLBinding
上传pfx ssl证书并将其安装到Azure,但是,我遇到了错误:
"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
我能够通过以下方式成功获取有关我的资源的信息:
Get-AzResourceGroup -Name $azResourceGroup
Get-AzWebApp -Name $azWebAppName
通过以下方式成功连接到SPN后:
$azpsw = ConvertTo-SecureString $clientSecret -AsPlainText -Force
$pscredential = New-Object System.Management.Automation.PSCredential($appID, $azpsw)
$azConnect = Connect-AzAccount -ServicePrincipal -Credential $pscredential -TenantId $tenantID -Force
我执行以下命令:
New-AzWebAppSSLBinding -ResourceGroupName $azResourceGroup -WebAppName $azWebAppName -Name $azName -CertificateFilePath $azCertPath -CertificatePassword $azCertPsw -Verbose
这会导致错误:
New-AzWebAppSSLBinding : Operation returned an invalid status code 'NotFound'
答案 0 :(得分:0)
我可以通过将-Debug
参数附加到New-AzWebAppSSLBinding来解决我的问题。我的主机名与证书主题名称不匹配。
这导致我通过以下方式设置了正确的主机名:
Set-AzWebApp -ResourceGroupName $azResourceGroup -Name $azWebAppName -HostNames @("server_name.azurewebsites.net","server_name.my.domain.name")
第一项必须存在,否则Azure PS会发出警告。
我的问题已解决。