[英]How to “Import App Service Certificate” through Azure CLI (without PFX upload)
We are currently using Azure CLI in order to create resources dynamically from a third party application.我们目前正在使用 Azure CLI 以便从第三方应用程序动态创建资源。
Everything goes well, except for importing an app certificate for our dynamically created app service.一切顺利,除了为我们动态创建的应用服务导入应用证书。
We do have an "App Service Certificate", and through the portal we can import it without any problem.我们确实有一个“应用服务证书”,通过门户我们可以毫无问题地导入它。
But how can we do this through Azure CLI WITHOUT having to download/upload a .PFX
file?但是我们如何通过 Azure CLI 做到这一点,而无需下载/上传.PFX
文件?
Is there some command like the following pseudo-command?是否有类似以下伪命令的命令?
az app service --add-app-service-certificate -subscriptionId MY_SUB -app-service MY_APP_SERVICE --certificate MY_APP_SERVICE_CERTIFICATE
Here's a screen shot of what I'm talking about:这是我正在谈论的屏幕截图:
I am assuming you are looking for a way to upload and bind the certificate to your azure web app without using Azure portal(By Power shell program). I am assuming you are looking for a way to upload and bind the certificate to your azure web app without using Azure portal(By Power shell program).
you can simply use below CLI command as suggested by George Chen:您可以按照 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
You can read about the command in detail in below doc:您可以在下面的文档中详细了解该命令:
https://docs.microsoft.com/en-us/cli/azure/webapp/config/ssl?view=azure-cli-latest https://docs.microsoft.com/en-us/cli/azure/webapp/config/ssl?view=azure-cli-latest
Please be informed that Certificate files needs to be present at physical location for achieving the result as the command mentioned below请注意,证书文件需要存在于物理位置才能达到下面提到的命令的结果
**--certificate-file $pfxPath**
It takes the path of the file.它采用文件的路径。 SO to answer your question " But how can we do this through Azure CLI WITHOUT having to download/upload a.PFX file? " Without downloading the cert file in local, it is not possible.所以回答你的问题“但是我们如何通过 Azure CLI 做到这一点而无需下载/上传.PFX 文件?”如果不下载本地证书文件,这是不可能的。
But you can simply use Azure CLI command to import it.但是您可以简单地使用 Azure CLI 命令来导入它。
Hope it helps.希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.