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

[Security] Introducing securitySolutionsReferenceData CLI #23336

Merged
merged 8 commits into from
Aug 5, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,9 @@ def cf_security_secure_score_control_definitions(cli_ctx, _):
return _cf_security(cli_ctx).secure_score_control_definitions


def cf_security_security_solutions_reference_data(cli_ctx, _):
return _cf_security(cli_ctx).security_solutions_reference_data


def cf_security_automations(cli_ctx, _):
return _cf_security(cli_ctx).automations
15 changes: 15 additions & 0 deletions src/azure-cli/azure/cli/command_modules/security/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,21 @@
text: >
az security secure-score-control-definitions list
"""

helps['security security_solutions_reference_data'] = """
type: group
short-summary: Display all security solutions reference data at the subscription level.
"""

helps['security security_solutions_reference_data list'] = """
type: command
short-summary: Display all security solutions reference data at the subscription level.
examples:
- name: Display all security solutions reference data.
text: >
az security security_solutions_reference_data list
"""

Comment on lines +1086 to +1099
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use '_' to separate command name

helps['security automation'] = """
type: group
short-summary: View your security automations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def load_arguments(self, _):
'secure-scores',
'secure-score-controls',
'secure-score-control-definitions',
'security_solutions_reference_data',
'setting',
'automation'
]:
Expand Down
11 changes: 11 additions & 0 deletions src/azure-cli/azure/cli/command_modules/security/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
cf_security_secure_scores,
cf_security_secure_score_controls,
cf_security_secure_score_control_definitions,
cf_security_security_solutions_reference_data,
cf_security_automations)


Expand Down Expand Up @@ -75,6 +76,11 @@ def load_command_table(self, _):
client_factory=cf_security_regulatory_compliance_assessment
)

security_security_solutions_reference_data_sdk = CliCommandType(
operations_tmpl='azure.mgmt.security.operations#SecuritySolutionsReferenceDataOperations.{}',
client_factory=cf_security_security_solutions_reference_data
)

