Azure Networking Live Example
How to setup networking
how to deploy the application on Azure VM with networking and use bastion
sending request from firewall ip address using port 4000 to Virtual machine nginx webserver having html code
Step 1: Create resource group
Step 2: Create Virtual Network (VNET)
Note : Azure Bastion – Azure Bastion is a fully managed service that provides secure and seamless RDP (Remote Desktop Protocol) and SSH (Secure Shell) connectivity to your virtual machines (VMs) directly through the Azure portal. It eliminates the need to expose public IP addresses on your VMs, thus enhancing security by preventing exposure to the public internet. Link – https://www.cloudopsnow.in/azure-bastian/
Step 3: Create Virtual machine
if go to machine and check VM it doesn’t have public ip because it will going to access via Bastian (to connect securely)
Step 4 : Connect VM via Bastian and install ngnix and create HTML file
Install and Configure Nginx on Ubuntu
Step 1: Update Package Lists
Before installing any new software, it’s a good practice to update the package lists to ensure you get the latest version.
sudo apt update sudo apt upgrade
Step 2: Install Nginx
Install Nginx using the following command:
sudo apt install nginx
Step 3: Start Nginx Service
sudo systemctl start nginx
Step 4: Create HTML File
sudo vim /var/www/html/index.html
Add the HTML content, for example.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Demo Page</title>
</head>
<body>
<h1> I Learnt how networking works in Azure today</h1>
</body>
</html>
Save the file.
Restart Nginx
sudo systemctl restart nginx
Step 5: configure firewall policy , if someone access ip address of firewall on particular port will forward request to VM.
Go to virtual network –> configured Virtual network –> firewall –> firewall policy –> DNAT –>Add rule collection
Now add rule
Source ip address – I am restricting only to connect from my laptop
Destination ip address – firewall ip address
firewall port can be any number i added 4000
tranlated address is VM ip address and port 80
step 6: Connect via firewall ip address :port number
http://172.191.155.181:4000/