Domain mapping with AzureWebAPP and Storage account

46 views Asked by At

Is it possible to redirect one domain (MyMenu.com) to two different destinations?

MyMenu.com ---> AzureStorageAccount (StorageAccount URL for static website)

Admin.MyMenu.com ---> AzureWebApp (https://ExampleMenuApp.azurewebsites.net/)

Note: I have a domain from GoDaddy (MyMenu.com). How to make Admin.MyMenu.com ?

Thanks in advance.

2

There are 2 answers

1
Jason Pan On BEST ANSWER

Yes, you can use rewrite. Code like below in web.config.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="mydomain.com" stopProcessing="true">
            <match url="(.*)" />
                <conditions logicalGrouping="MatchAll">
                  <add input="{HTTP_HOST}" pattern="^(admin.mydevapp.nl)$" />
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                </conditions>
                <action type="Redirect" url="https://examplemenuapp.azurewebsites.net/" redirectType="Temporary" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

Test Result:

enter image description here

My domain config on portal.

enter image description here

0
Ked Mardemootoo On

Yes you can do that. Say you have mymenu.com, which is the root domain, and you have admin.mymenu.com which is a subdomain of mymenu.com. The subdomain is considered as an extension or a child item of the root domain and it can have its own properties, such has pointing to different IPs/websites etc.

Because you're using Azure Storage Account and Azure Web Apps, all you need to do is create two different CNAMES in Godaddy that will each point to the different service URL you provided. You also need to verify the domains/subdomains with each individual service before you can assign a domain.

See Azure documentation to create a custom domain.