Azure App Service is a Platform as a Service (PaaS) solution that Microsoft offers to assist you developing your applications without worrying about the underlying infrastructure. It is a service based on HTTP that allows you to deploy web applications or REST APIs to the cloud.
Azure App Service supports the most of the more popular languages – .NET, .NET Core, Java, Ruby, Node.js, PHP and Python – on top of your preferred platform (Windows or Linux).
It also supports the continuous deployment lifecycle integration taking advantage of GitHub, Docker Hub and Azure DevOps.
Creating an App Service
To create an Azure App Service using the Azure Portal follow the steps below:
1 – Select Azure App Service in the search box:
2 – Click on Create App Service:
3 – In the next page you need to provide some details:
a. Select a resource group that the Service App will reside or create a new one:
b. Provide the instance name:
Keep in mind that the instance name will be used to compose the app service URL. In this case it will be https://as-blog-demo.azurewebsites.net
c. In this demo we are not deploying using Docker containers, then the runtime stack is required. Pick from the dropdown the language runtime you used to create the app you are going to deploy.
d. Select the Operating System:
e. Select the region where you want the app service to be deployed. Regions represents the geo location where the service will be physically located.
f. Select the App Service Plan:
If you don’t have an App Service Plan, a new one will be created when the App Service is created.
The App Service Plan will be created in the same region that you selected for the App Service and any other App Services that you add to this plan will be hosted in this same region.
g. The last step is to select the Sku and size:
If you click on Change size you will see many different pricing tiers which you can choose from:
For demo purposes I`m using the Free F1 from the Dev / Test tab.
The last step now is to create the App Service, go to the Review and Create tab and click on the Create Button and wait for it to get deployed.
Deploying to the App Service
To deploy your code to the App Service we are going to use the Power Shell and the AZ CLI.
The first step is to get the binaries ready to be deployed, for this app service I selected the .NET Core 3.1 runtime version, to create the binaries in this case, go to Visual Studio, right click on the project and select Publish.
Publish it to a local folder, zip the files and copy the zipped files to folder of your preference.
Now that the binaries are ready open the Power Shell and run the following commands:
- az login – It will open the Azure Portal Authentication Page and ask for your credentials. You need to be authenticated to interact with Azure.
- To deploy the zip files we need to run the command below:
–resource-group – This parameter is used to inform the resource group where the app service is located
–name – This is the name of the app service
—src – this is the location of your zip file
The Resource Group and the App Service Name can be found at the App Service Overview Page
- The title of the page is the App Service Name and you can also find it in the URL information.
- The first segment is the app service name.
- Resource Group is the first information listed on the page.
Once the deployment is done you can access your app using the URL provided in the overview section.