Create a wild card DNS zone for SharePoint APPS

Summary

To support installing and publishing APPS from your SharePoint Farm you will need to configure DNS to support a wild card host names for the specified app domain. This blog will demonstrate a quick way to configure your Microsoft Active Directory integrated DNS Server to support SharePoint Apps.

Why is this needed?

The APP URL will be created based from the App domain and App prefix settings in Central Admin.

Example:

 

When installing an APP from a SharePoint Site, a random url will be used for your new app (which will need to be accessible in DNS).

Example:

 

I will choose the free "YouTube Feeds" app for this example.

 

Now the app will be accessible in your native App list, just like the OOTB Apps:

 

After the app is added it will be given a random name based on your settings.

 

If name is not accessible in DNS, accessing the app will fail.

How to make it work

To make this work, you will need a new forward lookup zone in DNS that matches the App domain you specified in the App URL settings from above. Once you have a forward zone, create wildcard CNAME that points to your WFE.

Note: This name can be a load balanced name or a single server depending on your configuration. For this simple test case, I have a single WFE.

 

To create the required settings, you can use the dnscmd utility or just use the DNS management tool.

Here are the commands using the dnscmd utility:

 

To create an AD Integrated forward zone:

 dnscmd michlee-server5 /zoneadd 2016apps /dsprimary

 

To add a wild card cname in the new zone:

 dnscmd michlee-server5 /recordadd 2016apps * CNAME michlee-sp-wfe.mylab.selfhost.corp.microsoft.com

 

After running these commands your DNS settings will look like this:

As you can see pinging a random name in this zone will respond from the WFE sever.

Resources

Configure an environment for apps for SharePoint Server
https://technet.microsoft.com/en-us/library/fp161236(v=office.16).aspx

Dnscmd Syntax
https://technet.microsoft.com/en-us/library/cc756116(v=ws.10).aspx#BKMK_14