What are Azure Application Security Groups (ASG)?

Azure Application Security Groups are a feature in Azure that simplify network security management by enabling the grouping of virtual machines (VMs) into logical groups based on the applications they are hosting, rather than their IP addresses. This grouping allows network security rules to be defined based on the application needs, making it easier to apply the same set of rules across multiple VMs that are running the same application.

For example, consider an application that consists of a web server and a database server. By placing the web server and the database server into separate Application Security Groups, network security rules can be defined to allow traffic from the web server to the database server only, while denying all other traffic. This simplifies network security management as the rules can be defined based on the application requirements rather than the IP addresses of the VMs.

Application Security Groups are created and managed in the Azure Portal or through PowerShell and the Azure CLI. They can be associated with network security groups (NSGs) to apply the defined network security rules to the VMs in the group.

For example, suppose you have several web servers and several database servers in different subnets. With ASGs, you can group all the web servers in one ASG and all the database servers in another ASG. You can then create NSG rules that allow traffic from the web servers ASG to the database servers ASG, without needing to specify the IP addresses of each server individually.

Here is an example scenario:

Suppose you have two VMs running in separate subnets in your Azure Virtual Network – a web server and a database server. The web server needs to communicate with the database server over port 1433 for SQL traffic. You can create two ASGs, one for the web servers and one for the database servers. Then you can create a rule in the web server NSG that allows traffic to the database server ASG over port 1433.

To create an ASG, you can use the Azure portal, Azure PowerShell, Azure CLI, or Azure Cloud Shell. Here is an example PowerShell command to create an ASG:

New-AzApplicationSecurityGroup -Name "WebServers" -ResourceGroupName "MyResourceGroup" -Location "EastUS"

This command creates a new ASG named “WebServers” in the “MyResourceGroup” resource group and in the “EastUS” region. Once the ASG is created, you can add VMs to it using their network interface resource IDs or by using a VM tag that matches the ASG name.

Author: tonyhughes