2026-09-05 · 12 min read · Infrastructure Revamp

Comprehensive Azure Firewall Setup and Configuration Guide for SMBs

Azure Firewall protecting cloud network traffic, illustrating its setup and configuration guide.

As a growing SMB, ensuring robust network security for your Azure cloud environment is paramount. Uncontrolled outbound access or inadequate threat protection can expose your critical applications and data to significant risks. This is where Azure Firewall comes in, acting as your cloud-native, intelligent network security service to provide top-tier threat protection.

At SkyCore Solutions, we frequently guide Montreal-based SMBs through enhancing their Azure security posture. This comprehensive Azure Firewall setup and configuration guide is designed to walk you through deploying and configuring Azure Firewall to control both inbound and outbound network traffic, securing your valuable Azure workloads, and achieving compliance. By the end of this guide, you will have a fully functional Azure Firewall protecting a sample workload, with custom rules dictating network access.

Prerequisites

Step 1: Set up the Network Environment for Azure Firewall

Before deploying Azure Firewall, we need a dedicated network infrastructure. This involves creating a resource group to logically organize all our resources, a virtual network (VNet), and specific subnets: one for the Azure Firewall itself (AzureFirewallSubnet) and another for our workload servers (Workload-SN). The AzureFirewallSubnet requires a specific naming convention and a minimum size of /26 for proper functionality.


az group create --name Test-FW-RG --location westus

az network vnet create \
    --name Test-FW-VN \
    --resource-group Test-FW-RG \
    --location westus \
    --address-prefix 10.0.0.0/16 \
    --subnet-name AzureFirewallSubnet \
    --subnet-prefix 10.0.0.0/26

az network vnet subnet create \
    --name Workload-SN \
    --vnet-name Test-FW-VN \
    --resource-group Test-FW-RG \
    --address-prefix 10.0.2.0/24

Portal alternative: Navigate to 'Resource groups' > 'Create', then 'Virtual networks' > 'Create'. During VNet creation, you can add subnets under the 'IP addresses' tab. Ensure to name the Firewall subnet exactly AzureFirewallSubnet.

Pro tip: While this guide uses a single VNet for simplicity, for production environments, SkyCore Solutions recommends a hub-and-spoke topology. The Azure Firewall would reside in a central 'hub' VNet, peered with 'spoke' VNets containing your workloads. This offers better segmentation and scalability.

Run this to verify:


az network vnet show --name Test-FW-VN --resource-group Test-FW-RG --query "subnets[].name" -o tsv

You should see AzureFirewallSubnet and Workload-SN listed.

Step 2: Deploy Azure Firewall Standard with a Firewall Policy

Now that our network is ready, we'll deploy the Azure Firewall itself. For SMBs, we highly recommend the Azure Firewall Standard SKU. It provides L3-L7 filtering, incorporates Microsoft's real-time threat intelligence feeds, and offers superior protection compared to Basic, without the additional cost of Premium's IDPS features which might be overkill for many SMBs initially. We will also create a Firewall Policy, which is the preferred method for managing rules, even for a single firewall.


az network public-ip create \
    --name fw-pip \
    --resource-group Test-FW-RG \
    --location westus \
    --sku Standard \
    --allocation-method Static

az network firewall create \
    --name Test-FW01 \
    --resource-group Test-FW-RG \
    --location westus \
    --sku Standard \
    --tier Standard \
    --virtual-network Test-FW-VN \
    --public-ip-address fw-pip \
    --firewall-policy null # This will create a classic firewall, we will attach a policy later if we want.

# Note: The above command deploys using classic rules directly. Let's adapt to use Firewall Policy from the start, as it's the preferred method.
# First, create the Firewall Policy, then associate it during firewall creation (or update if already created).

az network firewall policy create \
    --name Test-FW-Policy \
    --resource-group Test-FW-RG \
    --location westus

# Now, deploy the firewall and associate the policy.
# If you already ran the 'firewall create' command above, you can update it:

az network firewall update \
    --name Test-FW01 \
    --resource-group Test-FW-RG \
    --firewall-policy Test-FW-Policy

# Or, if starting fresh (preferred for policy management):
# az network firewall create \
#    --name Test-FW01 \
#    --resource-group Test-FW-RG \
#    --location westus \
#    --sku Standard \
#    --tier Standard \
#    --virtual-network Test-FW-VN \
#    --public-ip-address fw-pip \
#    --firewall-policy Test-FW-Policy

Portal alternative: Go to 'Firewalls' > 'Create'. Fill in the basics, choose 'Standard' for SKU, 'West US' for region. For 'Firewall Policy', select 'Create new' and provide a name (e.g., Test-FW-Policy). For 'Public IP address', select 'Create new' and name it fw-pip. Ensure the VNet is Test-FW-VN.

Common pitfall: Azure Firewall, especially the Standard SKU, incurs a significant cost. Always review Azure Firewall pricing to understand the hourly charges and data processing costs. Ensure you plan for this expense in your budget.

Run this to verify: Get the private IP of your firewall, which will be needed for routing.


