Author : MD TAREQ HASSAN | Updated : 2020/11/10
Prerequisites
Create required resources beforehand to use those during VM creation. If not created beforehand, required resources will be created during VM creation.
Create Resource Group:
- Go to: https://portal.azure.com/#create/Microsoft.ResourceGroup (login to Azure portal first, then click the link)
- Fillup details (i.e. name ‘
demo-rg
’, select subscription etc.) - Create
Create required resources:
- Create Network Security Group
- Create VNet and subnet
- Create public IP address
- Create network interface (NIC)
- Associate public IP address to NIC
- Create storage account for VM diagnostics
Points to be noted
- It is possible to create public IP address, NIC, NSG beforehand and use these while creating VM
- It is also possible to assign public IP address and open RDP port 3389 after creating VM
- When creating IP address in advance: you need to use “IP address assignmen: Static”, otherwise public IP address might not show up and you might not be able to connect to VM using RDP
- When creating VM in Azure portal using ARM template, do either of the followings
- Create Public IP address with “IP address assignmen: Static” (Standard is recommended)
- Let the ARM template create the follwoing resources**
- public IP address
- Inbound rule (RDP 3389)
- NIC
- NSG
- etc
- You can use existing storage account for VM daignostics
Recommended sequeence to follow when public IP assign and RDP will be done after VM creation
In order to save time and avoid mistakes, provision following resources sequentially
- Create Network Security Groups
- Create public IP address
- Create Virtual Network
- Create Bastion (use public IP address during Bastion creation) while creating vNet
- Use public IP (created previuos step) for Bastion
- If you disable bastion while creating vNet, then after creating vNet you can create Bastion and while creating Bastion, it will ask for vNet
- Create NIC
- Create VM
- Use Virtual Network created previously
- About VM NIC
- You can not attach existing NIC (created previously) to VM while creating VM using azure portal
- When VM is created, NIC will be created automatically
- After VM creation detach NIC that automatically created and attach your NIC (created previously) if you want
- Create data disk if you need during VM creation (give nice name, otherwise disk will be created with weired name)
Create Virtual Machine
- You can create all required resources (i.e. public IP, NIC, NSG etc.) while creating VM. But in this article we are gonna use resources that are created beforehand (FYI, Azure portal does not allow to attach existing NIC while creating VM, so we will assign existing NIC after creating VM and delete the NIC that will be created automatically)
- Go to: https://portal.azure.com/#create/Microsoft.VirtualMachine-ARM
- Basics: fillup details i.e. resource groups, VM name, password etc. > Next
- Disks:
- Note: Azure VM images come with 128GB OS disk, to change size of OS disk, create custom image or find an image in the marketplace that uses smaller/larger OS disk size
- OS disk type: Premium SSD
- Encryption type: Default
- Advanced > Use managed disks: yes
- Next
- Networking: fillup details (i.e. VNet, subnet, NIC sercurity group etc. , use Public IP: none) > Next
- Management: use defaults > Next
- Advanced: use defaults > Next
- Tags: use tags > Next
- Create
Now we are gonna attach NIC (that we created beforehand) to VM
- Go to: https://portal.azure.com/#blade/HubsExtension/BrowseResourceGroups
- Select resource group where VM belongs
- Stop VM (it will take some time to be stopped)
- Settings > Networking > Attach network interface
Next
- Connecting to virtual machine
- Adding Inbound rule for RDP if RDP was not allowed while creating VM