Creating an Azure App Service using the Azure CLI


Azure App Service is an HTTP-based service for hosting web applications, REST APIs, and mobile backends. You can develop in your favorite language, be it .NET, .NET Core, Java, Node.js, PHP, and Python. Applications run and scale with ease on both Windows and Linux-based environments. App Service adds the power of Microsoft Azure to your application, such as security, load balancing, autoscaling, and automated management.
An app service always runs in an App Service plan. In addition, Azure Functions also has the option of running in an App Service plan. An App Service plan defines a set of compute resources for a web app to run.
When you create an App Service plan in a certain region (for example, West Europe), a set of compute resources is created for that plan in that region. Whatever apps you put into this App Service plan run on these compute resources as defined by your App Service plan. Each App Service plan is defined as:
Operating System (Windows, Linux) Region (West US, East US, and so on) Number of VM instances Size of VM instances (Small, Medium, Large) Pricing tier (Free, Shared, Basic, Standard, Premium, PremiumV2, PremiumV3, Isolated, IsolatedV2)
Creating an Azure App Service using the Azure CLI involves several steps. Here's a step-by-step guide to creating an App Service:
Install Azure CLI: If you haven't already installed Azure CLI, you can do so by following the instructions on the official Azure CLI documentation for your specific operating system: Install Azure CLI.
Step 1:Login to Azure: Open your terminal or command prompt and run the following command to log in to your Azure account. It will open a web page where you can enter your Azure credentials.
az login
Step 2: Create a Resource Group: A resource group is a logical container for your Azure resources. You can create one using the az group create command. Replace myResourceGroup with your desired name and eastus with your desired Azure region.
az group create --name myResourceGroup --location eastus
Step 3: Create an App Service Plan An App Service Plan defines the region, SKU (size), and other settings for your App Service. Create an App Service Plan using the following command:
az appservice plan create --name <name your appserviceplan> --resource-group <name of your resource group>
Replace the placeholder <name your appserviceplan>with your preferred plan name, and <name of your resource group>with your resource group name
Step 4: Create the App Service Use the az webapp create command to create the App Service. Replace MyWebApp with your desired web app name, MyResourceGroup with your resource group name, and MyPlan with your App Service Plan name:
az webapp create --resource-group MyResourceGroup --plan MyPlan --name MyWebApp
Azure portal to verify
LAUNCHING THE WEB APP
Subscribe to my newsletter
Read articles from Jones A Jones directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Jones A Jones
Jones A Jones
I am a Computer support Engineer