Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New-ExternalHelp] Generate incorrect MAML file if example includes [] #662

Open
3 tasks done
BethanyZhou opened this issue Jul 18, 2024 · 0 comments
Open
3 tasks done

Comments

@BethanyZhou
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Copy https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/help/Get-AzNetworkSecurityGroup.md to local.

New-ExternalHelp -Path 'Get-AzNetworkSecurityGroup.md' -OutputPath . -Force

Check the generated xml file, its example is wrong

<command:example>
        <maml:title>---- Example 1: Retrieve an existing network security group ----</maml:title>
        <dev:code>Get-AzNetworkSecurityGroup -Name nsg1 -ResourceGroupName "rg1"</dev:code>
        <dev:remarks>
          <maml:para>```output Name                        : nsg1 ResourceGroupName           : rg1 Location                    : eastus Id                          : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provider                               s/Microsoft.Network/networkSecurityGroups/nsg1 Etag                        : W/"00000000-0000-0000-0000-000000000000" ResourceGuid                : 00000000-0000-0000-0000-000000000000 ProvisioningState           : Succeeded Tags                        : FlushConnection             : False SecurityRules               : [] DefaultSecurityRules        : [                                 {                                   "Name": "AllowVnetInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound",                                   "Description": "Allow inbound traffic from all VMs in VNET",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "DestinationAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "Access": "Allow",                                   "Priority": 65000,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowAzureLoadBalancerInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBou                               nd",                                   "Description": "Allow inbound traffic from azure load balancer",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "AzureLoadBalancer"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Allow",                                   "Priority": 65001,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "DenyAllInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound",                                   "Description": "Deny all inbound traffic",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Deny",                                   "Priority": 65500,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowVnetOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound",                                   "Description": "Allow outbound traffic from all VMs to all VMs in VNET",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "DestinationAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "Access": "Allow",                                   "Priority": 65000,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowInternetOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound",                                   "Description": "Allow outbound traffic from all VMs to Internet",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "Internet"                                   ],                                   "Access": "Allow",                                   "Priority": 65001,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "DenyAllOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound",                                   "Description": "Deny all outbound traffic",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Deny",                                   "Priority": 65500,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 }                               ] NetworkInterfaces           : [] Subnets                     : [] ```</maml:para>
          <maml:para>This command returns contents of Azure network security group "nsg1" in resource group "rg1"</maml:para>
          <maml:para>### Example 2: List existing network security groups using filtering ```powershell Get-AzNetworkSecurityGroup -Name nsg* ```</maml:para>
          <maml:para>```output Name                        : nsg1 ResourceGroupName           : rg1 Location                    : eastus Id                          : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provider                               s/Microsoft.Network/networkSecurityGroups/nsg1 Etag                        : W/"00000000-0000-0000-0000-000000000000" ResourceGuid                : 00000000-0000-0000-0000-000000000000 ProvisioningState           : Succeeded Tags                        : FlushConnection             : False SecurityRules               : [] DefaultSecurityRules        : [                                 {                                   "Name": "AllowVnetInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound",                                   "Description": "Allow inbound traffic from all VMs in VNET",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "DestinationAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "Access": "Allow",                                   "Priority": 65000,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowAzureLoadBalancerInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBou                               nd",                                   "Description": "Allow inbound traffic from azure load balancer",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "AzureLoadBalancer"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Allow",                                   "Priority": 65001,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "DenyAllInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound",                                   "Description": "Deny all inbound traffic",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Deny",                                   "Priority": 65500,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowVnetOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound",                                   "Description": "Allow outbound traffic from all VMs to all VMs in VNET",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "DestinationAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "Access": "Allow",                                   "Priority": 65000,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowInternetOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound",                                   "Description": "Allow outbound traffic from all VMs to Internet",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "Internet"                                   ],                                   "Access": "Allow",                                   "Priority": 65001,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "DenyAllOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound",                                   "Description": "Deny all outbound traffic",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Deny",                                   "Priority": 65500,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 }                               ] NetworkInterfaces           : [] Subnets                     : [] ```</maml:para>
          <maml:para>This command returns contents of Azure network security groups that start with "nsg"</maml:para>
          <maml:para>## PARAMETERS</maml:para>
          <maml:para>### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure.</maml:para>
          <maml:para>```yaml Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential</maml:para>
          <maml:para>Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```</maml:para>
          <maml:para>### -ExpandResource The resource reference to be expanded.</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: Expand Aliases:</maml:para>
          <maml:para>Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ```</maml:para>
          <maml:para>### -Name Specifies the name of the network security group that this cmdlet gets.</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: NoExpand Aliases: ResourceName</maml:para>
          <maml:para>Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: True ```</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: Expand Aliases: ResourceName</maml:para>
          <maml:para>Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: True ```</maml:para>
          <maml:para>### -ResourceGroupName Specifies the name of the resource group that the network security group belongs to.</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: NoExpand Aliases:</maml:para>
          <maml:para>Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: True ```</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: Expand Aliases:</maml:para>
          <maml:para>Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: True ```</maml:para>
          <maml:para>### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).</maml:para>
          <maml:para>## INPUTS</maml:para>
          <maml:para>### System.String</maml:para>
          <maml:para>## OUTPUTS</maml:para>
          <maml:para>### Microsoft.Azure.Commands.Network.Models.PSNetworkSecurityGroup</maml:para>
          <maml:para>## NOTES</maml:para>
          <maml:para>## RELATED LINKS</maml:para>
          <maml:para>[New-AzNetworkSecurityGroup](./New-AzNetworkSecurityGroup.md)</maml:para>
          <maml:para>[Remove-AzNetworkSecurityGroup](./Remove-AzNetworkSecurityGroup.md)</maml:para>
          <maml:para>[Set-AzNetworkSecurityGroup](./Set-AzNetworkSecurityGroup.md)</maml:para>
          <maml:para></maml:para>
          <maml:para>## PARAMETERS</maml:para>
          <maml:para>### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure.</maml:para>
          <maml:para>```yaml Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential</maml:para>
          <maml:para>Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```</maml:para>
          <maml:para>### -ExpandResource The resource reference to be expanded.</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: Expand Aliases:</maml:para>
          <maml:para>Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ```</maml:para>
          <maml:para>### -Name The resource name.</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: NoExpand Aliases: ResourceName</maml:para>
          <maml:para>Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: True ```</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: Expand Aliases: ResourceName</maml:para>
          <maml:para>Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: True ```</maml:para>
          <maml:para>### -ResourceGroupName The resource group name.</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: NoExpand Aliases:</maml:para>
          <maml:para>Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: True ```</maml:para>
          <maml:para>```yaml Type: System.String Parameter Sets: Expand Aliases:</maml:para>
          <maml:para>Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: True ```</maml:para>
          <maml:para>### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).</maml:para>
          <maml:para>## INPUTS</maml:para>
          <maml:para>## OUTPUTS</maml:para>
          <maml:para>## NOTES</maml:para>
          <maml:para>## RELATED LINKS</maml:para>
        </dev:remarks>
      </command:example>

Expected behavior

<command:example>
        <maml:title>---- Example 1: Retrieve an existing network security group ----</maml:title>
        <dev:code>Get-AzNetworkSecurityGroup -Name nsg1 -ResourceGroupName "rg1"
Name                        : nsg1 ResourceGroupName           : rg1 Location                    : eastus Id                          : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provider                               s/Microsoft.Network/networkSecurityGroups/nsg1 Etag                        : W/"00000000-0000-0000-0000-000000000000" ResourceGuid                : 00000000-0000-0000-0000-000000000000 ProvisioningState           : Succeeded Tags                        : FlushConnection             : False SecurityRules               : [] DefaultSecurityRules        : [                                 {                                   "Name": "AllowVnetInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound",                                   "Description": "Allow inbound traffic from all VMs in VNET",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "DestinationAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "Access": "Allow",                                   "Priority": 65000,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowAzureLoadBalancerInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBou                               nd",                                   "Description": "Allow inbound traffic from azure load balancer",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "AzureLoadBalancer"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Allow",                                   "Priority": 65001,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "DenyAllInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound",                                   "Description": "Deny all inbound traffic",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Deny",                                   "Priority": 65500,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowVnetOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound",                                   "Description": "Allow outbound traffic from all VMs to all VMs in VNET",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "DestinationAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "Access": "Allow",                                   "Priority": 65000,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowInternetOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound",                                   "Description": "Allow outbound traffic from all VMs to Internet",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "Internet"                                   ],                                   "Access": "Allow",                                   "Priority": 65001,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "DenyAllOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound",                                   "Description": "Deny all outbound traffic",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Deny",                                   "Priority": 65500,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 }                               ] NetworkInterfaces           : [] Subnets                     : [] </maml:para>
          <maml:para>This command returns contents of Azure network security group "nsg1" in resource group "rg1"</maml:para>
          <maml:para>### Example 2: List existing network security groups using filtering  Get-AzNetworkSecurityGroup -Name nsg* ```</maml:para>
          <maml:para>```output Name                        : nsg1 ResourceGroupName           : rg1 Location                    : eastus Id                          : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provider                               s/Microsoft.Network/networkSecurityGroups/nsg1 Etag                        : W/"00000000-0000-0000-0000-000000000000" ResourceGuid                : 00000000-0000-0000-0000-000000000000 ProvisioningState           : Succeeded Tags                        : FlushConnection             : False SecurityRules               : [] DefaultSecurityRules        : [                                 {                                   "Name": "AllowVnetInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound",                                   "Description": "Allow inbound traffic from all VMs in VNET",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "DestinationAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "Access": "Allow",                                   "Priority": 65000,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowAzureLoadBalancerInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBou                               nd",                                   "Description": "Allow inbound traffic from azure load balancer",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "AzureLoadBalancer"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Allow",                                   "Priority": 65001,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "DenyAllInBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound",                                   "Description": "Deny all inbound traffic",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Deny",                                   "Priority": 65500,                                   "Direction": "Inbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowVnetOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound",                                   "Description": "Allow outbound traffic from all VMs to all VMs in VNET",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "DestinationAddressPrefix": [                                     "VirtualNetwork"                                   ],                                   "Access": "Allow",                                   "Priority": 65000,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "AllowInternetOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound",                                   "Description": "Allow outbound traffic from all VMs to Internet",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "Internet"                                   ],                                   "Access": "Allow",                                   "Priority": 65001,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 },                                 {                                   "Name": "DenyAllOutBound",                                   "Etag": "W/\"00000000-0000-0000-0000-000000000000\"",                                   "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide                               rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound",                                   "Description": "Deny all outbound traffic",                                   "Protocol": "*",                                   "SourcePortRange": [                                     "*"                                   ],                                   "DestinationPortRange": [                                     "*"                                   ],                                   "SourceAddressPrefix": [                                     "*"                                   ],                                   "DestinationAddressPrefix": [                                     "*"                                   ],                                   "Access": "Deny",                                   "Priority": 65500,                                   "Direction": "Outbound",                                   "ProvisioningState": "Succeeded",                                   "SourceApplicationSecurityGroups": [],                                   "DestinationApplicationSecurityGroups": []                                 }                               ] NetworkInterfaces           : [] Subnets                     : []
</dev:code>
        <dev:remarks>
        </dev:remarks>
      </command:example>

Actual behavior

Generate example correctly

Error details

No response

Environment data

get-module -Name PLATYPS -ListAvailable

Script     0.14.2                platyPS                             Desk      {New-MarkdownHelp, Get-MarkdownMetadata}

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.6
PSEdition                      Core
GitCommitId                    7.3.6
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

@BethanyZhou BethanyZhou added the Needs-Triage The issue is new and needs to be triaged by a work group. label Jul 18, 2024
@sdwheeler sdwheeler added platyps-0.14.2 and removed Needs-Triage The issue is new and needs to be triaged by a work group. labels Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants