Skip to content

Commit 2deb3a9

Browse files
committed
Introducing Az.Security SecuritySolution cmdlets
1 parent 0382229 commit 2deb3a9

File tree

6 files changed

+375
-7
lines changed

6 files changed

+375
-7
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 Microsoft.Azure.Commands.ScenarioTest;
16+
using Microsoft.Azure.ServiceManagement.Common.Models;
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
20+
namespace Microsoft.Azure.Commands.Security.Test.ScenarioTests
21+
{
22+
public class SecuritySolutionTests
23+
{
24+
private readonly XunitTracingInterceptor _logger;
25+
26+
public SecuritySolutionTests(Xunit.Abstractions.ITestOutputHelper output)
27+
{
28+
_logger = new XunitTracingInterceptor(output);
29+
XunitTracingInterceptor.AddToContext(_logger);
30+
TestExecutionHelpers.SetUpSessionAndProfile();
31+
}
32+
33+
[Fact]
34+
[Trait(Category.AcceptanceType, Category.CheckIn)]
35+
public void GetSubscriptionScope()
36+
{
37+
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSecuritySolution-SubscriptionScope");
38+
}
39+
}
40+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
<#
16+
.SYNOPSIS
17+
Get discovered security solutions on a subscription scope
18+
#>
19+
function Get-AzSecuritySolution-SubscriptionScope
20+
{
21+
$SecuritySolution = Get-AzSecuritySolution
22+
Validate-SecuritySolution $SecuritySolution
23+
}
24+
25+
<#
26+
.SYNOPSIS
27+
Validates a list of security discoveredSecuritySolutions
28+
#>
29+
function Validate-SecuritySolution
30+
{
31+
param($SecuritySolution)
32+
33+
Assert-True { $SecuritySolution.Count -gt 0 }
34+
35+
Foreach($SecuritySolution in $SecuritySolution)
36+
{
37+
Validate-SecuritySolution $SecuritySolution
38+
}
39+
}
40+
41+
<#
42+
.SYNOPSIS
43+
Validates a single SecuritySolution
44+
#>
45+
function Validate-SecuritySolution
46+
{
47+
param($SecuritySolution)
48+
49+
Assert-NotNull $SecuritySolution
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/providers/Microsoft.Security/securitySolutions?api-version=2020-01-01",
5+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjdiYzYwNGItNTRiMi00Yzc4LWE3YmEtNzI1MDQ5MjBhMzE5L3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VjdXJpdHkvc2VjdXJpdHlTb2x1dGlvbnM/YXBpLXZlcnNpb249MjAyMC0wMS0wMQ==",
6+
"RequestMethod": "GET",
7+
"RequestBody": "",
8+
"RequestHeaders": {
9+
"x-ms-client-request-id": [
10+
"f378fdcf-41b5-4409-99e7-69c0c811a745"
11+
],
12+
"Accept-Language": [
13+
"en-US"
14+
],
15+
"User-Agent": [
16+
"FxVersion/4.700.22.16002",
17+
"OSName/Windows",
18+
"OSVersion/Microsoft.Windows.10.0.22000",
19+
"Microsoft.Azure.Management.Security.SecurityCenterClient/3.0.0.0"
20+
]
21+
},
22+
"ResponseHeaders": {
23+
"Cache-Control": [
24+
"no-cache"
25+
],
26+
"Pragma": [
27+
"no-cache"
28+
],
29+
"x-ms-original-request-ids": [
30+
"",
31+
"",
32+
""
33+
],
34+
"x-ms-ratelimit-remaining-subscription-resource-requests": [
35+
"749"
36+
],
37+
"x-ms-request-id": [
38+
"a10d7f95-216c-4532-aa03-554944621480"
39+
],
40+
"x-ms-correlation-request-id": [
41+
"a10d7f95-216c-4532-aa03-554944621480"
42+
],
43+
"x-ms-routing-request-id": [
44+
"UAECENTRAL:20220501T112827Z:a10d7f95-216c-4532-aa03-554944621480"
45+
],
46+
"Strict-Transport-Security": [
47+
"max-age=31536000; includeSubDomains"
48+
],
49+
"X-Content-Type-Options": [
50+
"nosniff"
51+
],
52+
"Date": [
53+
"Sun, 01 May 2022 11:28:27 GMT"
54+
],
55+
"Content-Type": [
56+
"application/json; charset=utf-8"
57+
],
58+
"Expires": [
59+
"-1"
60+
],
61+
"Content-Length": [
62+
"6739"
63+
]
64+
},
65+
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"Va\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"Good\",\r\n \"template\": \"qualys.qualysAgent\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"http://www.qualys.com/\",\r\n \"creationDate\": \"2017-10-09T12:37:15.9527562Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"67931ECFB2B86BFFE512B04C745D307FE7F15FF4\",\r\n \"configurations\": {\r\n \"AutoUpdate\": false\r\n }\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/QualysLICTest/providers/Microsoft.Security/locations/centralus/securitySolutions/QualysLICTest\",\r\n \"name\": \"QualysLICTest\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"westcentralus\"\r\n },\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"SaasWaf\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"Good\",\r\n \"template\": \"Microsoft.ApplicationGateway-ARM\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"https://portal.azure.com#resource/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/OfriWafTest/providers/Microsoft.Network/applicationGateways/OfriWafTest/overview\",\r\n \"creationDate\": \"2020-10-05T11:01:57.6339395Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"9C29D374728B41DC6923D87B1E159EFCB0BF2768\"\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/OfriWafTest/providers/Microsoft.Security/locations/centralus/securitySolutions/OfriWafTest\",\r\n \"name\": \"OfriWafTest\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"eastus\"\r\n },\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"SaasWaf\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"UnReported\",\r\n \"template\": \"microsoft.ApplicationGateway-ARM\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"https://portal.azure.com#resource/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/waf155/providers/Microsoft.Network/applicationGateways/waf155vm/overview\",\r\n \"creationDate\": \"2020-07-22T11:45:47.9115946Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"2C8995EFB1500186BC1958C032CC360BAC33C5BC\"\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/waf155/providers/Microsoft.Security/locations/centralus/securitySolutions/waf155vm\",\r\n \"name\": \"waf155vm\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"westcentralus\"\r\n },\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"SaasWaf\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"Good\",\r\n \"template\": \"microsoft.ApplicationGateway-ARM\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"https://portal.azure.com#resource/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/solutionsProdTest/providers/Microsoft.Network/applicationGateways/msWafProdTest/overview\",\r\n \"creationDate\": \"2020-12-22T12:36:21.3564505Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"DF6A40AD0A3A9FEDA4635882E1D15AEF63E2CAF9\"\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/solutionsProdTest/providers/Microsoft.Security/locations/centralus/securitySolutions/msWafProdTest\",\r\n \"name\": \"msWafProdTest\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"westus\"\r\n },\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"SaasWaf\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"Good\",\r\n \"template\": \"microsoft.ApplicationGateway-ARM\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"https://portal.azure.com#resource/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/waf-rg2/providers/Microsoft.Network/applicationGateways/Ofri-WAF/overview\",\r\n \"creationDate\": \"2021-08-16T15:07:07.0095098Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"8E21D225069917B73D65FB806785076F443F4530\"\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/waf-rg2/providers/Microsoft.Security/locations/centralus/securitySolutions/Ofri-WAF\",\r\n \"name\": \"Ofri-WAF\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"eastus\"\r\n },\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"Va\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"UnReported\",\r\n \"template\": \"qualys.qualysAgent\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"http://www.qualys.com/\",\r\n \"creationDate\": \"2021-03-09T10:40:18.7014776Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"FDE9EB85DB07E8354B3AFF34DA84B0929F14F222\",\r\n \"configurations\": {\r\n \"AutoUpdate\": false\r\n }\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/tryNomisolutions/providers/Microsoft.Security/locations/centralus/securitySolutions/DedicatedEHTest3\",\r\n \"name\": \"DedicatedEHTest3\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"westcentralus\"\r\n },\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"Va\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"Good\",\r\n \"template\": \"qualys.qualysAgent\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"http://www.qualys.com/\",\r\n \"creationDate\": \"2017-10-01T14:51:37.5457917Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"3120660E864F689F9166DB122386B71E27C2D565\",\r\n \"configurations\": {\r\n \"AutoUpdate\": false\r\n }\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/QualysLinuxTest/providers/Microsoft.Security/locations/centralus/securitySolutions/Qualys1\",\r\n \"name\": \"Qualys1\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"westcentralus\"\r\n },\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"Va\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"NotReporting\",\r\n \"template\": \"rapid7.insightplatform\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"\",\r\n \"creationDate\": \"2018-06-11T13:24:27.1314378Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"1A54F1A20AB90FDAD835897B4A413B1F40473DD9\",\r\n \"configurations\": {\r\n \"AutoUpdate\": false\r\n }\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/Rapid7Va/providers/Microsoft.Security/locations/centralus/securitySolutions/Rapid7VaRome3\",\r\n \"name\": \"Rapid7VaRome3\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"centralus\"\r\n },\r\n {\r\n \"properties\": {\r\n \"securityFamily\": \"SaasWaf\",\r\n \"integrationLevel\": \"SemiIntegrated\",\r\n \"protectionStatus\": \"Good\",\r\n \"template\": \"microsoft.ApplicationGateway-ARM\",\r\n \"protectedResourcesStates\": [],\r\n \"protectedResourcesTypes\": [],\r\n \"managementUrl\": \"https://portal.azure.com#resource/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/MatanWafTest/providers/Microsoft.Network/applicationGateways/MatanWAFtEST/overview\",\r\n \"creationDate\": \"2021-08-16T15:06:32.3284944Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"clusterId\": \"B95CAE8386CD79955A26A6E2AF0D62B7331D17D5\"\r\n },\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/MatanWafTest/providers/Microsoft.Security/locations/centralus/securitySolutions/MatanWAFtEST\",\r\n \"name\": \"MatanWAFtEST\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutions\",\r\n \"location\": \"eastus2\"\r\n }\r\n ]\r\n}",
66+
"StatusCode": 200
67+
}
68+
],
69+
"Names": {},
70+
"Variables": {
71+
"SubscriptionId": "67bc604b-54b2-4c78-a7ba-72504920a319"
72+
}
73+
}

src/Security/Security/Az.Security.psd1

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 10/28/2021
6+
# Generated on: 4/22/2022
77
#
88

99
@{
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.1.1'
15+
ModuleVersion = '1.4.0'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Core', 'Desktop'
@@ -74,7 +74,9 @@ NestedModules = @('Microsoft.Azure.PowerShell.Cmdlets.Security.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-AzSecuritySolution', 'Get-AzSecurityAlert', 'Set-AzSecurityAlert',
77+
78+
CmdletsToExport = 'Get-AzSecuritySolution', 'Get-AzSecuritySolutionsReferenceData', 'New-AzAlertsSuppressionRuleScope', 'Get-AzAlertsSuppressionRule', 'Set-AzAlertsSuppressionRule', 'Remove-AzAlertsSuppressionRule',
79+
'Get-AzSecurityAlert', 'Set-AzSecurityAlert',
7880
'Get-AzSecurityAutoProvisioningSetting',
7981
'Set-AzSecurityAutoProvisioningSetting', 'Get-AzSecurityCompliance',
8082
'Get-AzDiscoveredSecuritySolution',
@@ -125,13 +127,20 @@ CmdletsToExport = 'Get-AzSecuritySolution', 'Get-AzSecurityAlert', 'Set-AzSecuri
125127
'Get-AzSecurityAdaptiveApplicationControlGroup',
126128
'Get-AzSecurityAdaptiveApplicationControl',
127129
'Get-AzSecuritySecureScore', 'Get-AzSecuritySecureScoreControl',
128-
'Get-AzSecuritySecureScoreControlDefinition'
130+
'Get-AzSecuritySecureScoreControlDefinition',
131+
'Get-AzSecurityAutomation', 'New-AzSecurityAutomation',
132+
'Remove-AzSecurityAutomation', 'Confirm-AzSecurityAutomation',
133+
'New-AzSecurityAutomationActionObject',
134+
'New-AzSecurityAutomationRuleObject',
135+
'New-AzSecurityAutomationRuleSetObject',
136+
'New-AzSecurityAutomationScopeObject',
137+
'New-AzSecurityAutomationSourceObject'
129138

130139
# Variables to export from this module
131140
# VariablesToExport = @()
132141

133142
# Aliases 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 aliases to export.
134-
AliasesToExport = 'Get-AzRegulatoryComplainceAssessment'
143+
AliasesToExport = 'Get-AzRegulatoryComplainceAssessment', 'Set-AzSecurityAutomation'
135144

136145
# DSC resources to export from this module
137146
# DscResourcesToExport = @()
@@ -160,7 +169,7 @@ PrivateData = @{
160169
# IconUri = ''
161170

162171
# ReleaseNotes of this module
163-
ReleaseNotes = '* Updated Security .NET SDK package reference to version 3.0.0'
172+
ReleaseNotes = '* Added new cmdlets for security Automations API'
164173

165174
# Prerelease string of this module
166175
# Prerelease = ''
@@ -182,4 +191,3 @@ PrivateData = @{
182191
# DefaultCommandPrefix = ''
183192

184193
}
185-

0 commit comments

Comments
 (0)