A company is migrating its infrastructure to Azure but wants to implement strict security controls for its virtual machines (VMs). Their challenges include:
For all the resources in this lab, we are using the East US region.
In this lab, you will complete the following exercises:
Note: Please ensure that you have created an Azure Account with active subscription credit (Azure Portal), or subscribe to Azure Student Package.
In this exercise, you will complete the following tasks:
Start a browser session and sign in to Azure Portal.
In the Search resources, services, and docs text box, type Virtual Machines and press Enter.
Click Create > Azure Virtual Machine.
Configure the following settings:
Setting | Value |
---|---|
Subscription | choose-your-subscription |
Resource Group | CyberP-Project |
VM Name | SecureVM1 |
Region | East US |
Availability | No Availability |
Security type | Standard |
Image | Ubuntu Server 22.04 LTS |
Architecture | x64 |
Size | Standard_D2s_v3 - 2vcpus, 8 Gib |
Authentication | SSH Key (setup your usename) |
Public inbound ports | None |
Click Networking.
Create a new Virtual network.
Configure the following settings:
Setting | Value |
---|---|
Name | secure-vnet |
Address range | 192.168.0.0/16 |
Subnet name | subnet1 |
subnet address | 192.168.1.0/24 |
Click OK.
Click Review + Create and deploy the VM.
Use the icon (top right) to launch a Cloud Shell session. Alternately, navigate directly to https://shell.azure.com.
Be sure to select Bash. If necessary, configure the shell storage.
Run the following command to create a virtual machine. When prompted, provide a username and password for the VM. While you wait check out the az vm create command reference for all the parameters associated with creating a virtual machine.
az vm create --name myCLIVM --resource-group CyberProject --image Ubuntu2204 --admin-username localadmin --generate-ssh-keys
Once the command completes, use az vm show to verify your machine was created.
az vm show --name myCLIVM --resource-group CyberProject --show-details
Verify the powerState is VM Running.
Network Security Groups (NSG) act as firewalls that control inbound and outbound traffic to a VM.
In this exercise, you will complete the following tasks:
Click Create NSG and configure the following:
Setting | Value |
---|---|
Name | SecureVM-NSG |
Resource Group | CyberP-Project |
Region | East US |
Open SecureVM-NSG.
On the left pane, click Settings then select Inbound security rules
Click Add then Define the following policies:
Settings | Action |
---|---|
Source | Any |
Source port ranges | * |
Destination | Any |
Service | SSH |
Action | Allow |
Result: NSG rules are applied, ensuring controlled access to the VM.
Click Add.
On the left pane, click Settings then select Outbound security rules
Click Add then Define the following policies:
Settings | Action |
---|---|
Source | Any |
Source port ranges | * |
Destination | Any |
Service | SSH |
Action | Allow |
Result: NSG rules are applied, ensuring controlled access to the VM.
Since we have a Linux server, we need port 22 open for remote access.
Open SecureVM-NSG.
On the left pane, Under Settings, click Subnets.
Click on + Associate button.
Select Secure-vnet, and select subnet1.
Click Associate.
This applies the rule to every VM in the subnet, so in production scenario, grouping related vm together using ASG first, then applying NSG on the ASG would be better. Learn how to create ASG below.
Application Security Groups (ASG) group VMs based on their role for easier security management.
In this exercise, you will complete the following tasks:
Click Create ASG and define:
Setting | Value |
---|---|
ASG Name | WebServers |
Resource Group | CyberP-Project |
Region | East US |
Click Add then Define the following policies:
Settings | Action |
---|---|
Source | Any |
Source port ranges | * |
Destination | Application security group (WebServers) |
Service | HTTPS |
Action | Allow |
Result: Security policies are dynamically applied based on ASG groups.
Side Task: Deploy an additional VM, assign ASG, and verify traffic flow restrictions. Upload findings to LinkedIn with hashtags #CloudSecurityWithCyberPreacher #CPwCP.
Note: Remember to delete resources after the lab to avoid unnecessary costs (delete entire resource group to remove everything done).