Publishing the ASP.NET Core Backend to Azure
Learn to publish an ASP.NET project to Azure.
In this section, we are going to deploy our database and backend API to Azure using Visual Studio. We will create publish profiles for deployment to a production environment as well as a staging environment. During the process of creating the profiles, we will create the required Azure app services and SQL databases. At the end of this section, we will have two profiles that we can use to quickly deploy to our staging and production environments.
Publishing to production
Let's carry out the following steps to create a production deployment profile and use it to deploy our backend to production:
In “Solution Explorer”, right-click the “QandA” project and select “Publish...”.
The “Publish” dialog opens, which asks us to choose a publish target. Choose “Azure” and click “Next,” as illustrated in the following screenshot:
We are then asked which service we want to deploy to in Azure. Select the “Azure App Service (Windows)” option and click “Next,” as illustrated in the following screenshot:
The next step is to specify our Microsoft account. We could then search for and select an existing app service to deploy to. However, we are going to create a new app service, so click the green plus “Create new” icon, as illustrated in the following screenshot:
Fill in the name for the production app service. This name will form part of the URL to the REpresentational State Transfer (REST) API, so the name will need to be globally unique. In the example in the following screenshot, the URL will be
https://QandA2021.azurewebsite.net
. Note down the name you choose, because we'll eventually reference this in the frontend project:
You can choose the default hosting plan for the app service. Alternatively, you can associate it with a new one by clicking the “New...” option.
Click “Create” to create the app service—this will take a few minutes to complete.
After ...
Get hands-on with 1400+ tech skills courses.