I'm not clear from your question exactly what things you have configured
you should have host name mappings for www.domain.com and domain.com if you want the site to respond to both.
Then if you want the preferred to be without www then put domain.com for the preferred hostname
I have just the opposite on this site www.mojoportal.com is preferred so for example the url (whether entered manually or clicked) http://mojoportal.com/community will redirect to http://www.mojoportal.com/community it will not result in page not found
it should work no differently going the other way with and without www is just 2 host names
if one of yours is not working first make sure it is resolving to the correct ip address when you ping the host name and if it is a shared ip address with other sites then there must also be in IIS host name headers to make it resolve to the correct IIS site. I'm not sure how that plays out in Azure but if you get an IIS 404 page then it is not even reaching mojoPortal code