Azure VM
Azure VM
While creating the VM what are the components you see, ensure that your
VM is highly available.
I have VM, I am going to host web application inside this VM, this VM will
be running on one of the physical host in the data center, i.e.
windows2019 OS run their infrastructure in the backend they have used
Hyper-V has a virtualization platform, this node might have 2TB of RAM,
50TB of storage, physical server contains VMs means your VM and
another customer VM, virtualization means we use the common resources
to run your VM, the common resources are allocated by the physical
server in the data center.
While you are creating a VM you are going to specify what is RAM
required, we have 2 GB RAM, how many CPUs you are going to provide 2
Virtual CPUs per your VM, which means that this physical server is only
providing the basic resources to run your VM which means the CPU and
RAM only providing, this is compute.
Storage: in this storage you have disks placed, you have OS disk has to be
attached to VM, this OS disk is automatically getting attached to VM, this
OS disk contains the OS files from where this OS files are coming while
creating VM you are going to choose the image, there is an image server
which is managed by Microsoft while you are creating VM you are going to
choose what is the OS version you want you can pick one of them from
image server then later while creating VM the OS disk is getting attached
to VM and this OS getting installed in this OS disk. Once this OS is
installed your VM will be up and running.
Compute will provide additional disk i.e. temporary disk, by default table
will be D volume, why this temporary disk due to some reason you shut
down the VM you deallocated the server all the compute resources will be
disconnected so temporary disk also will be disconnected, when you start
this VM it will not go and sitting in same physical server in the data center
it might get new physical server in the data center where it is going to
run.
You have Storage which is provided OS disk and compute provide RAM
and CPU to run your VM. What else needed for VM to be running network.
Your VM needs a NIC every computer has NIC, NIC details has to be
associated with your VM along with your NIC should be have IP address,
without IP address you cannot connect any VM, you need to have IP
address which can be public or private IP, private IP is mandatory without
private IP you cannot create VM. Network related components are being
managed by network resource provider which means if you want your VM
need to be up and running there should be connectivity b/w storage and
compute.
How do you provide high availability for your VM if physical server going
down?
I have website, this VM(web1) is running on azure data center (physical
server), so if this VM is down my entire business down, can you create
another VM and deploy the same application and distribute the traffic if
one VM is go down we have another VM which can be process the end
user request, then I started creating another VM(web2), if VM(web1) is not
available I have web2 so I have configured the load balancer in b/w which
will distribute the traffic b/w these 2 servers, whenever external user
trying to request extra load balancer will check health of the which VM is
distributed the traffic accordingly, I can say my management
team I have deployed 2 VMs the traffic distributed through load balancer if
one VM is going down another VM is available. One of user reported that
website is not accessible we went and had a check both VM logs
underlying host has been degraded this physical server have some
problem due to some network connectivity or performance issues this
server is not available because of that both VMs are rebooted and move
to another physical server in the data center and they are running on the
same server but both VMs are not available, the reason because when you
keep 2 machines in azure you don't know which server they are running
they might be running on same server or diff server, here they are
running on same server if that server going down everything is down, to
avoid this Microsoft recommend you keep 2 or more VMs in availability
set, Microsoft will ensure that those 2 VMs are not going down at the
same time.
These 2 VMs (web1 and web2) will be in availability set, these VMs are not
deployed in same physical server VM1 will go another physical server and
VM2 will go another physical server.
Microsoft keep on doing updates to their physical server, if the physical
server rebooted all the VMs running on this physical server will be
rebooted, this is planned maintenance,
Availability set prevents you in the rack level outages and node level
outages, but availability zone will prevent you VM reboots from data
center level outages. availability set works on rack or node or server level.
Another part is you are azure admin, you are the responsible for
managing the azure resources so which I need to talk to these VMs using
RDP, to work on day to day operations like he need to login into the VM,
RDP port 3389 and SSH port is 22, you can connect VM using NIC, every
VM has NIC this NIC contains two IP addresses, public and private. Public
IP you are going to purchase from Microsoft, it is a separate service as
your VM storage
etc. private IPs coming from your VNet address space and subnet address
space you are going to define address space for your virtual network like
10.0.0.0/16, where your web servers are hosted call them as web subnet,
address range 10.0.1.0/16, based on virtual network address space we
divide multiple subnets so your VM or NIC will get IP address from the
subnet range that you specified. You can use public or private IP to take
RDP within public you can have DNS take DNS name to connect.
If you want to take RDP through public IP or you can use DNS that you
configure on the public IP, you can use any one of them because they
resolvable over the internet.
You can also use private IP but you cannot use private IP to connect over
the internet because private IP is internal to this virtual network within
azure, if you wanted to connect through private IP there should be some
diff mechanism you should be connect through VPN.
Public IP cannot be secured because public can be accessible over the
internet which is easy to connect VM.
You assigned a public IP and you are going to connect over the internet to
remote desktop connection but if you assign NSG in your subnet level or
you can assign NSG in NIC level as well, maybe you can assign IP address
directly to the NIC so if you assigned to NIC the NIC is connected to your
VM whatever the roles configuring in this NSG that rules applied to the
specific NIC, if you assign this to a subnet and if you configured any rules
in this NSG the rules applied to entire subnet which means all the
machines within the subnet.
What is ASG?
You have web server1, web server2 so on, DB server1, DB server2, DB
server3 so on, now you have request to allow the communication from
web server1 to DB server1, DB server2, DB server3, each machine need
to talk to other machines it's not looking better way, to avoid these things
Microsoft introduced ASG, ASG act as a page, you can create one
application security group for web servers and one application security
group of DB servers now you need to allow the communication b/w this all
the web servers and db servers you just all web servers to web-asg, add
db servers to ASG(db-asg) and later you just create one rule that says
allow communication from web to db using ASG and create one rule and
all the machines which are added to this ASG will be able to talk to the
machines which are added to the db-asg that is called ASG, we are using
ASG as a mediator to allow the communication.
Azure AD - maintains your user ID's and passwords and the role as well
you know what kind of permissions you have, when your login to azure
portal you enter your email ID, the request goes to azure AD, Azure AD
will check this account is existing or not, then if it exists it will give you
access to portal login, once account is logged into the portal then the
permissions are evaluated what permissions he has, subscription or he
just user in the azure, if he cannot part of any subscription he cannot see
any resources in the azure portal, he is just user
in this tenant.
One directory can have multiple subscriptions but one subscription cannot
be part of multiple directories.
What are the built-in roles available in azure? How do you manage these
permissions?
We have something called RBAC, this is a service in azure, which is used
to assign permissions in the cloud environment, in RBAC we have few
built-in roles those are owner, contributor, reader. Owner - I can create a
resource, I can delete any resource and I can give you access to any
resource as an owner, contributor or reader if I am an owner. If I am a
contributor, I get same permissions as an owner but I cannot add
somebody as an owner. If I am a reader, I can just see what is the status
of the service what are the resource available in the subscription and
RG's.
In the resource group you have access control you can provide access to
resource in a resource group level and click on add permissions and you
can also go to specific resource and provide permissions there add, add
role assignment, everywhere you have IAM access control.
You have guest user, I have invited Hari work on sometime for a
freelancer, [email protected], I am going to invite Hari into my directory as
a guest user, he can login into azure portal and he help me in my daily
activities, whey I add his email ID in azure portal he can get invitation
from my directory which is [email protected] and he can accept
the invitation and he can login into azure portal and he can see azure
resources.
Another one is on-premise AD user, most of the organizations are also in
this model, when you join any company your ID team will provide you the
username and password and once you login into teams or outlook, and
diff applications so the user accounts and passwords will manage in on-
premises your own data center there will be service called domain
controller that holds a role called active directory domain services so that
maintains the user IDs and passwords of all the employees and also
maintains all the employees what kind of permissions they have so those
user IDs and passwords it maintains and permissions also will maintains,
once you login into any computer the AD will get authenticate them, and
give them access, whatever the user IDs and passwords you have in on-
premise those details will be present in azure AD as well so the users get
access to azure AD application and azure subscription as well. So you can
use one user ID password login into all cloud applications and your on-
premises applications. We will also setup domain controllers and will try to
create users and synchronize them to azure AD then we give them access
to outlook, teams, and azure portal.
Go to azure portal, azure active directory, users, we see guest user and
here we see directory synced - NO, which means that are not
synchronized from on-premise AD.
While creating user we see 2 options create user and invite user. Invite
user means guest user. To create user, provide username and for
password you can enter or auto generate, diff groups and diff user roles,
role you can give global administrator, usage location select India, created
user as a member, member nothing but from azure AD. Global
administrator can create users, if you want to see subscriptions go to
subscription, click on it, add role assignment, select owner, select
member, and assign.
I want to create my own domain, how to verify your domain with azure
AD, I am in azure AD, you can see custom domain names, I wanted to use
my own domain which I brought it from Godaddy account, add custom
domain, we see the status is unverified and to verify this click on it, is this
TXT or MX record we have to verify in Godaddy website, add record, select
what kind of record so select TXT, name alias or @, value is take from
azure AD, TTL by default it will take 1 hr, click on add record. Next add MX
record, go to Godaddy website and add MX
record, when I am creating user account by default we get primary
domain, to add another domain as primary click on make primary.
Connect RDP: take public IP, connect RDP, we see server manager
dashboard window, if the machine is slow we need to resize, dsa.msc this
is a command to login to project domain services users and computers.
Now we are in Active Directory users and computers, here you can create
users and groups, providing access to the users and specific folders and
applications, to create user right click on the organization unit, users,
create user.
You can also create a group, like global or universal and group type is
security or distribution.
Q) I have the VM, I have the domain controller, I am trying to join this
machine to the domain and my machine is not able to reach the domain
so what could be possible causes?
Did you update the DNS IP address in the Vnet level by default it is going
to take azure provider DNS but if your domain controller need to be
reachable you need to update the DNS server IP address here? Your VM
private IP address you need to update in the DNS server.
To join this server to the domain, right click and properties, click on
change settings, change, select domain, [email protected], I
need to provide domain admin credentials, domainname/username and
password. Restart the machine, go to dsa.msc, go to computers, you see
my VM which is joined to the domain is available. Download azure AD
connect.
Azure Firewall:
Most of the customers uses third party firewall devices like CISCO, Paulo
alto, for that we need to setup server infrastructure in azure, we have to
manage the servers and infrastructure and manage rules as well, with
azure firewall we don’t need to create any host it’s a PaaS component that
Microsoft is offering, in the azure firewall service the backend components
are being managed by Microsoft we only have an option to create
a rules, whatever the rules that help us to run our business securely those
rules we can configure, those rules called, NAT rules, Network rules,
application rules. NAT rules can be used to hide your VM public IP's,
Network rules if you wanted to restrict access to the specific ports like
DNS, DHCP, TCP, UDP, ICMP any ports that you wanted to allow or block
you need to use network rules. Application rules you want to restrict
access to specific URLs so most of the organization does this.
Here we need to have Vnet created, in Vnet we have one subnet, within
this subnet you have to deploy azure firewall component, while creating
azure firewall you have an option to choose Vnet and choose subnet and
you can create n number of subnets where your work loads are running.
I have a VM, this VM don't have public IP associated, so I am going to use
private IP of firewall to connect VM, open VM, go to networking, see NIC
public and NIC private, take NIC private IP address. Create firewall, select
subscription, RG, name, region, availability zone, select firewall tier
standard or premium, create a Vnet, select public IP, once created firewall
go to rules, NAT, Network and application rules,
When it comes to azure, azure backup can protect azure VMs, SQL DB
running on azure VM, and if you have file share created in storage account
you can backup file share as well, if you have SAP Hana running on azure
VM you can backup workloads as well.
When it comes to azure you don't need to install any specific application,
since it is native service there will be few extensions that gets installed
inside your azure workloads to configure the backup.
When you want to configure backup there are few stages you have to go
through it, first you need to configure a policy, we call it as azure VM
backup policy, first we are going to specify when to backup, azure backup
provides a schedule backup option so with policy you can schedule a
backup, how frequently you want to schedule, what time you want to
trigger the backup when to trigger the backup that is going to specify in
the azure VM backup policy, you can only have one schedule backup in a
day for your VM backup policy. And once you schedule a backup policy
how long you wanted to retain the data, there are two types of retention
here one is short term retention or instant restore recovery points it
means data is locally available to your vault so you can set retention for 1
to 5 days, and other one is long-term retention means Microsoft provides
up to 99 years. In the restore you can specify weekly backup, monthly and
yearly backup restore so those details you can specify in
the azure VM backup policy, once the backup policy set next process is
going to be discovery of your VM so the VM will be discovered in the
configuration console if the VM is not back up to any other RSV and if the
VM and your RSV location are the same location then only the discovery
operation will be successful and you will be able to see your VM when you
configuring the virtual machine backup, once you select right VM the 3rd
step in enable backup so when you enable backup azure backup we call it
as backup management service BMS is going to talk to your windows
azure guest agent so it is going to provide extension details so during this
backup process so we are going to install BMS is going to install a
extension call VM snapshot extension this extension is available in one of
the storage account which is being managed by Microsoft, these
extensions are binaries available in the storage account, this binaries info
is being given to windows azure guest agent by BMS service,
once windows guest agent have the info it takes the path from the host or
node in the backend so this VM is running on physical server or host in the
azure data center so it is going to take this path and from this path it's
going to reach out to the storage account and download this snapshot so
these are the steps are going to happen when you configure the backup.
Snapshot of VM might have couple of disks it might contain disk 1 which is
OS disk, it can contain a data disk it can contain multiple data disk to your
VM, VM snapshot extension is going to take snapshot of all this disk and
once snapshot is completed your instant recovery point is getting created.
Once the snapshot is completed the data will be transferred to the vault.
Note: remember 2 things; when you trigger the backup there are 2 stages
it goes through one is taking snapshot the other one is transferring data
to the vault so while taking a snapshot your VM snapshot extension might
be interacting with various OS components.
Create Backup: open portal, RSV, we see overview, Backup and Site
Recovery. RSV is used for business continuity using backup and disaster
recovery solutions using site recovery.
If I want to configure backup for my VM I have to choose Backup, choose
on-premise or azure, if I select azure we see azure VM, azure file share,
SQL server in Azure VM, SAP Hana in Azure VM.
If I choose on-premise you can see files and folders, Hyper-V VM, VMWare
VM, Microsoft SQL server, Microsoft share point, Microsoft exchange,
system state, Bare metal recovery. Select Azure, select VM, next step is
configuring backup here 2 subtypes; 1 is backup policy and another you
need to discover your VM, you can see default policy gets created, first
backup is the full backup and next is ad-hoc or schedule backup are going
to be incremental backup.
Create new policy, give policy name, schedule: frequency - daily or weekly
and specify time and time zone.
Instance restore - 1 to 5 days, daily backup retention 30 days by default,
whatever days you can specify, in case you wanted to specify retention of
weekly (M,T,W,T,F,S,S), monthly and yearly backup point. Specify the
specific day in a week and on that day whatever the backup is going to
happen you can specify how long that backup has to be retained and
same thing in monthly backup on every month first Sunday or second
week or which day you want to backup you wanted to retain for a certain
no of months same thing for yearly.
Backup policy is created where you are going to add your VM you just
click on Add, it is going to discover the VM, select VM and Microsoft given
an option OS disk only, in case if you don't want to take backup of entire
VM you want to take backup only OS you can choose this option.
3rd step is enable backup the backup job gets initialized once backup job
is executed you can see them under backup job section. Go to backup
items, click on backup now, you can see retention by default it will choose
30 days.
Azure Monitoring:
you have multiple VMs in azure how do you centralize and monitor them,
most of the organizations uses zabbix, splunk, Nagios diff tools they used
to monitor the infrastructure.
When it comes to azure, azure provides native services called log
analytics workspace, using log analytics workspace you can store the
metrics, metrics means CPU utilization, memory utilization, disk or
network related once you store this data here.
How do you store the metrics into this for your each VM?
You are going to connect these 2 VMs to the LAW this workspace is going
to install agent in your VM that agent is called MMA (Microsoft Monitoring
Agent) this agent responsibility is to collect the metrics that are required it
is in your control what kind of metrics you wanted to monitor, if your
agent is not well the agent which is sitting in the VM will send heartbeat to
your LAW every one minute.
Serial console: if you are not able to login to the VM if you are not able to
rdp to the VM let's say one of NIC is disabled you wanted to re enable the
NIC inside the OS this will give you command prompt window you will get
inside the VM through command prompt and perform certain operations
you need to do that tab escape and provide username and password.
Azure Update Manager: it is used for patching your VMs, it's a PaaS
component you don't need to manage any infrastructure, we have
automation account that is a service we have couple of features one of
them is update manager which means you are not integrating with
workspace you can integrate with automation account patching the azure
VMs once automation account is created and update manager feature is
enabled it has integration with
workspace next you can create a schedule, when do you want to patch
your servers in a month what is the data you wanted to patch, once you
create a schedule you can add VMs, there are 2 types of schedule; one for
windows and one for Linux VMs