如何将SSL证书添加到中使用PowerShell蔚蓝的网站? [英] How to add an SSL certificate to an azure website using powershell?
问题描述
我工作的自动部署+天蓝色。我在那里我添加SSL证书的网站点。有谁知道如何使用PowerShell上传SSL证书使用PowerShell命令一个网站(添加 - 获取 - 基于集合的命令)?我能够使用证书添加到云服务...
新AzureService $计划-Location东美
附加AzureCertificate -Password Cert123! -ServiceName $计划-CertToDeploy $ CertLocation
但我不知道如何将它添加到蔚蓝色的网站。
感谢
编辑:我发现使用以下命令的方式,但我不希望我的生产部署机器上安装额外的库
蔚蓝网站证书添加-k Cert123! $ CertLocation $计划
据我所知在Azure PowerShell命令并不在我能找到的时刻提供这种功能。正如你指出的跨平台命令行工具一样。既然你不想给XPlat-CLI工具添加到您可以使用引擎盖下的XPlat-CLI工具做了什么部署机器:对REST API的网站管理直接调用。
请注意,你需要找出网络空间网站驻留在等,你可以使用Invoke-WebRequest的拨打这个电话,让你可以验证你得到200回响应。或者你可以使用Invoke-RESTMethod为好,但只会返回一个XML文档(响应的内容)。将Invoke-WebRequest的为您提供多一点的控制和访问完整的响应对象。
借助微软Azure管理库(其中PowerShell命令坐在上面的)有一个网站管理一块吧。之一的操作的是一个更新到一个站点和包括WebSiteUpdateParameters与SSLCertificates属性对象。您可以检查到该为好,虽然我不是这个做自己所。
I am working on automatic deployment + azure. I'm at the point where i'm adding an ssl cert to the website. Does anyone know how to use PowerShell to upload an SSL certificate to a website using the PowerShell command (Add - Get - Set based commands)? I'm able to add a certificate to a cloud service using ...
New-AzureService $Program -Location 'East US'
Add-AzureCertificate -Password Cert123! -ServiceName $Program -CertToDeploy $CertLocation
but I have no idea how to add it to an azure website.
Thanks
edit: I've found a way using the following command, but i'm not wanting to install additional libraries on my production deployment machine.
azure site cert add -k Cert123! $CertLocation $Program
As far as I know the Azure PowerShell cmdlets do not offer this capability at the moment that I could find. As you point out the Cross Platform Command Line tool does. Since you don't want to add the XPlat-CLI tool to your deployment machines you can use what the XPlat-CLI tool does under the hood: a direct call against the REST api for web site management.
Note you'll need to figure out what webspace the site resides in, etc. You can use the Invoke-WebRequest to make this call so that you can verify you get that 200 response back. Or you could use the Invoke-RESTMethod as well, but that would only return an XML document (the contents of the response). The Invoke-WebRequest provides you a little more control and access to the full response object.
The Microsoft Azure Management Libraries (which the PowerShell cmdlets sit on top of) has a Web Site Management piece to it. One of the operations is an update to a site and that includes a WebSiteUpdateParameters object with a SSLCertificates property. You may check into that as well, though I've not done this myself.
这篇关于如何将SSL证书添加到中使用PowerShell蔚蓝的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!