Edit

Share via


Set-AzDeviceSecurityGroup

Create or update device security group

Syntax

ResourceIdLevelResource (Default)

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

The Set-AzDeviceSecurityGroup cmdlet creates or updates a device security group defined in iot security solution.

Examples

Example 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: []

Update existing device security group from IoT Hub "/subscriptions/XXXXXXXX-XXXX-XXXXX-XXXX-XXXXXXXXXXXX/resourceGroups/MyResourceGroup/providers/Microsoft.Devices/IotHubs/MyHub" with rule type "ActiveConnectionsNotInAllowedRange"

Parameters

-AllowlistRule

Allow list rules.

Parameter properties

Type:

PSAllowlistCustomAlertRule[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceIdLevelResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DenylistRule

Deny list rules.

Parameter properties

Type:

PSDenylistCustomAlertRule[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceIdLevelResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HubResourceId

IoT Hub resource Id.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceIdLevelResource
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Input Object.

Parameter properties

Type:PSDeviceSecurityGroup
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Resource name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceIdLevelResource
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceId

ID of the security resource that you want to invoke the command on.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ThresholdRule

Threshold rules.

Parameter properties

Type:

PSThresholdCustomAlertRule[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceIdLevelResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeWindowRule

Time window rules.

Parameter properties

Type:

PSTimeWindowCustomAlertRule[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceIdLevelResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PSThresholdCustomAlertRule

PSTimeWindowCustomAlertRule

PSAllowlistCustomAlertRule

PSDenylistCustomAlertRule

PSDeviceSecurityGroup

String

Outputs

PSDeviceSecurityGroup