简体   繁体   English

如何从 c# mvc 应用程序在 azure 上自动生成子域

[英]How can i auto generate subdomains on azure from c# mvc application

i am developing an application where i want to make subdomains from my c# mvc application automatically rather than manually adding cname is it possible?我正在开发一个应用程序,我想从我的 c# mvc 应用程序自动创建子域,而不是手动添加 cname,这可能吗? if possible then please help如果可能的话,请帮忙

Prerequisites To delegate an Azure DNS subdomain, you must first delegate your public domain to Azure DNS.先决条件 要委派 Azure DNS 子域,您必须首先将您的公共域委派给 Azure ZED5F2BDECBD4BD349FBD096。 See Delegate a domain to Azure DNS for instructions on how to configure your name servers for delegation.有关如何配置名称服务器以进行委托的说明,请参阅将域委托给 Azure DNS。 Once your domain is delegated to your Azure DNS zone, you can delegate your subdomain.一旦您的域被委托给您的 Azure DNS 区域,您就可以委托您的子域。

Create a zone for your subdomain First, create the zone for the engineering subdomain.为您的子域创建一个区域 首先,为工程子域创建一个区域。

New-AzDnsZone -ResourceGroupName -Name engineering.contoso.com New-AzDnsZone -ResourceGroupName -Name engineering.contoso.com

Note the name servers Next, note the four name servers for the engineering subdomain.注意名称服务器 接下来,请注意工程子域的四个名称服务器。

Get-AzDnsRecordSet -ZoneName engineering.contoso.com -ResourceGroupName -RecordType NS获取-AzDnsRecordSet -ZoneName engineering.contoso.com -ResourceGroupName -RecordType NS

Create a test record Create an A record in the engineering zone to use for testing.创建测试记录 在工程区创建一个用于测试的 A 记录。

New-AzDnsRecordSet -ZoneName engineering.contoso.com -ResourceGroupName -Name www -RecordType A -ttl 3600 -DnsRecords (New-AzDnsRecordConfig -IPv4Address 10.10.10.10). New-AzDnsRecordSet -ZoneName engineering.contoso.com -ResourceGroupName -Name www -RecordType A -ttl 3600 -DnsRecords (New-AzDnsRecordConfig -IPv4Address 10.10.10.10)。

Create an NS record Next, create a name server (NS) record for the engineering zone in the contoso.com zone.创建 NS 记录 接下来,为 contoso.com 区域中的工程区域创建名称服务器 (NS) 记录。

Azure PowerShell Azure PowerShell

Copy $Records = @() $Records += New-AzDnsRecordConfig -Nsdname $Records += New-AzDnsRecordConfig -Nsdname $Records += New-AzDnsRecordConfig -Nsdname $Records += New-AzDnsRecordConfig -Nsdname $RecordSet = New-AzDnsRecordSet -Name engineering -RecordType NS -ResourceGroupName -TTL 3600 -ZoneName contoso.com -DnsRecords $Records Test the delegation Use nslookup to test the delegation.复制 $Records = @() $Records += New-AzDnsRecordConfig -Nsdname $Records += New-AzDnsRecordConfig -Nsdname $Records += New-AzDnsRecordConfig -Nsdname $Records += New-AzDnsRecordConfig -Nsdname $RecordSet = New-AzDnsRecordSet -名称工程 -RecordType NS -ResourceGroupName -TTL 3600 -ZoneName contoso.com -DnsRecords $Records 测试委派 使用 nslookup 测试委派。

Open a PowerShell window.打开 PowerShell window。 At command prompt, type nslookup www.engineering.contoso.com.在命令提示符处,键入 nslookup www.engineering.contoso.com。 You should receive a non-authoritative answer showing the address 10.10.10.10.您应该收到显示地址 10.10.10.10 的非权威答案。

Docs 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM