Retrieve/recover 来自 Azure 应用程序网关的证书 pfx

Retrieve/recover cert pfx from Azure Application Gateway

我想要 retrieve/download 上传到我们的应用程序网关的原始 pfx 证书。

到目前为止,我已经在 PowerShell 中完成了以下操作:

$appGw = Get-AzApplicationGateway -Name "appgatewayname" -ResourceGroupName "appgatewayresourcegroup"

$certs = Get-AzApplicationGatewaySslCertificate -ApplicationGateway $appGw

$certBase64 = $certs[0].PublicCertData
$certBytes = [System.Convert]::FromBase64String($certBase64)

[io.file]::WriteAllBytes("C:\directory\newcert.pfx", $certBytes)

但是,它似乎不是有效的证书,尤其是当我尝试将它上传到我们的 KeyVault 时。

有没有人熟悉,这甚至可能吗?我应该使用数据 属性 而不是 PublicCertData 吗?

.pfx 文件上传到应用程序网关侦听器后无法检索。我检查了 Azure resource explorer,Azure 没有提供 API 来检索它。我还 double-checked 与 Azure 产品团队一起工作。

虽然看起来我们可以使用Get-AzApplicationGatewaySslCertificate PS命令来获取证书,但实际上,它只为您提供PublicCertData,没有.pfx文件的PrivateCertData。我这边也测试过,Data属性的值为空。

所以如果你想把这个.pfx文件上传到Azure KV,恐怕只能直接把原始pfx证书上传到Azure KV了。