共用方式為


Get-AzureNetworkSecurityGroupAssociation

取得虛擬機、網路適配器或 PaaS 角色的網路安全組。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

Get-AzureNetworkSecurityGroupAssociation
   -VirtualNetworkName <String>
   -SubnetName <String>
   [-Detailed]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Get-AzureNetworkSecurityGroupAssociation
   -VM <PersistentVMRoleContext>
   -ServiceName <String>
   [-NetworkInterfaceName <String>]
   [-Detailed]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Get-AzureNetworkSecurityGroupAssociation
   [-Slot <String>]
   -RoleName <String>
   -ServiceName <String>
   [-NetworkInterfaceName <String>]
   [-Detailed]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

Get-AzureNetworkSecurityGroupAssociation Cmdlet 會取得虛擬機、網路適配器或平臺即服務 (PaaS) 角色的網路安全組。

範例

範例 1:取得虛擬機的網路安全組

PS C:\> Get-AzureVM -ServiceName "ContosoService" -Name "ContosoVM06" | Get-AzureNetworkSecurityGroupAssociation

此命令會針對名為 ContosoService 的服務取得名為 ContosoVM06 的虛擬機,並將該虛擬機對象傳遞至目前的 Cmdlet。 目前的 Cmdlet 會取得與該虛擬機相關聯的網路安全組。

參數

-Detailed

指出此 Cmdlet 會傳回與虛擬機相關聯的網路安全組詳細數據。 這些詳細數據包括位置和規則。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-NetworkInterfaceName

指定此 Cmdlet 取得網路安全組的網路適配器名稱。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-RoleName

指定此 Cmdlet 取得網路安全組的 PaaS 角色名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-ServiceName

指定雲端服務的名稱。 PaaS 角色屬於此參數所指定的服務。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Slot

指定 PaaS 位置。 此 Cmdlet 取得網路安全組的 PaaS 角色具有此參數所指定的位置。 有效值為:

  • Production
  • 預備

預設值為 [生產]。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-SubnetName

指定此 Cmdlet 取得網路安全組的子網名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-VirtualNetworkName

指定包含此 Cmdlet 取得網路安全組之子網的虛擬網路名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-VM

指定此 Cmdlet 套用網路安全組的虛擬機。

類型:PersistentVMRoleContext
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

輸出

Microsoft.WindowsAzure.Commands.ServiceManagement.Network.NetworkSecurityGroup.Model.INetworkSecurityGroup