Hi @Aditya Pai
You can add an inbound rule to the network security group (NSG) of a virtual machine scale set (VMSS) by using an ARM template. Here is an example of how to add an inbound rule to the NSG of a VMSS attached to a network interface via ARM template:
{
"apiVersion": "2018-06-01",
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"name": "[concat(parameters('nsgName'), '/', parameters('ruleName'))]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('nsgName'))]"
],
"properties": {
"protocol": "[parameters('protocol')]",
"sourcePortRange": "*",
"destinationPortRange": "[parameters('destinationPortRange')]",
"sourceAddressPrefix": "[parameters('sourceAddressPrefix')]",
"destinationAddressPrefix": "[parameters('destinationAddressPrefix')]",
"access": "[parameters('access')]",
"priority": "[parameters('priority')]",
"direction": "[parameters('direction')]"
}
}
In this example, you need to provide the following parameters:
-
nsgName
: The name of the NSG. -
ruleName
: The name of the rule you want to create. -
location
: The location of the NSG. -
protocol
: The protocol of the rule (TCP, UDP, or *). -
destinationPortRange
: The destination port range of the rule. -
sourceAddressPrefix
: The source address prefix of the rule. -
destinationAddressPrefix
: The destination address prefix of the rule. -
access
: The access of the rule (Allow or Deny). -
priority
: The priority of the rule. -
direction
: The direction of the rule (Inbound or Outbound).
You can use this template to add an inbound rule to the NSG of a VMSS attached to a network interface.
Hope this helps!
If I have answered your query, please click "Accept as answer" as a token of appreciation