Skip to content

Commit f6d49ac

Browse files
author
dicolanl
committed
more updates
1 parent 447c078 commit f6d49ac

File tree

5 files changed

+89
-1
lines changed

5 files changed

+89
-1
lines changed

src/SecurityInsights/SecurityInsights/Az.SecurityInsights.psd1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,21 @@ NestedModules = @('Microsoft.Azure.PowerShell.Cmdlets.SecurityInsights.dll')
7474
FunctionsToExport = @()
7575

7676
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
77-
CmdletsToExport = 'Get-AzSentinelAction',
77+
CmdletsToExport = 'Get-AzSentinelAlertRuleAction',
78+
'New-AzSentinelAlertRuleAction',
79+
'Remove-AzSentinelAlertRuleAction',
80+
'Set-AzSentinelAlertRuleAction',
7881
'Get-AzSentinelAlertRule',
82+
'New-AzSentinelAlertRule',
83+
'Remove-AzSentinelAlertRule',
84+
'Set-AzSentinelAlertRule',
85+
'Get-AzSentinelBookmark',
86+
'New-AzSentinelBookmark',
87+
'New-AzSentinelBookmarkIncidentInfo',
88+
'Remove-AzSentinelBookmark',
89+
'Set-AzSentinelBookmark',
90+
'Get-AzSentinelIncidentComment',
91+
'New-AzSentinelIncidentComment',
7992
'Get-AzSentinelIncident',
8093
'New-AzSentinelIncident',
8194
'New-AzSentinelIncidentLabel',

src/SecurityInsights/SecurityInsights/Cmdlets/Bookmarks/NewBookmarks.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public class NewBookmarks : SecurityInsightsCmdletBase
6161

6262
public override void ExecuteCmdlet()
6363
{
64+
if (BookmarkId == null)
65+
{
66+
BookmarkId = Guid.NewGuid().ToString();
67+
}
68+
6469
var name = BookmarkId;
6570

6671
UserInfo userinfo = new UserInfo
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ------------------------------------
14+
15+
using System.Management.Automation;
16+
using Microsoft.Azure.Commands.SecurityInsights;
17+
using Microsoft.Azure.Commands.SecurityInsights.Common;
18+
using Microsoft.Azure.Commands.SecurityInsights.Models.IncidentComments;
19+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
20+
using System.Collections.Generic;
21+
using Microsoft.Azure.Management.SecurityInsights.Models;
22+
using System;
23+
24+
namespace Microsoft.Azure.Commands.SecurityInsights.Cmdlets.IncidentsComments
25+
{
26+
[Cmdlet(VerbsCommon.New, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "SentinelIncidentComment", DefaultParameterSetName = ParameterSetNames.IncidentCommentId), OutputType(typeof(PSSentinelIncidentComment))]
27+
public class NewBookmarks : SecurityInsightsCmdletBase
28+
{
29+
[Parameter(ParameterSetName = ParameterSetNames.IncidentCommentId, Mandatory = true, HelpMessage = ParameterHelpMessages.ResourceGroupName)]
30+
[ResourceGroupCompleter]
31+
[ValidateNotNullOrEmpty]
32+
public string ResourceGroupName { get; set; }
33+
34+
[Parameter(ParameterSetName = ParameterSetNames.IncidentCommentId, Mandatory = true, HelpMessage = ParameterHelpMessages.WorkspaceName)]
35+
[ValidateNotNullOrEmpty]
36+
public string WorkspaceName { get; set; }
37+
38+
[Parameter(ParameterSetName = ParameterSetNames.IncidentCommentId, Mandatory = true, HelpMessage = ParameterHelpMessages.IncidentId)]
39+
[ValidateNotNullOrEmpty]
40+
public string IncidentId { get; set; }
41+
42+
[Parameter(ParameterSetName = ParameterSetNames.IncidentCommentId, Mandatory = false, HelpMessage = ParameterHelpMessages.IncidentCommentId)]
43+
public string IncidentCommentId { get; set; }
44+
45+
[Parameter(ParameterSetName = ParameterSetNames.BookmarkId, Mandatory = true, HelpMessage = ParameterHelpMessages.Message)]
46+
public string Message { get; set; }
47+
48+
public override void ExecuteCmdlet()
49+
{
50+
if (IncidentCommentId == null)
51+
{
52+
IncidentCommentId = Guid.NewGuid().ToString();
53+
}
54+
55+
var name = IncidentCommentId;
56+
57+
if (ShouldProcess(name, VerbsCommon.Set))
58+
{
59+
var outputIncidentCommnet = SecurityInsightsClient.IncidentComments.CreateCommentWithHttpMessagesAsync(ResourceGroupName, WorkspaceName, IncidentId, name, Message).GetAwaiter().GetResult().Body;
60+
61+
WriteObject(outputIncidentCommnet, enumerateCollection: false);
62+
}
63+
}
64+
}
65+
}

src/SecurityInsights/SecurityInsights/Common/ParameterHelpMessages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public static class ParameterHelpMessages
6969

7070
#region IncidentComments
7171
public const string IncidentCommentId = "Incident Comment Id.";
72+
public const string Message = "Incident Message.";
7273
#endregion
7374

7475
#region Incidents

src/SecurityInsights/SecurityInsights/SecurityInsights.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010
<PackageReference Include="Microsoft.Azure.Management.SecurityInsights" Version="1.0.0-preview.1" />
1111
</ItemGroup>
1212

13+
<ItemGroup>
14+
<Folder Include="Models\DataConnectors\" />
15+
</ItemGroup>
16+
1317
</Project>

0 commit comments

Comments
 (0)