gpt4 book ai didi

azure - 如何通过 Azure CLI "Import App Service Certificate"(无需 PFX 上传)

转载 作者:行者123 更新时间:2023-12-03 02:46:33 24 4
gpt4 key购买 nike

我们目前正在使用 Azure CLI 从第三方应用程序动态创建资源。

一切都很顺利,除了为我们动态创建的应用服务导入应用证书之外。

我们确实有“应用服务证书”,通过门户我们可以毫无问题地导入它。

但是,我们如何通过 Azure CLI 来实现此操作,而无需下载/上传 .PFX 文件?

是否有像下面的伪命令这样的命令?

az app service --add-app-service-certificate -subscriptionId MY_SUB -app-service MY_APP_SERVICE --certificate MY_APP_SERVICE_CERTIFICATE

这是我正在谈论的内容的屏幕截图: enter image description here

最佳答案

我假设您正在寻找一种在不使用 Azure 门户(通过 Power shell 程序)的情况下上传证书并将其绑定(bind)到 Azure Web 应用程序的方法。

您可以按照 George Chen 的建议简单地使用以下 CLI 命令:

thumbprint=$(az webapp config ssl upload --certificate-file $pfxPath \
--certificate-password $pfxPassword --name $webappname --resource-group $resourceGroup \
--query thumbprint --output tsv)

# Binds the uploaded SSL certificate to the web app.
az webapp config ssl bind --certificate-thumbprint $thumbprint --ssl-type SNI \
--name $webappname --resource-group $resourceGroup

您可以在下面的文档中详细了解该命令:

https://learn.microsoft.com/en-us/cli/azure/webapp/config/ssl?view=azure-cli-latest

请注意,证书文件需要存在于物理位置才能实现下面提到的命令的结果

**--certificate-file $pfxPath**

它采用文件的路径。因此,回答您的问题“但是我们如何通过 Azure CLI 执行此操作,而无需下载/上传 .PFX 文件?”如果不在本地下载证书文件,这是不可能的。

但是您可以简单地使用 Azure CLI 命令来导入它。

希望有帮助。

关于azure - 如何通过 Azure CLI "Import App Service Certificate"(无需 PFX 上传),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58426022/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com