security_tasks_sdk = CliCommandType(
operations_tmpl='azure.mgmt.security.operations#TasksOperations.{}',
client_factory=cf_security_tasks,
Expand Down Expand Up @@ -255,6 +261,11 @@ def load_command_table(self, _):
g.custom_command('list', 'list_regulatory_compliance_standards')
g.custom_show_command('show', 'get_regulatory_compliance_standard')

with self.command_group('security security_solutions_reference_data',
security_security_solutions_reference_data_sdk,
client_factory=cf_security_security_solutions_reference_data) as g:
g.custom_command('list', 'list_security_solutions_reference_data')

with self.command_group('security regulatory-compliance-controls',
security_regulatory_compliance_controls_sdk,
client_factory=cf_security_regulatory_compliance_control) as g:
Expand Down
9 changes: 9 additions & 0 deletions src/azure-cli/azure/cli/command_modules/security/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,15 @@ def get_security_location(client, resource_name):
return client.get()


# --------------------------------------------------------------------------------------------
# securitySolutionsReferenceData
# --------------------------------------------------------------------------------------------

def list_security_solutions_reference_data(client):

return client.list()


# --------------------------------------------------------------------------------------------
# Security Pricings
# --------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
interactions:
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- security security_solutions_reference_data list
Connection:
- keep-alive
User-Agent:
- python/3.7.8rc1 (Windows-10-10.0.22000-SP0) msrest/0.6.21 msrest_azure/0.6.3
azure-mgmt-security/0.6.0 Azure-SDK-For-Python AZURECLI/2.20.0
accept-language:
- en-US
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/securitySolutionsReferenceData?api-version=2020-01-01
response:
body:
string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/rapid7.insightplatform","name":"rapid7.insightplatform","type":"Microsoft.Security/locations/securitySolutionsReferenceData","properties":{"alertVendorName":"Rapid7","securityFamily":"Va","packageInfoUrl":"www.azure.com","productName":"Vulnerability
Assessment","provisionType":"SemiIntegrated","publisher":"rapid7","publisherDisplayName":"Rapid7
Inc.","template":"rapid7/insightplatform"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/qualys.qualysAgent","name":"qualys.qualysAgent","type":"Microsoft.Security/locations/securitySolutionsReferenceData","properties":{"alertVendorName":"Qualys
VA","securityFamily":"Va","packageInfoUrl":"http://www.qualys.com/","productName":"Vulnerability
Assessment","provisionType":"SemiIntegrated","publisher":"qualys","publisherDisplayName":"Qualys,
Inc.","template":"qualys/qualysAgent","templateAdministrationExpression":"http://www.qualys.com/"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/microsoft.ApplicationGateway-ARM","name":"microsoft.ApplicationGateway-ARM","type":"Microsoft.Security/locations/securitySolutionsReferenceData","properties":{"alertVendorName":"Microsoft","securityFamily":"SaasWaf","packageInfoUrl":"www.azure.com","productName":"Web
Application Firewall","provisionType":"SemiIntegrated","publisher":"microsoft","publisherDisplayName":"Microsoft
Inc.","template":"microsoft/ApplicationGateway-ARM","templateAdministrationExpression":"https://portal.azure.com#resource/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/applicationGateways/{name}/overview"}}]}'
headers:
cache-control:
- no-cache
content-length:
- '1903'
content-type:
- application/json; charset=utf-8
date:
- Tue, 26 Jul 2022 14:35:43 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-ms-original-request-ids:
- ''
- ''
- ''
x-ms-ratelimit-remaining-subscription-resource-requests:
- '749'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- security security_solutions_reference_data list
Connection:
- keep-alive
User-Agent:
- python/3.7.8rc1 (Windows-10-10.0.22000-SP0) msrest/0.6.21 msrest_azure/0.6.3
azure-mgmt-security/0.6.0 Azure-SDK-For-Python AZURECLI/2.20.0
accept-language:
- en-US
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/securitySolutionsReferenceData?api-version=2020-01-01
response:
body:
string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/rapid7.insightplatform","name":"rapid7.insightplatform","type":"Microsoft.Security/locations/securitySolutionsReferenceData","properties":{"alertVendorName":"Rapid7","securityFamily":"Va","packageInfoUrl":"www.azure.com","productName":"Vulnerability
Assessment","provisionType":"SemiIntegrated","publisher":"rapid7","publisherDisplayName":"Rapid7
Inc.","template":"rapid7/insightplatform"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/qualys.qualysAgent","name":"qualys.qualysAgent","type":"Microsoft.Security/locations/securitySolutionsReferenceData","properties":{"alertVendorName":"Qualys
VA","securityFamily":"Va","packageInfoUrl":"http://www.qualys.com/","productName":"Vulnerability
Assessment","provisionType":"SemiIntegrated","publisher":"qualys","publisherDisplayName":"Qualys,
Inc.","template":"qualys/qualysAgent","templateAdministrationExpression":"http://www.qualys.com/"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/microsoft.ApplicationGateway-ARM","name":"microsoft.ApplicationGateway-ARM","type":"Microsoft.Security/locations/securitySolutionsReferenceData","properties":{"alertVendorName":"Microsoft","securityFamily":"SaasWaf","packageInfoUrl":"www.azure.com","productName":"Web
Application Firewall","provisionType":"SemiIntegrated","publisher":"microsoft","publisherDisplayName":"Microsoft
Inc.","template":"microsoft/ApplicationGateway-ARM","templateAdministrationExpression":"https://portal.azure.com#resource/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/applicationGateways/{name}/overview"}}]}'
headers:
cache-control:
- no-cache
content-length:
- '1903'
content-type:
- application/json; charset=utf-8
date:
- Tue, 26 Jul 2022 14:35:44 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-ms-original-request-ids:
- ''
- ''
- ''
x-ms-ratelimit-remaining-subscription-resource-requests:
- '749'
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.testsdk import ScenarioTest
from azure.cli.testsdk.scenario_tests import AllowLargeResponse


class securitySolutionsReferenceDataTests(ScenarioTest):

def test_security_securitySolutionsReferenceData(self):

SolutionsReferenceData = self.cmd('az security security_solutions_reference_data list').get_output_in_json()

assert len(SolutionsReferenceData) >= 0

self.cmd('az security security_solutions_reference_data list')