Inbound rule for agentpool (aks-nodepool) via ARM template

Aditya Pai 5 Reputation points
2024-09-02T06:39:32.55+00:00

How can I add a inbound rule to NSG of VMSS, attached to network Interface via ARM template?

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,147 questions
Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
408 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Prrudram-MSFT 25,321 Reputation points
    2024-09-02T06:51:54.3733333+00:00

    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


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.