我们提供的服务可帮助本地企业在 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/