1
votes

a) I have an existing virtual network named "my-network1"

b) This network has an existing subnet called "my-subnet1"

c) I want to create a new Network Security Group called "my-nsg1" with a rule that permits all traffic inbound on port 9999 to "my-subnet1"

Can someone please help with the list of Azure CLI "network" commands to acheive this? All the examples online are using powershell which I cannot use on my Mac. Also how can I see what NSG is associated with a given VNET/Subnet with the CLI?

1

1 Answers

-2
votes

You can see nsg groups using xplat-cli. Check https://github.com/Azure/azure-xplat-cli for more details.

When you have it installed (credentials configured, keys, etc) you can simply check NSG with the command "azure network nsg --help". The --help function is well explained.

Ps.: You might encounter some issues to assign a NSG depending on which type of VNET you created. I see Azure has a Classic and a Resource Manager VNET. Apparently you can only assign NSG to Resource Manager VNETs.