c# - 在azure web应用程序中为客户添加自定义域并自动添加让我们加密证书

标签 c# asp.net azure ssl lets-encrypt

我们提供的服务可帮助本地企业在 Google 或 Facebook 等平台上收集更多评论。每个客户都有一个由我们托管的自己的网站。但从技术上讲,它运行在一个 Azure Web 应用程序上。例如,每个客户都有一个如下 URL:https://portal.your-voting.com/freds-bike-shop 。我们希望让我们的客户有机会在后端配置自己的域。例如:https://review.freds-bike.shop 。此外,Let's Encript for Azure 的 SSL 证书应该适用于自定义域。

如何以编程方式为我的 Azure Web 应用程序添加自定义域? 如何自动获取并安装客户域的 Let's Encript 证书?

目前我们使用 Let's Encript 站点扩展和 C# als 编程语言。

最佳答案

How do i programmatically add custom domains for my azure web app?

您可以利用Azure Management Libraries for .NET并关注Getting Started with App - Manage Web App With Domain Ssl - in .Net将自定义域名绑定(bind)到Web App,如下所示:

app1.Update()
.DefineHostnameBinding()
.WithThirdPartyDomain("{yourdomain.com}")
.WithSubDomain("{your-subdomain}")
.WithDnsRecordType(CustomHostNameDnsRecordType.CName)
.Attach()
.Apply();

How do i automatically get and install the Let's Encrypt certificates for the customer domains?

这里是使用带有 Let's Encrypt 证书的 azure web 应用程序的 powershell 自动化的类似方法,详细信息您可以 here关于CreateLetsEncryptWebApp.ps1通过以下步骤:

a) create an Azure Web App

b) generate a certificate from Let's Encrypt

c) bind the certificate to the Web App with a custom domain name

要使用Let's Encript Site Extension,您需要注册Azure AD应用程序并配置相关的Web应用程序设置,详细信息您可以按照here .

关于c# - 在azure web应用程序中为客户添加自定义域并自动添加让我们加密证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50944572/

相关文章:

c# - 如何在 gridview 中检索行索引

c# - 在 XmlDocument 中加载 xml 文件时出错

c# - 查询字符串检查

asp.net - MVC4中Dropdownlist的某些记录设置类属性

javascript - CKeditor 不显示在带有隐藏 div 的 asp.net 页面中

c# - WPF - 从 PSD 文件创建 ProgressBar 模板

c# - AspNet Core 作用域依赖接口(interface)隔离

arrays - 如何在azure逻辑应用程序中将字符串转换为数组

azure - 配置 Azure Pipeline 以从 Github 托管存储库中提取

c# - 将存储升级到 4.0.1 后,Azure 存储容器 ListBlob 引发 Uri NULL 异常