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

Introducing Az.Security SecuritySolutionsReferenceData cmdlets #17971

Merged
merged 58 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
484612b
Introducing SecurityTopologies cmdlets
Jun 17, 2020
cb03750
Update ChangeLog.md
VeryEarly Jun 18, 2020
77a928e
Update ChangeLog.md
VeryEarly Jun 18, 2020
cc2c194
Change cmdlet name to Get-AzSecurityTopology
Jun 18, 2020
3ee5195
Get-AzSecurityTopologies -> Get-AzSecurityTopology
Jun 18, 2020
a570040
remove AllowedConnections
Jun 21, 2020
fc08b95
change name
Jun 21, 2020
92f5240
Merge pull request #1 from ariklin/SecurityTopology
ariklin Jun 21, 2020
bf053d0
fix conflicy
Jun 21, 2020
3390a06
fix conflict
Jun 21, 2020
9c8dc01
Merge pull request #2 from ariklin/SecurityTopology
ariklin Jun 21, 2020
7a8c2cf
Merge branch 'master' into master
ariklin Jun 21, 2020
2bd9630
Update ChangeLog.md
VeryEarly Jun 22, 2020
be52d8b
Introducing Az.Security AllowedConnections cmdlets
Jun 22, 2020
a8194bc
merge
Jun 22, 2020
6ac13e2
update change.log
Jun 22, 2020
a87bbb2
remove SecurityTopology
Jun 22, 2020
5c3a232
fix version
Jun 22, 2020
4c92e11
Merge branch 'master' into master
ariklin Jun 22, 2020
c299db3
Fix comments
Jun 23, 2020
29c4b1e
fix location
Jun 28, 2020
9c22a4a
fix comment
Jun 29, 2020
38f54fe
fix comment
Jun 30, 2020
1bfd865
fix version number
Jul 2, 2020
37d8307
Create Adaptive Application Control API cmdlets
Jul 13, 2020
fb42f87
Create Adaptive Application Control API cmdlets
Jul 13, 2020
6aa8da4
Merge branch 'master' into master
ariklin Jul 13, 2020
cec29b8
fix1
Jul 13, 2020
1264f40
fix2
Jul 13, 2020
4b2f053
Add back comment end token
wyunchi-ms Jul 14, 2020
d3ac16a
Introducing ScurityAdaptiveNetworkHardening cmdlets
Jul 14, 2020
2ce14c0
Update Security.csproj
wyunchi-ms Jul 15, 2020
40cfcb9
Update ChangeLog.md
wyunchi-ms Jul 15, 2020
80bdf73
1
Jul 16, 2020
6316fa4
Merge branch 'master' into SecurityTopology
ariklin Jul 16, 2020
ee49fbf
Merge pull request #3 from ariklin/SecurityTopology
ariklin Jul 16, 2020
b12717d
Introducing Az.Security AdaptiveNetworkHardening cmdlets
Jul 22, 2020
97457d4
Introducing Az.Security AdaptiveNetworkHardening cmdlets
Jul 22, 2020
0a311a3
Merge branch 'master' into master
ariklin Jul 22, 2020
cb78655
change to a singular noun for the parameter name
Jul 26, 2020
7d3fa0e
Merge branch 'master' of https://github.com/ariklin/azure-powershell-1
Jul 26, 2020
adc9e18
change to a singular noun for the parameter name
Jul 27, 2020
b0127dd
change to a singular noun for the parameter name2
Jul 27, 2020
27b422d
implement ShouldProcess
Jul 27, 2020
37f91d0
fix1
Jul 27, 2020
70f5c67
Merge remote-tracking branch 'upstream/master'
Dec 2, 2020
ff7ffde
Merge branch 'master' of https://github.com/Azure/azure-powershell
Dec 16, 2020
10cc134
Update JIT help
Dec 16, 2020
5fa29b8
remove files
Dec 16, 2020
adaea93
revert ChangeLog.md
Dec 16, 2020
91cb6e9
Merge branch 'Azure:main' into master
ariklin Feb 13, 2022
d3e6f57
Merge branch 'Azure:main' into master
ariklin Mar 27, 2022
e41bd98
Merge branch 'Azure:main' into master
ariklin Apr 24, 2022
9b51160
Add new " SecuritySolutionsReferenceData" cmdlet
ariklin Apr 24, 2022
43827c8
Merge branch 'master' of https://github.com/ariklin/azure-powershell-…
ariklin Apr 24, 2022
d1162fe
Merge branch 'main' into master
ariklin Apr 26, 2022
e1fdde7
update 1
ariklin Apr 26, 2022
fde1294
Merge branch 'master' of https://github.com/ariklin/azure-powershell-…
ariklin Apr 26, 2022
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
@@ -0,0 +1,40 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.ScenarioTest;
using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Security.Test.ScenarioTests
{
public class SecuritySolutionsReferenceDataTests
{
private readonly XunitTracingInterceptor _logger;

public SecuritySolutionsReferenceDataTests(Xunit.Abstractions.ITestOutputHelper output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
TestExecutionHelpers.SetUpSessionAndProfile();
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetSubscriptionScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSecuritySolutionsReferenceData-SubscriptionScope");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Get discovered security solutions on a subscription scope
#>
function Get-AzSecuritySolutionsReferenceData-SubscriptionScope
{
$SecuritySolutionsReferenceData = Get-AzSecuritySolutionsReferenceData
Validate-SecuritySolutionsReferenceData $SecuritySolutionsReferenceData
}

<#
.SYNOPSIS
Validates a list of security discoveredSecuritySolutions
#>
function Validate-SecuritySolutionsReferenceData
{
param($SecuritySolutionsReferenceData)

Assert-True { $SecuritySolutionsReferenceData.Count -gt 0 }

Foreach($SecuritySolutionsReferenceData in $SecuritySolutionsReferenceData)
{
Validate-SecuritySolutionsReferenceData $SecuritySolutionsReferenceData
}
}

<#
.SYNOPSIS
Validates a single SecuritySolutionsReferenceData
#>
function Validate-SecuritySolutionsReferenceData
{
param($SecuritySolutionsReferenceData)

Assert-NotNull $SecuritySolutionsReferenceData
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"Entries": [
{
"RequestUri": "/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/providers/Microsoft.Security/securitySolutionsReferenceData?api-version=2020-01-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjdiYzYwNGItNTRiMi00Yzc4LWE3YmEtNzI1MDQ5MjBhMzE5L3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VjdXJpdHkvc2VjdXJpdHlTb2x1dGlvbnNSZWZlcmVuY2VEYXRhP2FwaS12ZXJzaW9uPTIwMjAtMDEtMDE=",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"x-ms-client-request-id": [
"abc510fc-77d5-480e-a2ce-f779e2587af4"
],
"Accept-Language": [
"en-US"
],
"User-Agent": [
"FxVersion/4.700.22.16002",
"OSName/Windows",
"OSVersion/Microsoft.Windows.10.0.22000",
"Microsoft.Azure.Management.Security.SecurityCenterClient/3.0.0.0"
]
},
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
],
"Pragma": [
"no-cache"
],
"x-ms-original-request-ids": [
"",
"",
""
],
"x-ms-ratelimit-remaining-subscription-resource-requests": [
"749"
],
"x-ms-request-id": [
"6b136efa-30f0-4e91-b561-196ba47198e8"
],
"x-ms-correlation-request-id": [
"6b136efa-30f0-4e91-b561-196ba47198e8"
],
"x-ms-routing-request-id": [
"UAECENTRAL:20220424T150245Z:6b136efa-30f0-4e91-b561-196ba47198e8"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
"Sun, 24 Apr 2022 15:02:44 GMT"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
],
"Content-Length": [
"1903"
]
},
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/rapid7.insightplatform\",\r\n \"name\": \"rapid7.insightplatform\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutionsReferenceData\",\r\n \"properties\": {\r\n \"alertVendorName\": \"Rapid7\",\r\n \"securityFamily\": \"Va\",\r\n \"packageInfoUrl\": \"www.azure.com\",\r\n \"productName\": \"Vulnerability Assessment\",\r\n \"provisionType\": \"SemiIntegrated\",\r\n \"publisher\": \"rapid7\",\r\n \"publisherDisplayName\": \"Rapid7 Inc.\",\r\n \"template\": \"rapid7/insightplatform\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/qualys.qualysAgent\",\r\n \"name\": \"qualys.qualysAgent\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutionsReferenceData\",\r\n \"properties\": {\r\n \"alertVendorName\": \"Qualys VA\",\r\n \"securityFamily\": \"Va\",\r\n \"packageInfoUrl\": \"http://www.qualys.com/\",\r\n \"productName\": \"Vulnerability Assessment\",\r\n \"provisionType\": \"SemiIntegrated\",\r\n \"publisher\": \"qualys\",\r\n \"publisherDisplayName\": \"Qualys, Inc.\",\r\n \"template\": \"qualys/qualysAgent\",\r\n \"templateAdministrationExpression\": \"http://www.qualys.com/\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/providers/Microsoft.Security/locations/centralus/securitySolutionsReferenceData/microsoft.ApplicationGateway-ARM\",\r\n \"name\": \"microsoft.ApplicationGateway-ARM\",\r\n \"type\": \"Microsoft.Security/locations/securitySolutionsReferenceData\",\r\n \"properties\": {\r\n \"alertVendorName\": \"Microsoft\",\r\n \"securityFamily\": \"SaasWaf\",\r\n \"packageInfoUrl\": \"www.azure.com\",\r\n \"productName\": \"Web Application Firewall\",\r\n \"provisionType\": \"SemiIntegrated\",\r\n \"publisher\": \"microsoft\",\r\n \"publisherDisplayName\": \"Microsoft Inc.\",\r\n \"template\": \"microsoft/ApplicationGateway-ARM\",\r\n \"templateAdministrationExpression\": \"https://portal.azure.com#resource/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/applicationGateways/{name}/overview\"\r\n }\r\n }\r\n ]\r\n}",
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "67bc604b-54b2-4c78-a7ba-72504920a319"
}
}
3 changes: 2 additions & 1 deletion src/Security/Security/Az.Security.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ NestedModules = @('Microsoft.Azure.PowerShell.Cmdlets.Security.dll')
FunctionsToExport = @()

# 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.
CmdletsToExport = 'New-AzAlertsSuppressionRuleScope', 'Get-AzAlertsSuppressionRule', 'Set-AzAlertsSuppressionRule', 'Remove-AzAlertsSuppressionRule',

CmdletsToExport = 'Get-AzSecuritySolutionsReferenceData', 'New-AzAlertsSuppressionRuleScope', 'Get-AzAlertsSuppressionRule', 'Set-AzAlertsSuppressionRule', 'Remove-AzAlertsSuppressionRule',
'Get-AzSecurityAlert', 'Set-AzSecurityAlert',
'Get-AzSecurityAutoProvisioningSetting',
'Set-AzSecurityAutoProvisioningSetting', 'Get-AzSecurityCompliance',
Expand Down
3 changes: 3 additions & 0 deletions src/Security/Security/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
`Set-AlertsSuppressionRule`
`New-AzAlertsSuppressionRuleScope`

## Version 1.3.0
* Added new cmdlets for security SecuritySolutionsReferenceData API

## Version 1.2.0
* Added new cmdlets for security Automations API

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ------------------------------------

using Commands.Security;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Commands.Security.Common;
using Microsoft.Azure.Commands.Security.Models.SolutionsReferenceData;
using Microsoft.Azure.Commands.SecurityCenter.Common;
using Microsoft.Rest.Azure;
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Text;

namespace Microsoft.Azure.Commands.Security.Cmdlets.SolutionsReferenceData
{
[Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "SecuritySolutionsReferenceData", DefaultParameterSetName = ParameterSetNames.SubscriptionScope), OutputType(typeof(PSSolutionReferenceData))]
public class GetSecuritySolutionReferenceData : SecurityCenterCmdletBase
{
[Parameter(ParameterSetName = ParameterSetNames.SubscriptionLevelResource, Mandatory = true, HelpMessage = ParameterHelpMessages.ResourceName)]

[Parameter(ParameterSetName = ParameterSetNames.ResourceId, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.ResourceId)]
[ValidateNotNullOrEmpty]
public string ResourceId { get; set; }

public override void ExecuteCmdlet()
{
switch (ParameterSetName)
{
case ParameterSetNames.SubscriptionScope:
var solution = SecurityCenterClient.SecuritySolutionsReferenceData.ListWithHttpMessagesAsync().GetAwaiter().GetResult().Body.Value;
WriteObject(solution.ConvertToPSType(), enumerateCollection: true);
break;

default:
throw new PSInvalidOperationException();
}
}

private object ConvertToPSType()
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Linq;
using Microsoft.Azure.Management.Security.Models;

namespace Microsoft.Azure.Commands.Security.Models.SolutionsReferenceData
{
public static class PSSecuritySolutionReferenceDataConverters
{
public static PSSolutionReferenceData ConvertToPSType(this SecuritySolutionsReferenceData value)
{
return new PSSolutionReferenceData()
{
Id = value.Id,
Name = value.Name,
template = value.Template,
SecurityFamily = value.SecurityFamily
};
}

public static List<PSSolutionReferenceData> ConvertToPSType(this IEnumerable<SecuritySolutionsReferenceData> value)
{
return value.Select(solution => solution.ConvertToPSType()).ToList();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Security.Models.SolutionsReferenceData
{
public class PSSolutionReferenceData
{
public string Id { get; set; }

public string Name { get; set; }

public string SecurityFamily { get; set; }

public string alertVendorName { get; set; }

public string packageInfoUrl { get; set; }

public string productName { get; set; }

public string publisher { get; set; }

public string publisherDisplayName { get; set; }

public string template { get; set; }

}


}

Loading