Network Security Group (NSG)
- NSG can be used to filter network traffic to and from Azure resources in a virtual network.
- NSG contains security rules that allow or deny network traffic.
- NSG can be applied to Subnet and Network Interface (VM)
- In Each Security rule we can specify
- Name
- Priority
- Source
- Destination
- Protocol
- Port
- Action
- Lets create a Network security group

- Security rule with lowest priority value has the higher priority
- Lets create a security rule to allow http (tcp 80 request) from anywhere

- Now lets create a virtual network with two subnets
- web
- app
- Now lets create a ubuntu vm in web subnet and attach the network security group created

- Now lets try to login into this vm using ssh. SSH protocol works on port 22 using tcp protocol
ssh qtdevops@52.142.60.128

- Now lets add an inbound security rule for ssh

- Exercise: Create one more vm in app subnet.
- VM in app subnet
- should be allowing 8080 protocol from anywhere
- 22 port from any device from web subnet range
- all the other communications are denied.
- VM in app subnet
