What I understand from CNAME record is that, if we have this record in our Authoritative Name Server, then the DNS resolver will resolve for the CNAME record's pointed path.
Let suppose I have test.azurewebsites.net, and I also own mynameistest.com, now I go and create CNAME record in my DNS Provider with the below details:
www.mynameistest.com CNAME test.azurewebsites.net
If I have created this record successfully, isn't it enough as I will be pointing the DNS query to the hosted app service? Why do I need to tell Azure App Service that I have created a custom domain name for it with hostname as "www.mynameistest.com".
Will the IP Address point to that of test.azurewebsites.net if CNAME is added?
Adding the CNAME record pointing to test.azurewebsites.net will make the DNS resolvers resolve queries for mynameistest.com to the IP Address associated with test.azurewebsites.net.
Is this NOT enough?
No. This is NOT enough, as the Azure App Service (or the underlying server, in general) needs to be "instructed" to respond to the requests for "mynameistest.com".
How does the server know the URL(FQDN) being requested? Isn't it all about IP Addresses?
During the TLS/SSL Handshake, when the client sends the "Client Hello" message, it embeds some "Extensions" header in it, one of those extensions is, "server_name", which tells the TLS/SSL Layer (of server) that which FQDN is being requested. Now, if the server is unaware of this, it will respond with 404 (Not Found). But if the server knows about this, it will send out the corresponding SSL Certificate from its pool of certificates (A server can host multiple websites/domains, and each of them can have one SSL Certificate, this is called Virtual Hosting).
The above is reason why, we need to tell the Azure App Service to serve the requests for "mynameistest.com", and this "instruction" is given via adding the custom domain from the portal.