Network Interface and Security Configuration
IP Assignments and Network Interfaces
A virtual machine (VM) connects to an Azure virtual network using one or more virtual network interfaces. Each network interface receives an IP address configuration to handle communication with other resources. You must choose between a dynamic IP, which Azure automatically assigns from the subnet's available range, or a static IP, which you manually assign to keep the address from changing. When configuring static IPs, it is best practice to place them in isolated subnets to avoid address conflicts with dynamically assigned resources. If you need to add or remove a network interface, the VM must first be changed to the Stopped (deallocated) state.
Network Security Groups (NSGs)
To control the flow of traffic, a Network Security Group (NSG) acts as a firewall by filtering inbound and outbound network traffic. You can apply an NSG to an entire subnet or directly to an individual network interface, allowing you to secure traffic at different boundaries. Each NSG contains security rules defined by properties like protocol, port ranges, source and destination IP addresses, direction, and priority. Traffic is evaluated in order of priority, where lower numbers take precedence and stop further rule evaluation once a match is found. Default rules are automatically included in every NSG to provide baseline security; these rules cannot be deleted, but they can be overridden by creating custom rules with higher priority.
Azure Load Balancers
An Azure Load Balancer provides high availability by distributing incoming traffic across a group of virtual machines. The load balancer receives external or internal traffic through a frontend IP configuration, which serves as the single point of contact for clients. It then forwards this traffic to a backend address pool, which contains the IP addresses of the target VMs. To ensure traffic only goes to healthy VMs, a health probe continuously monitors the status of each machine in the backend pool. Finally, load-balancing rules define exactly how the traffic arriving at the frontend is mapped and sent to the backend VMs.