FIREWALL_PRIVATE_IP=$(az network firewall show -g Test-FW-RG -n Test-FW01 --query "ipConfigurations[0].privateIpAddress" -o tsv)
echo "Azure Firewall Private IP: $FIREWALL_PRIVATE_IP"

Step 3: Deploy a Workload Virtual Machine for Testing

To demonstrate Azure Firewall's capabilities, we'll deploy a simple Ubuntu Linux virtual machine into the Workload-SN subnet. Crucially, this VM will *not* have a public IP address. This ensures that all its outbound internet traffic is forced through the Azure Firewall, allowing us to enforce our security rules effectively.


az vm create \
    --name Srv-Work \
    --resource-group Test-FW-RG \
    --image Ubuntu2204 \
    --vnet-name Test-FW-VN \
    --subnet Workload-SN \
    --size Standard_B2s \
    --admin-username azureuser \
    --generate-ssh-keys \
    --no-wait # Continue without waiting for VM creation to complete

# Deploy Azure Bastion for secure access to the VM
az network public-ip create --resource-group Test-FW-RG --name Bastion-PIP --sku Standard --allocation-method Static
az network vnet subnet create --resource-group Test-FW-RG --vnet-name Test-FW-VN --name AzureBastionSubnet --address-prefix 10.0.1.0/27
az network bastion create --name Test-Bastion --public-ip-address Bastion-PIP --resource-group Test-FW-RG --vnet-name Test-FW-VN --location westus

Portal alternative: Go to 'Virtual machines' > 'Create'. Select 'Ubuntu Server 22.04 LTS'. On the 'Networking' tab, ensure 'Virtual network' is Test-FW-VN and 'Subnet' is Workload-SN. For 'Public IP', select '(None)'. For Bastion, search 'Bastion' in the portal, then 'Create', choosing Test-FW-VN and Bastion-PIP for the public IP. Ensure the Bastion subnet is AzureBastionSubnet.

Run this to verify: Wait for the VM to finish deploying (can take a few minutes). Then verify its network interface has no public IP.


az vm show --resource-group Test-FW-RG --name Srv-Work --query "networkProfile.networkInterfaces[0].id" -o tsv
# (Wait for the above command to return the NIC ID, then run:)
az network nic show --ids $(az vm show --resource-group Test-FW-RG --name Srv-Work --query "networkProfile.networkInterfaces[0].id" -o tsv) --query "ipConfigurations[0].publicIpAddress" -o tsv

This last command should return 'null' or an empty string, indicating no public IP.

Step 4: Configure User-Defined Route (UDR) to Direct Traffic to Azure Firewall

For your Workload-SN subnet to send all its outbound traffic through the Azure Firewall, we need to implement a User-Defined Route (UDR). This UDR will instruct the subnet to forward all traffic destined for 0.0.0.0/0 (i.e., the internet) to the private IP address of your Azure Firewall. This is a critical step to ensure the firewall inspects and filters all traffic.


FIREWALL_PRIVATE_IP=$(az network firewall show -g Test-FW-RG -n Test-FW01 --query "ipConfigurations[0].privateIpAddress" -o tsv)

az network route-table create \
    --name RT-FW \
    --resource-group Test-FW-RG \
    --location westus

az network route-table route create \
    --name FW-Route \
    --resource-group Test-FW-RG \
    --route-table-name RT-FW \
    --address-prefix 0.0.0.0/0 \
    --next-hop-type VirtualAppliance \
    --next-hop-ip-address $FIREWALL_PRIVATE_IP

az network vnet subnet update \
    --name Workload-SN \
    --vnet-name Test-FW-VN \
    --resource-group Test-FW-RG \
    --route-table RT-FW

Portal alternative: Search for 'Route tables' > 'Create'. After creation, open the route table, select 'Routes' > 'Add'. Set 'Route name' to FW-Route, 'Address prefix' to 0.0.0.0/0, 'Next hop type' to 'Virtual appliance', and 'Next hop address' to your firewall's private IP. Then, go to 'Subnets' > 'Associate' and select Test-FW-VN and Workload-SN.

Run this to verify:


az network vnet subnet show -g Test-FW-RG -n Workload-SN --vnet-name Test-FW-VN --query "routeTable.name" -o tsv

This should output RT-FW.

Step 5: Define Azure Firewall Rules with Firewall Policy

Azure Firewall, by default, denies all traffic. We must explicitly define rules to allow specific outbound (and potentially inbound) connections. We'll use the Firewall Policy created earlier to define both Application Rules (for FQDNs) and Network Rules (for IP addresses, protocols, and ports). Remember that rule processing prioritizes DNAT rules, then Network rules, and finally Application rules.


# Define a variable for the Firewall Policy name
FIREWALL_POLICY_NAME="Test-FW-Policy"

# Create an Application Rule Collection
az network firewall policy rule-collection-group collection add-application-collection \
    --name AppCollection01 \
    --policy-name $FIREWALL_POLICY_NAME \
    --resource-group Test-FW-RG \
    --priority 100 \
    --action Allow

