Have you ever needed to quickly stand up a web site, or web API app that was publicly available? Is your team or organization thinking about moving to the cloud but aren’t sure the best place to start? One of the first places you should look is Azure App Service Web Apps. In this post we’ll look at how easy it is to get started, and a quick overview of key concepts.
App Service offers the following benefits:
- A fully managed platform, meaning Azure automatically updates the operating system and runtime as security and stability fixes are released.
- 10 free plans to every subscriber, so it won’t cost you money or credits to try your app in Azure.
- First class support in Visual Studio, meaning that you can go from your app running on your local machine to running in App Service in less than 2 minutes.
- If offers deployment slots, which enable you to stage multiple versions of your app, and route varying amounts of traffic to the various versions (i.e. do A/B testing, or a ringed release model).
- Scale up and down quickly and automatically based on load
- For a more see Why use Web Apps?
In this blog post, I’ll provide an overview of App Service’s key features and concepts by walking through using Visual Studio to publish an ASP.NET application to Azure App Service.
Let’s get going
To get started, you’ll first need:
- Visual Studio 2017 with the ASP.NET and web development workload installed (download now)
- An Azure account:
- Any ASP.NET or ASP.NET Core app, for the purposes of this post, I’ll use a basic ASP.NET Core app
To start I’ll right click my project in Solution Explorer and choose “Publish”
This brings up the Visual Studio publish target dialog, which will default to the Azure App Service pane. The “Create new” radio button is already selected to, so I’ll click the “Publish” button on the bottom right.
Key App Service Concepts
The dialog has four fields that represent key concepts of creating an App Service:
- App Name: Will be the default public facing URL in Azure (it will be of the form https://<App_Name>.azurewebsites.net –you can configure domain names later if needed).
- Subscription: The Azure Subscription to create the resources in if you have more than one
- Resource Group: Groups your application and any dependent resources (SQL Databases, Storage Accounts, etc., see resource group design to learn more). To edit the name, click “New…”.
- Hosting Plan: The hosting plan is a set of reserved resources for your app. You can choose to host multiple apps in a single hosting plan (we’ll explore this further in a minute).
One concept that can be confusing is the relationship between the “Hosting Plan” (or App Service plan”) and the “App Service”:
- The Hosting/App Service plan is the virtual machine resources you are reserving in Azure to host your application. This is what you are paying or using credits for.
- The App Service is your app and associated settings that run inside of the plan. You can run multiple apps (App Services) in the same plan (virtual machine) with the same implications as sharing any other server or VM between apps.
To explore the App Service plan further, click the “New…” button next to the Hosting Plan dropdown to open the “Configure Hosting Plan” dialog that has three fields:
- App Service Plan: A non-public facing name for the plan.
- Location: Is the region your app will run in. You generally want to pick a region that is close to customers that will be accessing the site.
- Size: The size of the virtual machine you want to reserve for your application and the capabilities you want (e.g. deployment slots require a Standard or Premium plan).
Note: Free and Shared plans run in the same VM as other App Service apps and are intended for development and testing, see App Service plan overview for more details
Publishing the app
At this point I’m ready to publish my app to App Service. The bottom right panel of the Create App Service dialog will show me all the resources I’m going to create in Azure (in this case a Hosting Plan and App Service). Everything looks good, so I just need to click “Create”:
Visual Studio will create all the resources on my behalf, publish my application, and open my default browser to the URL of the published application.
Hopefully, this overview of App Service concepts has been helpful and inspired you to give App Service a try. We believe that for many people, App Service is the easiest place to get started with cloud development, even if you need to move to other services in the future for further capabilities (compare hosting options to see additional choices). As always, let us know if you run into any issues, or have any questions below or via Twitter. If you’re interested in exploring more, see the next post in our series introducing how to setup and use SQL Server with App Service