The idea is to allow people to assign their own domain name to a profile on my web site,
One thing I could do is to bind each domain name to the web app in IIS, but this will be ugly as I may have many domains in that list, also I wonder if this can impact the performance for that web application if I had so many domains associated with one web app,
Also, I like to make these changes programmatically instead of adding it manually (like when binding a domain name to a web app in IIS)
Any ideas how to approach this?
U can try the below power shell script for that. Make a csv file(name : Site.csv) having your domains in a column(Header name: name) and keep it in C Colon.
$csv = import-csv C:\site.csv
foreach($line in $csv)
{
$name = $line.name
New-WebBinding -Name "Default Web Site" -IPAddress "*" -Port 80 -HostHeader $name
}
Related
Can I add a custom domain to a webapp and later change it so that the same url is used for a function ?
I mean, initially mount a web service in an app service and later migrate it to azure function and keep the same url of the service.
Steps to Add the custom domain to a web app check custom domain azure dns
Once You added the custom domain You Want to Remove the custom domain by using azure portal Goto web app -> Custom Domains -> App Service Domains -> Click on the domain -> Delete it.
Use below PowerShell script to Remove all custom domain:
$webApp = Get-AzureRmWebApp -ResourceGroupName "<<Resource-Group-Name>>" -Name "<<App_Name>>"
$webApp.HostNames.Clear()
$webApp.Hostnames.Add($webApp.DefaultHostName)
set-AzureRmWebApp -ResourceGroupName "<<Resource-Group-Name>>" -Name <<App_Name>> -HostNames $webApp.HostNames
This will remove all custom hostnames and leave only the default one.
If you want to remove a specific hostname for the collection you could use:
$webApp.HostNames.Remove("your_hostname_goes_here")
NOTE If your hostname has SSL bindings you will need to remove those first and then delete the hostname. Refer here
Suppose You don’t want to delete the Custom domain and the Default domain name can be used for other service you can follow the below steps:
set a default domain
The domains redirecting to a default domain, follow the below steps.
With your static web app opened in the Azure portal, select Custom domains in the menu.
Select the custom domain you configured as the Not Set as default.
Select as default.
After the operation completes, refresh the table to confirm that the domains are marked as "default".
I have 2 web apps behind Application Gateway. I am trying to access by http://<aap_gateway_pub_ip>/web1 should go to http://webapp1.azurewebsites.net and http://<aap_gateway_pub_ip>/web2 should go to http://webapp2.azurewebsites.net. I have defined path based rule like:
$web1PathRule = New-AzureRmApplicationGatewayPathRuleConfig -Name web1pathrule -Paths "/web1" -BackendAddressPool $regbackendpool -BackendHttpSettings $poolSetting
$web2PathRule = New-AzureRmApplicationGatewayPathRuleConfig -Name web2pathrule -Paths "/web2" -BackendAddressPool $accbackendpool -BackendHttpSettings $poolSetting
$urlpathmap = New-AzureRmApplicationGatewayUrlPathMapConfig -Name urlpathmap -PathRules $web1PathRule, $web2PathRule -DefaultBackendAddressPool $defaultPool -DefaultBackendHttpSettings $poolSetting
$urlRoutingRule = New-AzureRmApplicationGatewayRequestRoutingRule -Name routingrule-001 -RuleType PathBasedRouting -HttpListener $defaultlistener -UrlPathMap $urlpathmap
The issue is when I directly access http://<aap_gateway_pub_ip> request goes to default pool which is web1 backendpool and opens web1 app. But when I access http://<aap_gateway_pub_ip>/web1, it returns 404 error.
What additional configuration is required to make this working?
I also got stuck in this problem for a day and trust me Microsoft should think about and adding more clear instructions.
The thing is when you access the base address of frontend IP like this http://<aap_gateway_pub_ip>
It simply replace the frontend IP with the backend pool based web app IP, so the request sent to the web app is something like http://webapp1.azurewebsites.net and it works.
Problem starts when you create a path based rule and configure it like this http://<aap_gateway_pub_ip>/web1 -> http://webapp1.azurewebsites.net
What app gateway does, it simply replace the front end ip with the backend ip
So the request sent to backend is
http://webapp1.azurewebsites.net/web1
and if your backend webapp does not contain that page in the website then it will through 404 error.
So there are 2 solutions for that
1> Edit the httpsetting of the rule and add a '/' in the "override backend path"
2> The other approach is to actually drive the path based rule in such a way that the final path (like web1 in your case) should actually exists in the backend server or webapp.
Please follow additional backend http settings and probe configuration for integration with Web Apps to work correctly. The documentation is here.
I'm a little lost here and would appreciate some help:
I've set up an app service that works with:
tenant1.myapp.com
tenant2.myapp.com
etc.
I wan't to make make custom domains to work for the tenants, so that
customtenantdomain.com can point to tenant2.myapp.com
The only way I've managed to get it to work is by manually adding a custom domain "customtenantdomain.com" in the azure portal, setup A and CNAME records and from there my code handles it based on the host name. I also need to set up
TXT myapp.azurewebsites.net awverify
Is it possible to do this in another way, or at least programatically?
Ideally, I would like to only point the A-record from the domain to point to the azure IP
A # 23.100.50.51
along with
TXT myapp.com awverify
But that does not work, obviously. Is there any reason why that should not work?
It is possible to set up mappings using powershell:
Get-AzureDeployment -ServiceName yourservicename | Select Url
Here is some more information:
https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-custom-domain-name
I created a 3-level Azure Traffic Manager. But it doesn't work.
At the top tier, it's called myroot.trafficmanager.net.
At the middle tier, there are 2 nested traffic manager profile called mysub1.trafficmanager.net and mysub2.trafficmanager.net.
At the bottom tier, each nested traffic manager profile has 2 endpoints, Azure websites.
The balancing method of the top tier is Round Robin.
The balancing method of the middle tier is Performance.
I used Azure PowerShell cmdlets to create the mapping between the top tier and the middle tier.
PS C:\> Get-AzureTrafficManagerProfile -Name “myroot"
PS C:\> $TrafficManagerProfile = Get-AzureTrafficManagerProfile -Name "myroot"
PS C:\> Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $TrafficManagerProfile -DomainName "mysub1.trafficmanager.net" -Status "Enabled" -Type "TrafficManager" | Set-AzureTrafficManagerProfile
PS C:\> $TrafficManagerProfile = Get-AzureTrafficManagerProfile -Name "myroot"
PS C:\> Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $TrafficManagerProfile -DomainName "mysub2.trafficmanager.net" -Status "Enabled" -Type "TrafficManager" | Set-AzureTrafficManagerProfile
After the above command is done. I can use nslookup myroot.trafficmanager.net command to see the IP have been directed to the right endpoint. But when I open myroot.trafficmanager.net in the browser, I got the error:
Error 404 - Web app not found.
I would appreciate if anyone could give me any clue.
This is most probably due to the fact that your top-level Traffic Manager domain (myroot.trafficmanager.net) is not mapped as custom domain to your web app (Web Site). And this is because, your Web Site only knows about mysub1.trafficmanager.net).
You can solve your issue by using custom domain and correctly map your custom domain to your Azure Web App. Then, also map your custom domain to your Traffic Manager Domain.
There are 6 projects running on single instance with different port.
which are
http://stanthony.cloudapp.net
.
.
http://stanthony.cloudapp.net:86
Now I want to run each urls with different Domain, I did CNAME mapping with a domain but still same problem that all the ports are running with this single domain
www.kpmaurya.org
.
.
www.kpmaurya.org:86
I want to run all these urls with different domain
please let me know hoe can it be possible.
In an Azure Web Role's service definition file you have a section for adding sites. Within this site you can add bindings section for each of you 6 sites with host header set to each of your custom domain.
Please refer this link for more details : http://msdn.microsoft.com/en-us/library/windowsazure/gg433110.aspx