VSTS IIS Deploy配置IIS站点SSL证书 [英] VSTS IIS Deploy Configure IIS site SSL Certificates

查看:91
本文介绍了VSTS IIS Deploy配置IIS站点SSL证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VSTS通过IIS Web App Manage和IIS Web App Deploy任务部署可运行的asp.net网站,但是我正在寻找自动安装和配置站点SSL证书的方法,以便在主机上部署站点之前,不必手动安装ssl证书.

I'm using VSTS to deploy an asp.net website using the IIS Web App Manage and IIS Web App Deploy tasks which works however I'm looking at ways to automate the installation and configuration of the sites SSL certificate so that I don't have to manually install the ssl cert before deploying the site on the host machine.

我正在考虑使用以下方法.

I'm considering using the following approach.

1)在vs解决方案中包含ssl证书.

1) Include the ssl certificate in the vs solution.

2)将ssl证书作为站点部署的一部分进行部署,并使用 远程Powershell任务以运行"CertMgr"以将证书安装在 localmachines个人证书存储.

2) Deploy the ssl certificate as part of the site deploy and use the remote powershell task to run 'CertMgr' to install the certificate in the localmachines personal certificate store.

在理想的情况下,我想将SSL证书作为VSTS中的deploy定义的一部分包括在内,但是我看不到这种选择吗?在我了解VS解决方案路由之前,是否可以配置VSTS部署任务以在远程目标计算机上下载并安装SSL证书?

In an ideal world I'd like to include the SSL certificate as part of the deploy definition in VSTS but I couldn't see an option for this? Before I go down the VS solution route is there away to configure VSTS deploy task to download and install an SSL certificate on the remote destination machine?

推荐答案

没有内置任务可以下载和安装证书.您可以将其添加到源代码管理或其他服务器(例如FTP)中,然后在构建/发布过程中下载证书(可以通过PowerShell下载文件).

There isn’t the built-in task that can download and install certificate. You can add it to the source control or other server (e.g. FTP), then download the certificate during build/release (can download file through PowerShell).

之后,您可以通过PowerShell任务安装证书:

After that you can install certificate through PowerShell task:

$pfxpath = 'pathtoees.pfx'
$password = 'password'

Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($pfxpath, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
$store.Add($cert)
$store.Close()

相关问题: Visual Studio团队服务部署人员/构建证书错误

这篇关于VSTS IIS Deploy配置IIS站点SSL证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