0
votes

I would like to create a set of rules for my NSG outbound section to allow connections to Azure services only. There is the article of how to achieve this with PowerShell but I use Linux with Azure CLI.

Everything looks quite easy except the problem related to the number of rules: for Europe West region it is 349 currently. So, adding them rule by rule with 'network nsg rule create' command will take hours.

Are there any way to automate adding of rules as a group with Azure CLI?

2

2 Answers

1
votes

I would suggest doing this by using ARM templates. In my experience you can describe the rules in arm templates (groups). And than apply them on your infrastructure like Infrastructure as Code. This is a lot faster as using powershell and add them one by one.

virtual-networks-create-nsg-arm-template

0
votes

I've found a solution using parallelizing of the task on my side, but @Peter's idea looks much more appropriate.