次の方法で共有


Remove-AzNetworkSecurityRuleConfig

ネットワーク セキュリティ グループからネットワーク セキュリティ規則を削除します。

構文

Default (既定)

Remove-AzNetworkSecurityRuleConfig
    [-Name <String>]
    -NetworkSecurityGroup <PSNetworkSecurityGroup>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

説明

Remove-AzNetworkSecurityRuleConfig コマンドレットは、Azure ネットワーク セキュリティ グループからネットワーク セキュリティ規則の構成を削除します。

例 1: ネットワーク セキュリティ規則の構成を削除する

$rule1 = New-AzNetworkSecurityRuleConfig -Name "rdp-rule" -Description "Allow RDP" -Access "Allow" -Protocol "Tcp" -Direction "Inbound" -Priority 100 -SourceAddressPrefix "Internet" -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389
$nsg = New-AzNetworkSecurityGroup -ResourceGroupName "TestRG" -Location "westus" -Name "NSG-FrontEnd" -SecurityRules $rule1
Remove-AzNetworkSecurityRuleConfig -Name "rdp-rule" -NetworkSecurityGroup $nsg
$nsg | Set-AzNetworkSecurityGroup

最初のコマンドは、rdp-rule という名前のネットワーク セキュリティ規則構成を作成し、$rule 1 変数に格納します。 2 番目のコマンドは、$rule 1 の規則を使用してネットワーク セキュリティ グループを作成し、ネットワーク セキュリティ グループを $nsg 変数に格納します。 3 番目のコマンドは、rdp-rule という名前のネットワーク セキュリティ規則の構成を、$nsgのネットワーク セキュリティ グループから削除します。 次のコマンドは、変更を保存します。

パラメーター

-DefaultProfile

Azure との通信に使用される資格情報、アカウント、テナント、サブスクリプション。

パラメーターのプロパティ

型:IAzureContextContainer
規定値:None
ワイルドカードのサポート:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Name

このコマンドレットが削除するネットワーク セキュリティ規則の構成の名前を指定します。

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-NetworkSecurityGroup

NetworkSecurityGroup オブジェクトを指定します。 このオブジェクトには、削除するネットワーク セキュリティ規則の構成が含まれています。

パラメーターのプロパティ

型:PSNetworkSecurityGroup
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:True
パイプラインからの値:True
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

CommonParameters

このコマンドレットでは、一般的なパラメーター -Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction、-WarningVariable の各パラメーターがサポートされています。 詳細については、about_CommonParametersを参照してください。

入力

PSNetworkSecurityGroup

出力

PSNetworkSecurityGroup