# Add an Application Rule to allow access to www.google.com
az network firewall policy rule-collection-group collection rule add-application-rule \
    --collection-name AppCollection01 \
    --name AllowGoogle \
    --policy-name $FIREWALL_POLICY_NAME \
    --resource-group Test-FW-RG \
    --source-addresses '*' \
    --protocols Http Https \
    --target-fqdns www.google.com

# Create a Network Rule Collection
az network firewall policy rule-collection-group collection add-network-collection \
    --name NetCollection01 \
    --policy-name $FIREWALL_POLICY_NAME \
    --resource-group Test-FW-RG \
    --priority 200 \
    --action Allow

# Add a Network Rule to allow outbound DNS access (port 53 UDP/TCP)
# This is crucial for FQDN resolution
az network firewall policy rule-collection-group collection rule add-network-rule \
    --collection-name NetCollection01 \
    --name AllowDNS \
    --policy-name $FIREWALL_POLICY_NAME \
    --resource-group Test-FW-RG \
    --protocols UDP TCP \
    --source-addresses '*' \
    --destination-addresses '*' \
    --destination-ports 53

Portal alternative: Go to your Firewall Policy (Test-FW-Policy) > 'Rule collections'. Select '+ Add a rule collection'. For Application rule: 'Name' AppCollection01, 'Priority' 100, 'Action' Allow. Under 'Rules', 'Name' AllowGoogle, 'Source type' IP Address, 'Source' *, 'Protocol' http, https, 'Target FQDNs' www.google.com. For Network rule: Select '+ Add a rule collection'. 'Name' NetCollection01, 'Priority' 200, 'Action' Allow. Under 'Rules', 'Name' AllowDNS, 'Source type' IP Address, 'Source' *, 'Protocol' UDP, TCP, 'Destination type' IP Address, 'Destination' *, 'Destination ports' 53.

Common pitfall: Forgetting to add DNS (port 53) network rules is a frequent mistake. If your application rules rely on FQDNs, the firewall needs to be able to resolve those FQDNs, which requires outbound DNS access. Without this, FQDN-based rules will fail.

Run this to verify:


az network firewall policy rule-collection-group collection show -n AppCollection01 --policy-name Test-FW-Policy -g Test-FW-RG --query "rules[0].name" -o tsv
az network firewall policy rule-collection-group collection show -n NetCollection01 --policy-name Test-FW-Policy -g Test-FW-RG --query "rules[0].name" -o tsv

You should see AllowGoogle and AllowDNS respectively.

Step 6: Test the Azure Firewall Configuration

With the firewall deployed, UDR configured, and rules in place, it's time to test if our Azure Firewall setup and configuration guide has been successful. We'll connect to the Srv-Work VM using Azure Bastion and attempt to access allowed and blocked resources.

Connect to the VM:


# Get the SSH private key you downloaded when creating the VM
# For example, if you saved it as Srv-Work_key.pem:
chmod 400 Srv-Work_key.pem

# Get the private IP of the Workload VM
VM_PRIVATE_IP=$(az vm list-ip-addresses -g Test-FW-RG -n Srv-Work --query "[0].virtualMachine.network.privateIpAddresses[0]" -o tsv)
echo "Workload VM Private IP: $VM_PRIVATE_IP"

# Use Azure CLI to connect via Bastion (this will open a browser tab for SSH)
az network bastion ssh --name Test-Bastion --resource-group Test-FW-RG --target-ip $VM_PRIVATE_IP --auth-type SshKey --username azureuser --ssh-key Srv-Work_key.pem

Portal alternative: Go to 'Virtual machines' > Srv-Work. Select 'Connect' > 'Bastion'. Provide your username (azureuser) and the path to your SSH private key file (Srv-Work_key.pem). This will open a new browser tab with an SSH session.

Once connected to Srv-Work, run the following commands:


# Update package list (requires internet access - should be allowed by firewall)
sudo apt update

# Install curl for web testing
sudo apt install -y curl

# Test access to www.google.com (should succeed due to Application Rule)
curl -I www.google.com

# Test access to a known blocked site (e.g., www.microsoft.com - should fail, as no rule explicitly allows it)
curl -I www.microsoft.com

# Test DNS resolution (should succeed due to Network Rule for port 53)
dig www.google.com

Expected outcomes:

When to bring in a consultant

While this guide covers a fundamental Azure Firewall setup, real-world SMB environments often have complexities that benefit from expert guidance. Consider engaging SkyCore Solutions if you're dealing with:

Our team of Azure architects specializes in tailoring cloud security solutions to the unique needs of SMBs, ensuring your infrastructure is secure, efficient, and compliant.

Book a free consultation

By following this Azure Firewall setup and configuration guide, you've successfully deployed a critical security component in your Azure environment. You've learned how to leverage Azure Firewall Standard, enforce outbound traffic rules using Firewall Policies, and ensure your workloads communicate securely. This foundational setup provides a strong starting point for protecting your SMB's cloud infrastructure against a wide range of network threats.

Remember that security is an ongoing process. Regularly review your firewall rules, keep an eye on Microsoft's threat intelligence updates, and consider advanced features as your security needs evolve. SkyCore Solutions is always here to help you navigate these complexities and ensure your cloud strategy remains robust and secure.

References