Not at all clear documentation.
Description of the new feature
Transferring this issue#1877 from azure-docs-powershell to azure-powershell repo.
FYI @dcaro and @Raag007
Proposed implementation details (optional)
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 2b963d11-ab7f-b257-2ec2-89e1327f1b0a
- Version Independent ID: dc1846a2-4d0a-fd2b-ecd1-1670435e86b6
- Content: Set-AzNetworkSecurityRuleConfig (Az.Network)
- Content Source: src/Network/Network/help/Set-AzNetworkSecurityRuleConfig.md
- Service: virtual-network
- GitHub Login: @dcaro
- Microsoft Alias: dcaro
Description: https://github.com/MicrosoftDocs/azure-docs-powershell/issues/1877#issuecomment-913783460 On your sandbox, when you get a chance please try to run these commands provided in this document.
$nsg = Get-AzNetworkSecurityGroup -Name "NSG-FrontEnd" -ResourceGroupName "TestRG"
$nsg | Get-AzNetworkSecurityRuleConfig -Name "rdp-rule"
Set-AzNetworkSecurityRuleConfig -Name "rdp-rule" -NetworkSecurityGroup $nsg -Access "Deny"
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.
Issue Details
Description of the new feature
Transferring this issue#1877 from azure-docs-powershell to azure-powershell repo.
FYI @dcaro and @Raag007
Proposed implementation details (optional)
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 2b963d11-ab7f-b257-2ec2-89e1327f1b0a
- Version Independent ID: dc1846a2-4d0a-fd2b-ecd1-1670435e86b6
- Content: Set-AzNetworkSecurityRuleConfig (Az.Network)
- Content Source: src/Network/Network/help/Set-AzNetworkSecurityRuleConfig.md
- Service: virtual-network
- GitHub Login: @dcaro
- Microsoft Alias: dcaro
Description: https://github.com/MicrosoftDocs/azure-docs-powershell/issues/1877#issuecomment-913783460 On your sandbox, when you get a chance please try to run these commands provided in this document.
$nsg = Get-AzNetworkSecurityGroup -Name "NSG-FrontEnd" -ResourceGroupName "TestRG"
$nsg | Get-AzNetworkSecurityRuleConfig -Name "rdp-rule"
Set-AzNetworkSecurityRuleConfig -Name "rdp-rule" -NetworkSecurityGroup $nsg -Access "Deny"
| Author: | HarshitaSingh-MSFT |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
@Raag007 , Get-AzNetworkSecurityRuleConfig tries to find rule config according to the name. It doesn't explain how security in example was created. It should have a rule named rdp-rule. If your security group doesn't contain it, the command will show error.
https://github.com/Azure/azure-powershell/blob/2a56655a3ccfd9b2d0fc6d674a42f512d457e6ae/src/Network/Network/NetworkSecurityGroup/NetworkSecurityRule/GetAzureNetworkSecurityRuleConfigCommand.cs#L43
Technically, it should fix below code and avoid to return Get-AzNetworkSecurityRuleConfig: Sequence contains no matching element
https://github.com/Azure/azure-powershell/blob/2a56655a3ccfd9b2d0fc6d674a42f512d457e6ae/src/Network/Network/NetworkSecurityGroup/NetworkSecurityRule/GetAzureNetworkSecurityRuleConfigCommand.cs#L50
Get-AzNetworkSecurityRuleConfig
The behavior of outputting that message, prevents the usage of Get-AzNetworkSecurityRuleConfig on conditional clauses like:
~ (Get-AzNetworkSecurityRuleConfig -Name 'AzureBasicInfrastructure' -NetworkSecurityGroup $nsg) -eq $null
Get-AzNetworkSecurityRuleConfig: Sequence contains no matching element
Hello,
Just checking if this issue was already resolved. The documentation says the ""rdp-rule" is "user defined" which appears to explain how the security rule in the example was created. Does that satisfy this request?