Distributing an app can be simple or complex. Learn how to map a custom domain name to an Azure app to get an easy url for user access, and how to purchase a domain from Microsoft if that's the right path.
- [Instructor] Up until now, the websites we have created have been part of the subsite azurewebsites.net, but you probably don't want your users going to yourwebsite.azurewebsites.net. In all likelihood, you'll want to add in your domain name. Azure SSL already secures the .azurewebsites.net, and the sub-domains associated with that. As I said, when you create an app, it will be https://yourappname.azurewebsites.net.
You can definitely go ahead and configure a custom domain, and you can only do this, though, in the service plans that are of a basic tier and above. You can also add in your own SSL certificate. If you would like to bring your own certificate, there are a couple things you have to keep in mind. First of all, it must be signed by a trusted CA, it must contain a private key, it must be created for key exchange and exported to a .PFX file, it must have a minimum of 2048 encryption, the subject must match the custom domain name, and the certificate will be merged with all intermediate certificate used by the CA.
Let's go ahead and show you how we add in a custom domain into azure. As you can see, I have logged into azure. I happen to be in the resource group DeployFromVS. This was the webapp that we deployed from Visual Studio directly into azure. And now we'd like to go ahead and add in a custom domain to this app. I'm going to open the web app SB blade, by clicking on MyWebAppSB, and we can see here the URL is for mywebappsb.azurewebsites.net.
We want to add in a custom domain. To do so, you will find custom domains under settings, go ahead and click the custom domains tab. This will open the blade. And you can go ahead and purchase your domain from right within azure. If I click on plus, I will have the option to purchase the domain. Possible domain names are present to me. You can go ahead and pick whatever one best meets your needs. You'll be required to enter your contact information.
You can set the domain to renew every year automatically. You may want to enable privacy protection. It's something I like to do on my domains when I purchase them. And then you can go ahead and assign the default hostnames. Once you have everything entered in here, you can click OK, and you'll be able to purchase the domain name that can be used with azure. We're not going to do this, because I already have a domain name that I'd like to use. I'm going to go ahead and close this blade, yes I know my edits will not be saved.
I'm going to come down and click on add hostname. I'm going to enter my hostname, I own this domain. It's not a very creative domain name, but it works. I'm going to go ahead click validate. And at this point, we can see that domain verification has passed. I have already gone into my registrar, and have modified my A record and my TXT record.
You will need to do the same as well. Once your domain has been verified, you can go ahead and click add hostname. This will take a moment. Our hostname has now been added. I can go ahead and close this blade. And you can see that we now have a hostname bennettdemo assigned. I'm going to go ahead and close this blade.
I'm going to pop back into MyWebAppSB. You'll see that our URL has now been changed to bennettdemo.com. You will notice that this is http, not https, because I have not added an SSL certificate. I can go ahead and click on bennettdemo.com. And this will now bring up the website that we deployed to azure, using Visual Studio.
I would always recommend adding a custom domain name to your azure webapps. It just makes it easier for your clients and your users to locate you.
- Deploying Web Apps
- Creating App Service plans
- Deploying and moving apps
- Configuring app settings
- Managing Web Apps using PowerShell and CLI
- Configuring alerts
- Enabling diagnostic logs
- Retrieving and streaming logs
- Configuring Web Apps for scale and resilience