Skip to content

Commit 5da037b

Browse files
committed
docs: Replace HTTPS/443 with HTTP/8080 for vm-mgmt testing - Simplifies tutorial by using port 8080 instead of 443 - Removes SSL certificate generation complexity - Makes testing easier without certificate warnings
1 parent 21c17d7 commit 5da037b

1 file changed

Lines changed: 32 additions & 52 deletions

File tree

articles/virtual-network/tutorial-filter-network-traffic.md

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,12 @@ az network vnet subnet update \
350350
| Source port ranges | Leave the default of **(\*)**. |
351351
| Destination | Select **Application security group**. |
352352
| Destination application security group | Select **asg-mgmt**. |
353-
| Service | Select **HTTPS**. |
353+
| Service | Leave the default of **Custom**. |
354+
| Destination port ranges | Enter **8080**. |
355+
| Protocol | Select **TCP**. |
354356
| Action | Leave the default of **Allow**. |
355357
| Priority | Leave the default of **110**. |
356-
| Name | Enter **allow-https-mgmt**. |
358+
| Name | Enter **allow-8080-mgmt**. |
357359

358360
1. Select **Add**.
359361

@@ -382,7 +384,7 @@ $webRuleParams = @{
382384
$webRule = New-AzNetworkSecurityRuleConfig @webRuleParams
383385
```
384386

385-
The following example creates a rule that allows traffic inbound from the internet to the *asg-mgmt* application security group over port 443:
387+
The following example creates a rule that allows traffic inbound from the internet to the *asg-mgmt* application security group over port 8080:
386388

387389
```azurepowershell-interactive
388390
$mgmtAsgParams = @{
@@ -392,15 +394,15 @@ $mgmtAsgParams = @{
392394
$mgmtAsg = Get-AzApplicationSecurityGroup @mgmtAsgParams
393395
394396
$mgmtRuleParams = @{
395-
Name = "Allow-HTTPS-Mgmt"
397+
Name = "Allow-8080-Mgmt"
396398
Access = "Allow"
397399
Protocol = "Tcp"
398400
Direction = "Inbound"
399401
Priority = 110
400402
SourceAddressPrefix = "Internet"
401403
SourcePortRange = "*"
402404
DestinationApplicationSecurityGroupId = $mgmtAsg.id
403-
DestinationPortRange = 443
405+
DestinationPortRange = 8080
404406
}
405407
$mgmtRule = New-AzNetworkSecurityRuleConfig @mgmtRuleParams
406408
```
@@ -438,21 +440,21 @@ az network nsg rule create \
438440
--destination-port-range 80
439441
```
440442

441-
The following example creates a rule that allows traffic inbound from the Internet to the *asg-mgmt* application security group over port 443:
443+
The following example creates a rule that allows traffic inbound from the Internet to the *asg-mgmt* application security group over port 8080:
442444

443445
```azurecli-interactive
444446
az network nsg rule create \
445447
--resource-group test-rg \
446448
--nsg-name nsg-1 \
447-
--name Allow-HTTPS-Mgmt \
449+
--name Allow-8080-Mgmt \
448450
--access Allow \
449451
--protocol Tcp \
450452
--direction Inbound \
451453
--priority 110 \
452454
--source-address-prefix Internet \
453455
--source-port-range "*" \
454456
--destination-asgs "asg-mgmt" \
455-
--destination-port-range 443
457+
--destination-port-range 8080
456458
```
457459

458460
---
@@ -465,7 +467,7 @@ Create two virtual machines (VMs) in the virtual network.
465467

466468
1. In the portal, search for and select **Virtual machines**.
467469

468-
1. In **Virtual machines**, select **+ Create**, then **Azure virtual machine**.
470+
1. In **Virtual machines**, select **+ Create**, then **Virtual machine**.
469471

470472
1. In **Create a virtual machine**, enter or select this information in the **Basics** tab:
471473

@@ -830,31 +832,23 @@ az network nic ip-config update \
830832

831833
1. Try to access **vm-web** on port 443 by browsing to `https://<public-ip-address-vm-web>` in your browser. The connection fails or times out because the security rule for the **asg-web** doesn't allow port 443 inbound from the internet.
832834

833-
1. Now configure **vm-mgmt** with nginx on HTTPS. Select **vm-mgmt** from the **Virtual machines** page.
835+
1. Now configure **vm-mgmt** with nginx on port 8080. Select **vm-mgmt** from the **Virtual machines** page.
834836

835837
1. Select **Run command** from the **Operations** section.
836838

837839
1. Select **RunShellScript**.
838840

839-
1. In the **Run Command Script** pane, enter the following commands to install nginx with a self-signed certificate for HTTPS:
841+
1. In the **Run Command Script** pane, enter the following commands to install nginx on port 8080:
840842

841843
```bash
842844
sudo apt-get update -y
843845
sudo apt-get install -y nginx
844846

845-
# Generate self-signed certificate
846-
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
847-
-keyout /etc/ssl/private/nginx-selfsigned.key \
848-
-out /etc/ssl/certs/nginx-selfsigned.crt \
849-
-subj "/C=US/ST=State/L=City/O=Organization/CN=vm-mgmt"
850-
851-
# Configure nginx for HTTPS
847+
# Configure nginx to listen on port 8080
852848
sudo tee /etc/nginx/sites-available/default > /dev/null <<EOF
853849
server {
854-
listen 443 ssl default_server;
855-
listen [::]:443 ssl default_server;
856-
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
857-
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
850+
listen 8080 default_server;
851+
listen [::]:8080 default_server;
858852
root /var/www/html;
859853
index index.html index.htm index.nginx-debian.html;
860854
server_name _;
@@ -871,9 +865,9 @@ az network nic ip-config update \
871865
872866
1. On the **Overview** page of **vm-mgmt**, note the **Public IP address** for your VM.
873867
874-
1. To confirm that you can access the **vm-mgmt** web server from the internet on port 443, open an internet browser on your computer and browse to `https://<public-ip-address-vm-mgmt>`.
868+
1. To confirm that you can access the **vm-mgmt** web server from the internet on port 8080, open an internet browser on your computer and browse to `http://<public-ip-address-vm-mgmt>:8080`.
875869
876-
Accept the security warning for the self-signed certificate when prompted. You see the nginx default page because inbound traffic from the internet to the **asg-mgmt** application security group is allowed through port 443.
870+
You see the nginx default page because inbound traffic from the internet to the **asg-mgmt** application security group is allowed through port 8080.
877871
878872
1. Try to access **vm-mgmt** on port 80 by browsing to `http://<public-ip-address-vm-mgmt>` in your browser. The connection fails or times out because no security rule allows port 80 inbound to the **asg-mgmt** application security group.
879873
@@ -917,7 +911,7 @@ You see the nginx default page because inbound traffic from the internet to the
917911
918912
Try to access **vm-web** on port 443 by browsing to `https://<vm-web-ip-address>` in your browser. The connection fails or times out because the security rule for the **asg-web** doesn't allow port 443 inbound from the internet.
919913
920-
Now install nginx with HTTPS on **vm-mgmt**:
914+
Now install nginx on port 8080 on **vm-mgmt**:
921915
922916
```azurepowershell-interactive
923917
$mgmtInstallParams = @{
@@ -928,19 +922,11 @@ $mgmtInstallParams = @{
928922
sudo apt-get update -y
929923
sudo apt-get install -y nginx
930924
931-
# Generate self-signed certificate
932-
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
933-
-keyout /etc/ssl/private/nginx-selfsigned.key \
934-
-out /etc/ssl/certs/nginx-selfsigned.crt \
935-
-subj "/C=US/ST=State/L=City/O=Organization/CN=vm-mgmt"
936-
937-
# Configure nginx for HTTPS
925+
# Configure nginx to listen on port 8080
938926
sudo tee /etc/nginx/sites-available/default > /dev/null <<'EOF'
939927
server {
940-
listen 443 ssl default_server;
941-
listen [::]:443 ssl default_server;
942-
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
943-
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
928+
listen 8080 default_server;
929+
listen [::]:8080 default_server;
944930
root /var/www/html;
945931
index index.html index.htm index.nginx-debian.html;
946932
server_name _;
@@ -967,9 +953,9 @@ $mgmtIP = Get-AzPublicIpAddress @mgmtIPParams
967953
Write-Host "vm-mgmt IP: $($mgmtIP.IpAddress)"
968954
```
969955
970-
To confirm that you can access the **vm-mgmt** web server from the internet on port 443, open an internet browser on your computer and browse to `https://<vm-mgmt-ip-address>`.
956+
To confirm that you can access the **vm-mgmt** web server from the internet on port 8080, open an internet browser on your computer and browse to `http://<vm-mgmt-ip-address>:8080`.
971957
972-
Accept the security warning for the self-signed certificate when prompted. You see the nginx default page because inbound traffic from the internet to the **asg-mgmt** application security group is allowed through port 443.
958+
You see the nginx default page because inbound traffic from the internet to the **asg-mgmt** application security group is allowed through port 8080.
973959
974960
Try to access **vm-mgmt** on port 80 by browsing to `http://<vm-mgmt-ip-address>` in your browser. The connection fails or times out because no security rule allows port 80 inbound to the **asg-mgmt** application security group.
975961
@@ -1008,7 +994,7 @@ curl -k https://$webIP
1008994
1009995
The connection fails or times out because the security rule for the **asg-web** doesn't allow port 443 inbound from the internet.
1010996
1011-
Now install nginx with HTTPS on **vm-mgmt**:
997+
Now install nginx on port 8080 on **vm-mgmt**:
1012998
1013999
```azurecli-interactive
10141000
az vm run-command invoke \
@@ -1017,16 +1003,10 @@ az vm run-command invoke \
10171003
--command-id RunShellScript \
10181004
--scripts "sudo apt-get update -y && \
10191005
sudo apt-get install -y nginx && \
1020-
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
1021-
-keyout /etc/ssl/private/nginx-selfsigned.key \
1022-
-out /etc/ssl/certs/nginx-selfsigned.crt \
1023-
-subj '/C=US/ST=State/L=City/O=Organization/CN=vm-mgmt' && \
10241006
sudo bash -c 'cat > /etc/nginx/sites-available/default <<EOF
10251007
server {
1026-
listen 443 ssl default_server;
1027-
listen [::]:443 ssl default_server;
1028-
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
1029-
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
1008+
listen 8080 default_server;
1009+
listen [::]:8080 default_server;
10301010
root /var/www/html;
10311011
index index.html index.htm index.nginx-debian.html;
10321012
server_name _;
@@ -1045,13 +1025,13 @@ mgmtIP=$(az vm show --show-details --resource-group test-rg --name vm-mgmt --que
10451025
echo "vm-mgmt IP: $mgmtIP"
10461026
```
10471027
1048-
To confirm that you can access the **vm-mgmt** web server from the internet on port 443, use curl:
1028+
To confirm that you can access the **vm-mgmt** web server from the internet on port 8080, use curl:
10491029
10501030
```bash
1051-
curl -k https://$mgmtIP
1031+
curl http://$mgmtIP:8080
10521032
```
10531033
1054-
The `-k` flag tells curl to ignore the self-signed certificate warning. The connection succeeds because inbound traffic from the internet to the **asg-mgmt** application security group is allowed through port 443.
1034+
The connection succeeds because inbound traffic from the internet to the **asg-mgmt** application security group is allowed through port 8080.
10551035
10561036
Try to access **vm-mgmt** on port 80:
10571037
@@ -1097,10 +1077,10 @@ az group delete \
10971077
In this tutorial, you:
10981078
10991079
- Created a network security group and associated it to a virtual network subnet.
1100-
- Created application security groups for web (HTTP) and management (HTTPS) traffic.
1080+
- Created application security groups for web and management traffic.
11011081
- Created two Linux virtual machines with SSH key authentication and associated their network interfaces with the application security groups.
11021082
- Installed nginx web servers on both VMs with different port configurations.
1103-
- Tested the application security group network filtering by demonstrating that vm-web allows port 80 (HTTP) but denies port 443 (HTTPS), while vm-mgmt allows port 443 (HTTPS) but denies port 80 (HTTP).
1083+
- Tested the application security group network filtering by demonstrating that vm-web allows port 80 (HTTP) but denies port 443, while vm-mgmt allows port 8080 but denies port 80 (HTTP).
11041084
11051085
To learn more about network security groups, see [Network security group overview](./network-security-groups-overview.md) and [Manage a network security group](manage-network-security-group.md).
11061086

0 commit comments

Comments
 (0)