Virtual machine deployment in Azure Using Azure Portal

 Checklist before creating the VM.

1. Start with the network

2. Name the VM

3. Decide the location for the VM

4. Determine the size of the VM

5. Understanding the pricing model

6. Storage for the VM

7. Select an operating system

How to create Virtual machine in Azure using Azure Portal

Login to Azure Portal -> Click Virtual Machine

Click Create

Select Subscription

Resource Group

Virtual Machine Name

Region

Select Operating system and Size -> Price will applicable as per the assigned size

Enter User Name and password



Create Inbound port rule -> If you want to enable RDP port select RDP 3389 port allow.

Click next Disk type -> 

Select the Disk type for OS and LUN for Data disk

Note-: If you are deploying VM using without any storage disk, one temp disk will add default and you can store your data in temp drive but when you will Power Off the VM data will wipe from temp disk

Click Networking

You will see a couple of Subnets inside the Virtual Network-> Select one of them from the list.

I am leaving other options default 

Click Review + Create

Click Create

VM Deployment is in progress.


Now VM Deployment has completed.

Click Connect -> Select RDP Or you can use MSTSC and enter public IP to connect


Download RDP file

Click Connect

Enter User ID and Password



Now you will see OS disk and Temporary Storage D drive


Azure Networking # Azure VNets Create

 Azure VNet

Virtual networks (VNets) are used in Azure to provide private connectivity between Azure Virtual Machines and other Azure services. VMs and services that are part of the same virtual network can access one another. By default, services outside the virtual network cannot connect to services within the virtual network. You can, however, configure the network to allow access to the external service, including your on-premises servers.



Create VNet in Azure using Azure Portal.

Login to Azure portal using your subscription ID

Click Virtual Network.


Click create

Click IP Addresses and Enter IP Address

Click Add Subnet -> Give the subnet Name and range.

Subnet range must be from same IP range

Click Security -> Here I am leaving default; you can change as per your requirement.

Click Tag -> Update the Tag that you want like owner, department

Click Review + Create

Click Create

Now go to Virtual network and you will see newly created VNet.


If you want to create more subnet in VNet_Raju, Open the VNet and click Subnets 

Click Add Subnet and assign CIDR range.



Note -: When you deploy a new VM, you need to select VNet_Raju Network and inside the network you will see multiple Subnets that you have created.

Select the correct required subnet from the list.


ARM Viz Tool # JSON Script Visualize

 ARM Viz Tool -> ARM Viz Tool we use to visualize JSON templates. JSON template is written in script and it’s not so much easy to read all those things before deployment and you are not sure what is going to deploy unless you don’t read all the scripts, for that you can use ARM Viz Tool to convert JSON code into GUI to check main parameters & Variables.


How to convert JSON script into ARM Viz Tool.

Download the JSON template and keep it in the local machine.

Open ARM Viz Tool using below URL.

http://armviz.io/



Click on File -> Open Local Template


Browse the path and open the JSON template.



Once you will open the template in ARM Viz Tool -> you will see screen like below.

Click on MyVMName to see what is written in the JSON script.

Once you click on MyVMName you will see all the computer related parameters.

Similarly, once you click on myVMNIc you will see all the related Parameters.

So, you can review those parameters, Variables and change them. So, no need to read all the JSON script.




VM Deploy using ARM Template # json Template

… …

 Azure Resource Management Template -> ARM we use to make deployment faster and more repeatable.


Benefits of ARM Template.




ARM template takes care of your entire deployment for you, ARM template has a lot of benefits.

They improve consistency of deploying the resources so if you have to deploy the same resources again and again for a similar environment like Development, Quality to test production or testing environment, execute the code it does the deployment for the entire infrastructure stack for you. 

That means all your complex deployment or workout simply by ARM Template in JSON, Administrators are usually bombarded by deployment and multiple infrastructures related activity and it’s quite possible to for-gate to change some parameter on that Virtual machine or edit the property of that storage account.

ARM Template reduces the manual effort and reduces any types of mistakes and human error.


ARM template -:

What is Azure Resource Manager -: Azure Resource Manager allows you to provision your applications using a declarative template. In a single template, you can deploy multiple services along with their dependencies. You use the same template to repeatedly deploy your application during every stage of the application lifecycle.

Microsoft constantly adds new Resource groups into their repository.

ARM Templates will have certain Parameters and Variables.

To list out the template search for Azure QuickStart Templates in Google.


