azure-cli
azure-cli copied to clipboard
SDN network nsg rule list not showing default rules
When calling the following command: az network nsg rule list -g "IMDS_Demo" --nsg-name "MyNSG"
[
{
"access": "Allow",
"description": null,
"destinationAddressPrefix": "10.0.0.0/24",
"destinationPortRange": "22",
"direction": "Inbound",
"etag": "W/\"9efafe10-e175-4e84-8bc9-1e9b5a67a559\"",
"id": "/subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_Demo/providers/Microsoft.Network/networkSecurityGroups/MyNSG/securityRules/MyRule",
"name": "MyRule",
"priority": 1000,
"protocol": "UDP",
"provisioningState": "Succeeded",
"resourceGroup": "IMDS_Demo",
"sourceAddressPrefix": "*",
"sourcePortRange": "*"
}
]
On PS CLI it also shows the defaultRules array:
PS C:\> azure network nsg rule list -g "IMDS_Demo" --nsg-name "MyNSG"
info: Executing command network nsg rule list
+ Looking up the network security group "MyNSG"
data: Security rules:
data: Name Source IP Source Port Destination IP Destination Port Protocol Direction Access Priority
data: ----------------------------- ----------------- ----------- -------------- ---------------- -------- --------- ------ --------
data: MyRule * * 10.0.0.0/24 22 UDP Inbound Allow 1000
data: AllowVnetInBound VirtualNetwork * VirtualNetwork * * Inbound Allow 65000
data: AllowAzureLoadBalancerInBound AzureLoadBalancer * * * * Inbound Allow 65001
data: DenyAllInBound * * * * * Inbound Deny 65500
data: AllowVnetOutBound VirtualNetwork * VirtualNetwork * * Outbound Allow 65000
data: AllowInternetOutBound * * Internet * * Outbound Allow 65001
data: DenyAllOutBound * * * * * Outbound Deny 65500
info: network nsg rule list command OK
This will not work like PS but we will expose a --include-default flag to include the default security rules in the output. To change the default behavior would introduce a breaking change.
Sounds good to me, it's hard to change a default behavior :(