共用方式為


Set-AzDeviceSecurityGroup

建立或更新裝置安全性群組

語法

ResourceIdLevelResource (預設值)

Set-AzDeviceSecurityGroup
    -Name <String>
    -HubResourceId <String>
    [-ThresholdRule <PSThresholdCustomAlertRule[]>]
    [-TimeWindowRule <PSTimeWindowCustomAlertRule[]>]
    [-AllowlistRule <PSAllowlistCustomAlertRule[]>]
    [-DenylistRule <PSDenylistCustomAlertRule[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObject

Set-AzDeviceSecurityGroup
    -InputObject <PSDeviceSecurityGroup>
    [-ThresholdRule <PSThresholdCustomAlertRule[]>]
    [-TimeWindowRule <PSTimeWindowCustomAlertRule[]>]
    [-AllowlistRule <PSAllowlistCustomAlertRule[]>]
    [-DenylistRule <PSDenylistCustomAlertRule[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ResourceId

Set-AzDeviceSecurityGroup
    -ResourceId <String>
    [-ThresholdRule <PSThresholdCustomAlertRule[]>]
    [-TimeWindowRule <PSTimeWindowCustomAlertRule[]>]
    [-AllowlistRule <PSAllowlistCustomAlertRule[]>]
    [-DenylistRule <PSDenylistCustomAlertRule[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Set-AzDeviceSecurityGroup Cmdlet 會建立或更新 IoT 安全性解決方案中定義的裝置安全性群組。

範例

範例 1

$TimeWindowSize = New-TimeSpan -Minutes 5
$TimeWindowRule = New-AzDeviceSecurityGroupTimeWindowRuleObject -Type "ActiveConnectionsNotInAllowedRange" -Enabled $true `
-MaxThreshold 30 -MinThreshold 0 -TimeWindowSize $TimeWindowSize
Set-AzDeviceSecurityGroup -Name "MySecurityGroup" `
-HubResourceId "/subscriptions/XXXXXXXX-XXXX-XXXXX-XXXX-XXXXXXXXXXXX/resourceGroups/MyResourceGroup/providers/Microsoft.Devices/IotHubs/MyHub" `
-TimeWindowRule $TimeWindowRules
Id: "/subscriptions/XXXXXXXX-XXXX-XXXXX-XXXX-XXXXXXXXXXXX/resourceGroups/MyResourceGroup/providers/Microsoft.Devices/IotHubs/MyHub/providers/Microsoft.Security/deviceSecurityGroups/MySecurityGroup"
Name: "MySecurityGroup"
Type: "Microsoft.Security/deviceSecurityGroups"
ThresholdRules: []
TimeWindowRules: [
			{
              RuleType: "ActiveConnectionsNotInAllowedRange"
              DisplayName: "Number of active connections is not in allowed range"
              Description: "Get an alert when the number of active connections of a device in the time window is not in the allowed range"
              IsEnabled: true
              MinThreshold: 0
              MaxThreshold: 0
              TimeWindowSize: "PT5M"
            }]
AllowlistRules: [
			{
              RuleType": "ConnectionToIpNotAllowed",
              DisplayName: "Outbound connection to an ip that isn't allowed"
              Description: "Get an alert when an outbound connection is created between your device and an ip that isn't allowed"
              IsEnabled: false
              ValueType: "IpCidr"
              AllowlistValues: []
            },
            {
              RuleType: "LocalUserNotAllowed"
              DisplayName: "Login by a local user that isn't allowed"
              Description: "Get an alert when a local user that isn't allowed logins to the device"
              IsEnabled: false
              ValueType: "String"
              AllowlistValues: []
            }]
DenylistRules: []

從規則類型為 “ActiveConnectionsNotInAllowedRange” 的 IoT 中樞 “/subscriptions/XXXXXXXX-XXXX-XXXXX-XXXXXXXXXXXX/resourceGroups/MyResourceGroup/providers/Microsoft.Devices/IotHubs/MyHub” 更新現有的裝置安全性群組

參數

-AllowlistRule

允許清單規則。

參數屬性

類型:

PSAllowlistCustomAlertRule[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

ResourceIdLevelResource
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Confirm

在執行 Cmdlet 之前,提示您進行確認。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False
別名:參閱

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-DefaultProfile

用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。

參數屬性

類型:IAzureContextContainer
預設值:None
支援萬用字元:False
不要顯示:False
別名:AzContext, AzureRmContext, AzureCredential

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-DenylistRule

拒絕清單規則。

參數屬性

類型:

PSDenylistCustomAlertRule[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

ResourceIdLevelResource
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-HubResourceId

IoT 中樞資源識別碼。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

ResourceIdLevelResource
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-InputObject

輸入物件。

參數屬性

類型:PSDeviceSecurityGroup
預設值:None
支援萬用字元:False
不要顯示:False

參數集

InputObject
Position:Named
必要:True
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Name

資源名稱。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

ResourceIdLevelResource
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-ResourceId

您要叫用命令的安全資源 ID。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

ResourceId
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-ThresholdRule

臨界值規則。

參數屬性

類型:

PSThresholdCustomAlertRule[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

ResourceIdLevelResource
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-TimeWindowRule

時間窗口規則。

參數屬性

類型:

PSTimeWindowCustomAlertRule[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

ResourceIdLevelResource
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-WhatIf

顯示 Cmdlet 執行時會發生什麼事。 指令未執行。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False
別名:威斯康星州

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 Cmdlet 支援常見參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters

輸入

PSThresholdCustomAlertRule

PSTimeWindowCustomAlertRule

PSAllowlistCustomAlertRule

PSDenylistCustomAlertRule

PSDeviceSecurityGroup

String

輸出

PSDeviceSecurityGroup