https://azure.microsoft.com/en-in/resources/templates/?cdn=disable 



Deploy VM using ARM template

Use the link below to open the template.

https://azure.microsoft.com/en-us/resources/templates/ 

Search for the VM template that you want to deploy (In my case I am deploying)

Deploy a simple Windows VM with tags

Click on Template Name -: Deploy a simple Windows VM with Tags

During the deployment you need to fill below parameter values.


Click Browse on GitHub -> Click DeploymentTemplate.json file 

In my case I am opening below marked json template.


Click Raw -> Copy all content and paste it notepad++ (In Notepad++ it is readable in proper format)




You can do modification in the template like which version do you want to deploy, what will be subnet mask, VMName



I am changing below two highlighted parameters.


Save this file in .json format


Now Launch PowerShell from windows PowerCli.


 


Login with Azure account to establish connection with Azure Portal.



Once Authentication done run below command

New-AzResourceGroupDeployment -name B2CRG -TemplateUri C:\Users\C5309368\Desktop\DeployeNewVMTemplate.json


Once you hit enter pop up will come to fill value.



Once you update all the parameters VM Deployment will start.


Now login to Azure Portal -> Click on Resource Group -> Deployment




Click to Resource -> Overview and you will see what is created and what is pending.


During the deployment, the first dependency will create. 


Once deployment will complete you will see New VM Inside the Virtual machines.
















Azure Resource Group # Resource create, delete, lock using PowerShell

 Azure Resource Group->  You can deploy, Manage and Monitor all the resources for your solution as a Group, rather than handling these resources individually.

You can repeatedly deploy your solution throughout the development lifecycle and have confidence your resources are deployed in a consistent state.

You can manage your infrastructure through declarative templates rather than scripts.

You can define the dependencies between resources so they are deployed in the correct order.

You can apply access control to all services in your resource group because Role based access control (RBAC) is natively integrated into the management platform.

You can apply tags to resources to logically organize all the resources in your subscription.

you can clarify your organization's billing by viewing costs for a group of resources sharing the same tag.

 Resource provider 

Microsoft has categorized resources and different categories.

Compute -> it will provide Images , Snapshots, Virtual Machines

Storage-> Storage provides Files, Strage Accounts, Blobs, Tables

SQL -> Tables, Structured 

Top categories is called Resource Provider and Subcategories is called Resource Type.


To check the list of resource provider login to Azure Portal and search for resource Explorer.


Click on provider and you will see a list of resource providers.

Once you expand the resource provider you will see resource type, like below.



Use below Command to Get Azure Resource Group list

Get-AzResourceGroup


Locking resource or resource Group using PowerShell

We lock resource groups, or resources to prevent other users in the organization from accidentally deleting or modifying critical resources. 

Use below Command to create AzResource group lock and protect Azure Resource Group.

New-AzResourceLock -Name "DoNotDelete" -LockLevel CanNotDelete -ResourceGroupName Resource_Powershell


“DoNotDelete” -> AzResource Group Lock name (Newly created)

Resource_PowerShell -> Resource Group Name that was earlier created using New-AzResourceGro***** Command.


How to check Azure Resource is locked or not using Azure portal.

Login to Azure Portal

Search for Resource Group -> You shall see a list of the resource created inside the Resource Group.


Select the resource group for which you applied lock level, in my case I applied on Resource_PowerShell.

Click on Lock ->

Lock Name is created, and lock type is set Delete. 

From the Azure Portal you can also lock your resource.

Login to Azure Portal

Search for Resource Group and inside the Resource Group search for resources.

Select the Resource that you want to lock -> Click Locks -> Add


Give the Lock Name 

Select Lock type

And press OK.


Now Try to check whether the resource is locked or not.

Use the below command to delete resources in PowerShell.

Remove-AzResourceGroup -Name Resource_Powershell


Command to get Azure resource lock ID

Get-AzResourceLock

Command to remove LockID from resource or resource group.

Remove-AzResourceLock -LockId /subscriptions/a02b1c64-6583-49b2-828f-eb5878d4fa75/resourceGroups/Resource_Powershell/providers/Microsoft.Authorization/locks/DoNotDelete

Resource “Resource_Powershell” is now not protected so you can now easily delete from resource group either using PowerCli or Azure Portal.

Command to remove Azure Resource Group

Remove-AzResourceGroup -Name Resource_Powershell




Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is 10.0.0.1/2 You need to connect your laptop and storage with...