共用方式為


Set-AzureAclConfig

修改 ACL 組態物件。

注意

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

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

語法

Set-AzureAclConfig
   [-AddRule]
   [-Action] <String>
   [-RemoteSubnet] <String>
   [[-Order] <Int32>]
   [[-Description] <String>]
   -ACL <NetworkAclObject>
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
Set-AzureAclConfig
   [-RemoveRule]
   [-RuleId] <Int32>
   -ACL <NetworkAclObject>
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
Set-AzureAclConfig
   [-SetRule]
   [-RuleId] <Int32>
   [[-Action] <String>]
   [[-RemoteSubnet] <String>]
   [[-Order] <Int32>]
   [[-Description] <String>]
   -ACL <NetworkAclObject>
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

Set-AzureAclConfig Cmdlet 會從現有的 Azure 虛擬機組態修改訪問控制清單 (ACL) 組態物件。

範例

範例 1:將規則新增至新的 ACL 組態

PS C:\> $Acl = New-AzureAclConfig
PS C:\> Set-AzureAclConfig -AddRule -ACL $Acl -Action Permit -RemoteSubnet "172.0.0.0/8" -Order 100 -Description "Permit ACL rule"

第一個命令會建立 ACL 組態,然後將它儲存在$Acl變數中。

第二個命令會將新規則新增至儲存在 $Acl 中的組態。 命令會指定規則的動作、子網、順序和描述。

範例 2:修改 ACL 組態中的規則

PS C:\> $Acl = Get-AzureVM -ServiceName "ContosoService" -Name "VirtualMachine07" | Get-AzureAclConfig -EndpointName "Web"
PS C:\> Set-AzureAclConfig -SetRule -RuleId 0 -ACL $Acl -Order 102 -Description "Web endpoint rule"
PS C:\> Get-AzureVM -ServiceName "ContosoService" -Name "VirtualMachine07" | Set-AzureEndpoint -ACL $Acl -Name "Web" | Update-AzureVM

第一個命令會使用 Get-AzureVM Cmdlet,在名為 ContosoService 的服務中取得名為 VirtualMachine07 的虛擬機。 命令會使用管線運算符,將該對象傳遞至 Get-AzureAclConfig Cmdlet。 該 Cmdlet 會取得名為 Web 之端點的 ACL 組態。 命令會將 ACL 組態物件儲存在 $Acl 變數中。

第二個命令會修改標識碼為 0 的規則。 命令會變更規則的順序和描述。

最後一個命令會使用 Set-AzureEndpoint Cmdlet 來設定該虛擬機的 ACL 組態物件。 此命令也會更新該虛擬機。

範例 3:從 ACL 設定中移除規則

PS C:\> $Acl = Get-AzureVM -ServiceName "ContosoService" -Name "VirtualMachine07" | Get-AzureAclConfig -EndpointName "Web"
PS C:\> Set-AzureAclConfig -RemoveRule -ID 0 -ACL $Acl
PS C:\> Get-AzureVM -ServiceName "ContosoService" -Name "VirtualMachine07" | Set-AzureEndpoint -ACL $Acl -Name "Web" | Update-AzureVM

第一個命令會將 ACL 組態物件儲存在 $Acl 變數中。 這與上一個範例相同。

第二個命令會從 $Acl 的 ACL 組態中移除識別碼為 0 的規則。

最後一個命令會設定虛擬機的 ACL 組態物件,並更新該虛擬機。 這與上一個範例相同。

參數

-ACL

指定此 Cmdlet 修改的 ACL 組態物件。

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

-Action

指定此 Cmdlet 新增或修改之規則的動作。 有效值為:允許和拒絕。

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

-AddRule

表示此 Cmdlet 會將規則新增至 ACL 組態。

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

-Description

指定此 Cmdlet 新增或修改之規則的描述。

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

-InformationAction

指定此 Cmdlet 如何回應資訊事件。

此參數可接受的值為:

  • 繼續
  • 忽略
  • 詢問
  • SilentlyContinue
  • 停止
  • 暫止
類型:ActionPreference
別名:infa
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-InformationVariable

指定資訊變數。

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

-Order

指定此 Cmdlet 新增或修改之規則的處理順序。

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

-RemoteSubnet

指定此 Cmdlet 新增或修改之規則的遠端子網。 以 無類別網域間路由選擇 (CIDR) 格式指定位址。

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

-RemoveRule

表示此 Cmdlet 會從 ACL 組態中移除規則。

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

-RuleId

指定此 Cmdlet 針對 ACL 組態移除或修改的規則識別碼。

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

-SetRule

表示此 Cmdlet 會修改 ACL 組態中的規則。

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