public override void ExecuteCmdlet()
        {
            switch (ParameterSetName)
            {
            case ParameterSetNames.ResourceIdLevelResource:
                break;

            case ParameterSetNames.InputObject:
                Name = InputObject.Name;
                var subscription = AzureIdUtilities.GetResourceSubscription(InputObject.Id);
                var rg           = AzureIdUtilities.GetResourceGroup(InputObject.Id);
                var hubName      = AzureIdUtilities.GetIotHubResourceName(InputObject.Id);
                HubResourceId = $"/subscriptions/{subscription}/resourceGroups/{rg}/providers/Microsoft.Devices/iotHubs/{hubName}";

                AllowlistRule  = AllowlistRule ?? ((List <PSAllowlistCustomAlertRule>)InputObject.AllowlistRules).ToArray();
                DenylistRule   = DenylistRule ?? ((List <PSDenylistCustomAlertRule>)InputObject.DenylistRules).ToArray();
                ThresholdRule  = ThresholdRule ?? ((List <PSThresholdCustomAlertRule>)InputObject.ThresholdRules).ToArray();
                TimeWindowRule = TimeWindowRule ?? ((List <PSTimeWindowCustomAlertRule>)InputObject.TimeWindowRules).ToArray();
                break;

            case ParameterSetNames.ResourceId:
                Name          = AzureIdUtilities.GetResourceName(ResourceId);
                subscription  = AzureIdUtilities.GetResourceSubscription(ResourceId);
                rg            = AzureIdUtilities.GetResourceGroup(ResourceId);
                hubName       = AzureIdUtilities.GetIotHubResourceName(ResourceId);
                HubResourceId = $"/subscriptions/{subscription}/resourceGroups/{rg}/providers/Microsoft.Devices/iotHubs/{hubName}";
                break;

            default:
                throw new PSInvalidOperationException();
            }

            DeviceSecurityGroup group = new DeviceSecurityGroup
            {
                AllowlistRules  = AllowlistRule?.CreatePSType(),
                DenylistRules   = DenylistRule?.CreatePSType(),
                ThresholdRules  = ThresholdRule?.CreatePSType(),
                TimeWindowRules = TimeWindowRule?.CreatePSType()
            };

            if (ShouldProcess(Name, VerbsCommon.Set))
            {
                var outputGroup = SecurityCenterClient.DeviceSecurityGroups.CreateOrUpdateWithHttpMessagesAsync(HubResourceId, Name, group).GetAwaiter().GetResult();
                var result      = outputGroup.Body;

                WriteObject(result?.ConvertToPSType(), enumerateCollection: false);
            }
        }
        public override void ExecuteCmdlet()
        {
            var name          = Name;
            var hubResourceId = HubResourceId;

            switch (ParameterSetName)
            {
            case ParameterSetNames.ResourceIdLevelResource:
                break;

            case ParameterSetNames.InputObject:
                name = InputObject.Name;
                var subscription = AzureIdUtilities.GetResourceSubscription(InputObject.Id);
                var rg           = AzureIdUtilities.GetResourceGroup(InputObject.Id);
                var hubName      = AzureIdUtilities.GetIotHubResourceName(InputObject.Id);
                hubResourceId = $"/subscriptions/{subscription}/resourceGroups/{rg}/providers/Microsoft.Devices/iotHubs/{hubName}";
                break;

            case ParameterSetNames.ResourceId:
                name          = AzureIdUtilities.GetResourceName(ResourceId);
                subscription  = AzureIdUtilities.GetResourceSubscription(ResourceId);
                rg            = AzureIdUtilities.GetResourceGroup(ResourceId);
                hubName       = AzureIdUtilities.GetIotHubResourceName(ResourceId);
                hubResourceId = $"/subscriptions/{subscription}/resourceGroups/{rg}/providers/Microsoft.Devices/iotHubs/{hubName}";
                break;

            default:
                throw new PSInvalidOperationException();
            }

            if (ShouldProcess(Name, VerbsCommon.Remove))
            {
                SecurityCenterClient.DeviceSecurityGroups.DeleteWithHttpMessagesAsync(hubResourceId, name).GetAwaiter().GetResult();
            }

            if (PassThru.IsPresent)
            {
                WriteObject(true);
            }
        }