简体   繁体   English

如何通过 Azure CLI “导入应用服务证书”(无 PFX 上传)

[英]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.

相关问题 在Mac上将Azure应用服务证书导出为.pfx - Export Azure App Service Certificate as .pfx on Mac Azure - Key Vault 中的应用服务证书为空白 - 无法使用 powershell / az cli 下载 pfx - Azure - App Service Certificate in Key Vault is blank - Unable to download the pfx using powershell / az cli Azure 应用服务无法从 wwwroot 文件系统加载 pfx 证书 - An Azure App Service cannot load a pfx certificate from the wwwroot filesystem Azure应用程序网关无法上载pfx证书 - Azure Application gateway cannot upload pfx certificate 由于权限问题,无法通过Azure门户将应用程序服务证书(ASC)导入Azure Web-app - Cannot import app service certificate (ASC) to Azure web-app through Azure portal due to permissions issue 如何导出当前的Azure App Service证书并导入到其他订阅 - How to Export a current Azure App Service Certificate and import to a different subscription 如何使用Powershell导入Azure应用服务的证书 - How to import certificate for Azure app service using Powershell Azure webapp ssl证书pfx没有密码 - Azure webapp ssl certificate pfx without password Azure 应用服务无法验证 .pfx 文件:证书验证失败,因为无法加载 - Azure App Service unable to validate .pfx file: Certificate failed validation because it could not be loaded Azure 应用服务证书导出为 PFX 时有什么密码? 有可能改变它吗? - What password does an Azure App Service Certificate have when exported as PFX? Is it possible to change it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM