Step through a simple Web App creation using Visual Studio and then how to deploy it into the Azure App Service.
- [Instructor] We've created a web app using the Azure Portal, but for the most part your developers will not be directly working with Azure. They will deploy from tools they already work with, such as Visual Studio. For this demo I'll show you how to deploy a web app to Azure using Visual Studio. As you can see, I have already logged into Visual Studio. I happen to be using Visual Studio 2017, the Community version. As this is a new release your screens may look somewhat different if you're using a slightly older version.
To create a new project I'm going to start off with File, New, and Project. We'll be using the Visual C# Web template and the ASP.NET Web Application. In the lower section of the screen you're going to go ahead and provide a Name for your web app.
I'm going to call mine simply MyWebApp. Next, the Location will be pre-populated for you for the location of the files. You can go ahead and change this if you wish. You can also create a directory for the solution, and then you can add that to Source Control. Click OK. Next, we're going to take the M-F-C template, which is short for Model View Controller. And the Authentication should be set to No Authentication.
If yours does not say No Authentication click on Change Authentication and then select No Authentication and OK. And then click OK again. This will take a moment for your project to be created. You'll see that our Solution has been created and all of our files are listed to the right. If you'd like to learn more about the .NET platform feel free to click any of the links.
If you'd like to connect to any additional services you can go ahead and just select that service here under Connected Services. But we'd like to publish this to Azure. I'm going to go ahead and click Publish. And you'll notice I have a couple different options. I can publish to Azure, to IIS or FTP, to a Folder, I can import a profile if I wish, or I can publish to an Azure Virtual Machine. We're going to focusing in on the Microsoft Azure App Service.
We already have a resource group set up for our web app, so let's take a look at that first. I'm going to click Select Existing, and then if I click Publish the information associated with our subscription is already populated for us. So we have a Resource Group and we can see that we already have a web app already created, that was the Prodwebapp, and as you recall we created a Deployment Slot for that Prodwebapp.
If I wanted to I could actually deploy this right to that Staging slot, and then when I was satisfied with how that app was behaving I could then swap it. But for this demo I'm going to go ahead and create a new Resource Group and a new App Service plan. I'm going to go ahead and click Cancel, and then Create New, and Publish. And just as we did in the Azure Portal, we can go ahead and set up all the settings here.
First of all we need to provide a Web App Name. This will need to be unique, because remember, it will be hosted off of .azurewebsites.net. For my Web App Name I've just added in SB. For that unique name you'd want to provide a name that was relevant to your web app. You would pick your Subscription. I already have a Resource Group called DeployWebApps, but I want to go ahead and create a new one.
I'm going to click New. My resource group name will be called DeployFrom Visual Studio, or VS, that way we can easily find it when we pop back into Azure. I'm going to click OK. We can go ahead and select an existing plan that we already have in place, or I can go ahead and create a new one. And that's exactly what I'm going to do.
I'm going to leave the default App Service Plan name of MyWebAppSBPlan, we're going to keep in the Central US, and the Size will be a standard 1. I'm going to go ahead and click OK. You'll notice in the bottom left corner we can see where we are in the process, right now we're in Step 1 of 2. You will notice that we are still in Step 2. This will take about six to eight minutes.
After a few minutes we can see from our Output that our build succeeded and the publish succeeded. Once the app is published the web page will appear for us. And let's go take a look at this in Azure. We're currently looking at the Azure groups blade, we'll need to refresh this. You'll notice that our new resource group has been created called DeployFromVS. We can see that the app has been created, as well as the App Service Plan.
I'm going to go ahead and open the blade for the app. And we have all the basic information about that application. And there's our URL, again, that is using the myappsb.azurewebsites.net. If I go ahead and click on that it will launch the same page we just saw. And that's all there is to it. Again, from an IT pro point of view the idea was to help you understand how you push applications from Visual Studio into Azure and the Azure settings that are required.
It will typically be your dev group who is using Visual Studio and they'll need you to assist with the Azure implementation.
- 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