Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ReleasePR securityinsight] add alert link to security alert arm model #1786

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/securityinsight/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/securityinsight/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'sentinel' Extension
==========================================

This package is for the 'sentinel' extension.
i.e. 'az sentinel'
46 changes: 46 additions & 0 deletions src/securityinsight/azext_sentinel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_sentinel.generated._help import helps # pylint: disable=unused-import


class SecurityInsightsCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_sentinel.generated._client_factory import cf_sentinel
sentinel_custom = CliCommandType(
operations_tmpl='azext_sentinel.custom#{}',
client_factory=cf_sentinel)
super(SecurityInsightsCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=sentinel_custom)

def load_command_table(self, args):
from azext_sentinel.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_sentinel.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from azext_sentinel.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_sentinel.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = SecurityInsightsCommandsLoader
17 changes: 17 additions & 0 deletions src/securityinsight/azext_sentinel/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
4 changes: 4 additions & 0 deletions src/securityinsight/azext_sentinel/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
}
17 changes: 17 additions & 0 deletions src/securityinsight/azext_sentinel/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
12 changes: 12 additions & 0 deletions src/securityinsight/azext_sentinel/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
27 changes: 27 additions & 0 deletions src/securityinsight/azext_sentinel/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------


def cf_sentinel(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.securityinsight import SecurityInsights
return get_mgmt_service_client(cli_ctx, SecurityInsights)


def cf_alert_rule(cli_ctx, *_):
return cf_sentinel(cli_ctx).alert_rule


def cf_action(cli_ctx, *_):
return cf_sentinel(cli_ctx).action


def cf_data_connector(cli_ctx, *_):
return cf_sentinel(cli_ctx).data_connector
158 changes: 158 additions & 0 deletions src/securityinsight/azext_sentinel/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines

from knack.help_files import helps


helps['sentinel alert-rule'] = """
type: group
short-summary: sentinel alert-rule
"""

helps['sentinel alert-rule list'] = """
type: command
short-summary: Gets all alert rules.
examples:
- name: Get all alert rules.
text: |-
az sentinel alert-rule list --resource-group "myRg" --workspace-name "myWorkspace"
"""

helps['sentinel alert-rule show'] = """
type: command
short-summary: Gets the alert rule.
examples:
- name: Get an action of alert rule.
text: |-
az sentinel alert-rule show --action-id "912bec42-cb66-4c03-ac63-1761b6898c3e" --resource-group "myRg" -\
-rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --workspace-name "myWorkspace"
"""

helps['sentinel alert-rule create'] = """
type: command
short-summary: Creates or updates the alert rule.
examples:
- name: Creates or updates an action of alert rule.
text: |-
az sentinel alert-rule create --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --logic-app-resource-i\
d "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts\
" --trigger-uri "https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d48d7/triggers\
/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature" --action-id "912bec42-c\
b66-4c03-ac63-1761b6898c3e" --resource-group "myRg" --rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --workspace-name "\
myWorkspace"
"""

helps['sentinel alert-rule delete'] = """
type: command
short-summary: Delete the alert rule.
examples:
- name: Delete an action of alert rule.
text: |-
az sentinel alert-rule delete --action-id "912bec42-cb66-4c03-ac63-1761b6898c3e" --resource-group "myRg"\
--rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --workspace-name "myWorkspace"
"""

helps['sentinel action'] = """
type: group
short-summary: sentinel action
"""

helps['sentinel action list'] = """
type: command
short-summary: Gets all actions of alert rule.
examples:
- name: Get all actions of alert rule.
text: |-
az sentinel action list --resource-group "myRg" --rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --works\
pace-name "myWorkspace"
"""

helps['sentinel data-connector'] = """
type: group
short-summary: sentinel data-connector
"""

helps['sentinel data-connector list'] = """
type: command
short-summary: Gets all data connectors.
examples:
- name: Get all data connectors.
text: |-
az sentinel data-connector list --resource-group "myRg" --workspace-name "myWorkspace"
"""

helps['sentinel data-connector show'] = """
type: command
short-summary: Gets a data connector.
examples:
- name: Get a ASC data connector.
text: |-
az sentinel data-connector show --data-connector-id "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12" --resource-gr\
oup "myRg" --workspace-name "myWorkspace"
- name: Get a MCAS data connector.
text: |-
az sentinel data-connector show --data-connector-id "b96d014d-b5c2-4a01-9aba-a8058f629d42" --resource-gr\
oup "myRg" --workspace-name "myWorkspace"
- name: Get a MDATP data connector
text: |-
az sentinel data-connector show --data-connector-id "06b3ccb8-1384-4bcc-aec7-852f6d57161b" --resource-gr\
oup "myRg" --workspace-name "myWorkspace"
- name: Get a TI data connector.
text: |-
az sentinel data-connector show --data-connector-id "c345bf40-8509-4ed2-b947-50cb773aaf04" --resource-gr\
oup "myRg" --workspace-name "myWorkspace"
- name: Get an AAD data connector.
text: |-
az sentinel data-connector show --data-connector-id "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d" --resource-gr\
oup "myRg" --workspace-name "myWorkspace"
- name: Get an AATP data connector.
text: |-
az sentinel data-connector show --data-connector-id "07e42cb3-e658-4e90-801c-efa0f29d3d44" --resource-gr\
oup "myRg" --workspace-name "myWorkspace"
- name: Get an AwsCloudTrail data connector.
text: |-
az sentinel data-connector show --data-connector-id "c345bf40-8509-4ed2-b947-50cb773aaf04" --resource-gr\
oup "myRg" --workspace-name "myWorkspace"
- name: Get an Office365 data connector.
text: |-
az sentinel data-connector show --data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-gr\
oup "myRg" --workspace-name "myWorkspace"
"""

helps['sentinel data-connector create'] = """
type: command
short-summary: Creates or updates the data connector.
examples:
- name: Creates or updates an Office365 data connector.
text: |-
az sentinel data-connector create --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --kind "Office365"\
--data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "myWorkspace"
"""

helps['sentinel data-connector update'] = """
type: command
short-summary: Creates or updates the data connector.
examples:
- name: Creates or updates an Office365 data connector.
text: |-
az sentinel data-connector update --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --kind "Office365"\
--data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "myWorkspace"
"""

helps['sentinel data-connector delete'] = """
type: command
short-summary: Delete the data connector.
examples:
- name: Delete an Office365 data connector.
text: |-
az sentinel data-connector delete --data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-\
group "myRg" --workspace-name "myWorkspace"
"""
85 changes: 85 additions & 0 deletions src/securityinsight/azext_sentinel/generated/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements

from knack.arguments import CLIArgumentType
from azure.cli.core.commands.parameters import (
get_enum_type,
resource_group_name_type
)


def load_arguments(self, _):

with self.argument_context('sentinel alert-rule list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')

with self.argument_context('sentinel alert-rule show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')
c.argument('rule_id', help='Alert rule ID')
c.argument('action_id', help='Action ID')

with self.argument_context('sentinel alert-rule create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')
c.argument('rule_id', help='Alert rule ID')
c.argument('action_id', help='Action ID')
c.argument('etag', help='Etag of the azure resource')
c.argument('logic_app_resource_id', help='Logic App Resource Id, providers/Microsoft.Logic/workflows/{WorkflowI'
'D}.')
c.argument('trigger_uri', help='Logic App Callback URL for this specific workflow.')
c.argument('kind', arg_type=get_enum_type(['Scheduled', 'MicrosoftSecurityIncidentCreation', 'Fusion']), help=
'The kind of the alert rule')

with self.argument_context('sentinel alert-rule delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')
c.argument('rule_id', help='Alert rule ID')
c.argument('action_id', help='Action ID')

with self.argument_context('sentinel action list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')
c.argument('rule_id', help='Alert rule ID')

with self.argument_context('sentinel data-connector list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')

with self.argument_context('sentinel data-connector show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')
c.argument('data_connector_id', help='Connector ID')

with self.argument_context('sentinel data-connector create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')
c.argument('data_connector_id', help='Connector ID')
c.argument('etag', help='Etag of the azure resource')
c.argument('kind', arg_type=get_enum_type(['AzureActiveDirectory', 'AzureSecurityCenter', 'MicrosoftCloudAppSec'
'urity', 'ThreatIntelligence', 'Office365', 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProte'
'ction', 'MicrosoftDefenderAdvancedThreatProtection']), help='The kind of the data connector')

with self.argument_context('sentinel data-connector update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')
c.argument('data_connector_id', help='Connector ID')
c.argument('etag', help='Etag of the azure resource')
c.argument('kind', arg_type=get_enum_type(['AzureActiveDirectory', 'AzureSecurityCenter', 'MicrosoftCloudAppSec'
'urity', 'ThreatIntelligence', 'Office365', 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProte'
'ction', 'MicrosoftDefenderAdvancedThreatProtection']), help='The kind of the data connector')

with self.argument_context('sentinel data-connector delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('workspace_name', help='The name of the workspace.')
c.argument('data_connector_id', help='Connector ID')
Loading