How to Install Azure RM Module in PowerShell and Create Webapp using Azure RM command


This module helps you learn how to install the Azure RM module for using cmdlets to create the following services:
  • To install the Azure RM module
  • To create an Azure resource group
  • To create an Azure app service plan
  • To create Webapp

To install the Azure rm module in windows using PowerShell

Open the PowerShell and install the Azure RM Module
Type the command -> install-module azure rm
Give yes by typing [Y] to install NuGet Provider. It is required for PowerShell to interact with the Azure repository.
Give [A] Yes to all for installing all cmdlets from the repository
You can see the Azure commandlets are downloaded
To Import the module type the command import-module –name Azure RM
Login into Azure account using the command Login-AzureRmAccount
A pop-up will raise, log in with your Azure account
After giving your login you can see your mailID with your subscription details
After completing the installation of the Azure RM module you'll have all the cmdlets which are required to control the Azure resources from your system.

To create an Azure resource group

Type the below command to create Resource Group and store the value to _.resgroup 
  1. $resgroup = New-AzureRmResourceGroup -Name Flyahead -Location 'East US'  
Store value of resource group name to _ rgname. By storing the values  it will use that for automating the resources and PowerShell scripting.
  1. $rgname = $resgroup.ResourceGroupName  

To create an Azure app service plan

Create the App service plan and store its values to name app service, this app service name should store in-app planner.
  1. $appservice = New-AzureRmAppServicePlan -Location 'East US' -Tier Free -ResourceGroupName $rgname -Name webappserver  
  2. $appplanner = $appservice.Name 

To create Webapp

Create the Azure web app in the appserviceplan.
  1. New-AzureRmWebApp -ResourceGroupName $rgname -Name mywebapptest01 -Location 'East US' -AppServicePlan $appplanner 
You can see the resource creation
Once creation is done you can see the details of the webserver
Let's check on the Azure UI. Log in to the Azure portal _ Go to Resource groups 
We can see our Resource group which we created.
We can see our AppService plan and AppService which we created.
Click the URL to check whether it is working or not
Here we can see the appservice link was working.