ARM template for VM that includes ASG( application security group)

Mike 20 Reputation points
2023-07-17T16:33:36.9+00:00

Hello,

I am working migrating our citrix environment to Azure. We use their app layering Appliance which uses ARM templates. We also use application security groups that each VM needs to be added to. For the life of me I cannot find anything about adding a vm to an ASG in the ARM template. Would anyone be able to point me in the right direction? If you cannot do it in an ARM template. Is there a way to auto add it to everything in a resource group?

Thank you in advance for any assistance.

Mike

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,764 questions
0 comments No comments
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 49,536 Reputation points Microsoft Employee Moderator
    2023-07-18T04:18:37.7233333+00:00

    @Mike

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you would like to know how to add an VM to an ASG using ARM Templates.

    Technically, you can do it in a couple of ways.

    With Powershell,

    $vnet = Get-AzVirtualNetwork -Name myvnet -ResourceGroupName myrg
    $subnet = Get-AzVirtualNetworkSubnetConfig -Name mysubnet -VirtualNetwork $vnet
    $asg = Get-AzApplicationSecurityGroup -Name myasg -ResourceGroupName myrg
    $nic = Get-AzNetworkInterface -Name nic1 -ResourceGroupName myrg
    $nic | Set-AzNetworkInterfaceIpConfig -Name ipconfig1 -PrivateIpAddress 10.0.0.11 -Subnet $subnet -ApplicationSecurityGroup $asg -Primary
    $nic | Set-AzNetworkInterface
    

    Kindly let us know if this helps or you need further assistance on this issue.

    Thanks,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful

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.