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

Introduction

 
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.
 
image1 
 
Give [A] Yes to all for installing all cmdlets from the repository
 
image2 
 
You can see the Azure commandlets are downloaded
 
image3
 
To Import the module type the command import-module –name Azure RM
 
image4
 
Login into Azure account using the command Login-AzureRmAccount
 
image5 
 
A pop-up will raise, log in with your Azure account
 
image6 
 
After giving your login you can see your mailID with your subscription details
 
 image7
 
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
 
image8 
 
Once creation is done you can see the details of the webserver
 
image9
 
Let's check on the Azure UI. Log in to the Azure portal _ Go to Resource groups 
 
image10 
 
We can see our Resource group which we created.
 
image11 
 
We can see our AppService plan and AppService which we created.
 
image12 
 
Click the URL to check whether it is working or not
 
image13 
 
Here we can see the appservice link was working.
 
image14