< Back

Remove-AzureNSGRuleForRemoteLocation

Tue Jan 14, 2020 12:37 am

NAME Remove-AzureNSGRuleForRemoteLocation



SYNOPSIS

Removes a custom rule from NSG(s).





SYNTAX

Remove-AzureNSGRuleForRemoteLocation [-SubscriptionId] <Object> [-rgName] <Object> [-vmName] <Object> [[-ruleName]

<Object>] [<CommonParameters>]





DESCRIPTION

This cmdlet removes a custom rule from NSG(s) tied to a VM.





PARAMETERS

-SubscriptionId <Object>

Subscription ID for the subscription that virtual machine is on. Required



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-rgName <Object>

The Resource Group the virtual machine belongs to. Required



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-vmName <Object>

The name of the virtual machine. Required



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ruleName <Object>

Provide a name for the custom rule, if no name is provided system will look for default name

"AllowRuleForRemoteLocation" .



Required? false

Position? 4

Default value AllowRuleForRemoteLocation

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Author : Hannel Hazeley - hhazeley@outlook.com



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Remove-AzureNSGRuleForRemoteLocation -SubscriptionId 1d6737e7-4f6c-4e3c-8cd4-996b6f003d0e -rgName DDemo

-vmName DDemo-VM3



This searches for default rule "AllowRuleForRemoteLocation" and remove it from NSG(s) tied to VM









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Remove-AzureNSGRuleForRemoteLocation -SubscriptionId ad3d5476-1607-4a62-b3e9-ce3eb2472c57 -rgName DDemo

-vmName DDemo-VM3 -ruleName AllowSSH2



This searches for rule "AllowSSH2" and remove it from NSG(s) tied to VM











RELATED LINKS

https://github.com/hhazeley/HannelsTool ... cation.ps1