diff --git a/src/Security/Security.Test/ScenarioTests/SecuritySolutionTests .cs b/src/Security/Security.Test/ScenarioTests/SecuritySolutionTests .cs new file mode 100644 index 000000000000..2d6dfc052060 --- /dev/null +++ b/src/Security/Security.Test/ScenarioTests/SecuritySolutionTests .cs @@ -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 SecuritySolutionTests + { + private readonly XunitTracingInterceptor _logger; + + public SecuritySolutionTests(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-AzSecuritySolution-SubscriptionScope"); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Test/ScenarioTests/SecuritySolutionTests.ps1 b/src/Security/Security.Test/ScenarioTests/SecuritySolutionTests.ps1 new file mode 100644 index 000000000000..b02dd65ba955 --- /dev/null +++ b/src/Security/Security.Test/ScenarioTests/SecuritySolutionTests.ps1 @@ -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-AzSecuritySolution-SubscriptionScope +{ + $SecuritySolution = Get-AzSecuritySolution + Validate-SecuritySolution $SecuritySolution +} + +<# +.SYNOPSIS +Validates a list of security discoveredSecuritySolutions +#> +function Validate-SecuritySolution +{ + param($SecuritySolution) + + Assert-True { $SecuritySolution.Count -gt 0 } + + Foreach($SecuritySolution in $SecuritySolution) + { + Validate-SecuritySolution $SecuritySolution + } +} + +<# +.SYNOPSIS +Validates a single SecuritySolution +#> +function Validate-SecuritySolution +{ + param($SecuritySolution) + + Assert-NotNull $SecuritySolution +} \ No newline at end of file diff --git a/src/Security/Security.Test/SessionRecords/Microsoft.Azure.Commands.Security.Test.ScenarioTests.SecuritySolutionTests/GetSubscriptionScope.json b/src/Security/Security.Test/SessionRecords/Microsoft.Azure.Commands.Security.Test.ScenarioTests.SecuritySolutionTests/GetSubscriptionScope.json new file mode 100644 index 000000000000..7663fdd27ea1 --- /dev/null +++ b/src/Security/Security.Test/SessionRecords/Microsoft.Azure.Commands.Security.Test.ScenarioTests.SecuritySolutionTests/GetSubscriptionScope.json @@ -0,0 +1,73 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/providers/Microsoft.Security/securitySolutions?api-version=2020-01-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjdiYzYwNGItNTRiMi00Yzc4LWE3YmEtNzI1MDQ5MjBhMzE5L3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VjdXJpdHkvc2VjdXJpdHlTb2x1dGlvbnM/YXBpLXZlcnNpb249MjAyMC0wMS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f378fdcf-41b5-4409-99e7-69c0c811a745" + ], + "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": [ + "a10d7f95-216c-4532-aa03-554944621480" + ], + "x-ms-correlation-request-id": [ + "a10d7f95-216c-4532-aa03-554944621480" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20220501T112827Z:a10d7f95-216c-4532-aa03-554944621480" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sun, 01 May 2022 11:28:27 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "6739" + ] + }, + "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}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "67bc604b-54b2-4c78-a7ba-72504920a319" + } +} \ No newline at end of file diff --git a/src/Security/Security/Az.Security.psd1 b/src/Security/Security/Az.Security.psd1 index 3934f6810ae3..91319730adbd 100644 --- a/src/Security/Security/Az.Security.psd1 +++ b/src/Security/Security/Az.Security.psd1 @@ -75,7 +75,8 @@ 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 = 'Get-AzSecuritySolutionsReferenceData', 'New-AzAlertsSuppressionRuleScope', 'Get-AzAlertsSuppressionRule', 'Set-AzAlertsSuppressionRule', 'Remove-AzAlertsSuppressionRule', +CmdletsToExport = 'Get-AzSecuritySolution', 'Get-AzSecuritySolutionsReferenceData', 'New-AzAlertsSuppressionRuleScope', 'Get-AzAlertsSuppressionRule', 'Set-AzAlertsSuppressionRule', 'Remove-AzAlertsSuppressionRule', + 'Get-AzSecurityAlert', 'Set-AzSecurityAlert', 'Get-AzSecurityAutoProvisioningSetting', 'Set-AzSecurityAutoProvisioningSetting', 'Get-AzSecurityCompliance', @@ -191,4 +192,3 @@ PrivateData = @{ # DefaultCommandPrefix = '' } - diff --git a/src/Security/Security/ChangeLog.md b/src/Security/Security/ChangeLog.md index c7d0103b5031..d36db849f9d7 100644 --- a/src/Security/Security/ChangeLog.md +++ b/src/Security/Security/ChangeLog.md @@ -19,6 +19,7 @@ --> ## Upcoming Release +* Added new cmdlet: `Get-AzSecuritySolution` * Added Alerts Suppression Rules to cmdlets: `Get-AlertsSuppressionRule` `Remove-AlertsSuppressionRule` diff --git a/src/Security/Security/Cmdlets/SecuritySolution/GetSecuritySolution.cs b/src/Security/Security/Cmdlets/SecuritySolution/GetSecuritySolution.cs new file mode 100644 index 000000000000..124c3619b941 --- /dev/null +++ b/src/Security/Security/Cmdlets/SecuritySolution/GetSecuritySolution.cs @@ -0,0 +1,70 @@ +// ---------------------------------------------------------------------------------- +// +// 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.SecuritySolutions; +using Microsoft.Azure.Commands.SecurityCenter.Common; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.Commands.Security.Cmdlets.SecuritySolution +{ + [Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "SecuritySolution", DefaultParameterSetName = ParameterSetNames.SubscriptionScope), OutputType(typeof(PSSecuritySecuritySolution))] + public class GetSecuritySolution : SecurityCenterCmdletBase + { + [Parameter(ParameterSetName = ParameterSetNames.ResourceGroupLevelResource, Mandatory = true, HelpMessage = ParameterHelpMessages.ResourceGroupName)] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Parameter(ParameterSetName = ParameterSetNames.ResourceGroupLevelResource, Mandatory = true, HelpMessage = ParameterHelpMessages.ResourceName)] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(ParameterSetName = ParameterSetNames.ResourceGroupLevelResource, Mandatory = true, HelpMessage = ParameterHelpMessages.Location)] + [ValidateNotNullOrEmpty] + [LocationCompleter("Microsoft.Security/SecuritySolutions")] + public string Location { get; set; } + + [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 ssss = SecurityCenterClient.SecuritySolutions.ListWithHttpMessagesAsync().GetAwaiter().GetResult().Body; + WriteObject(ssss.ConvertToPSType(), enumerateCollection: true); + break; + case ParameterSetNames.ResourceGroupLevelResource: + SecurityCenterClient.AscLocation = SecurityCenterClient.Locations.ListWithHttpMessagesAsync().GetAwaiter().GetResult().Body.First().Name; + + var sss = SecurityCenterClient.SecuritySolutions.GetWithHttpMessagesAsync(ResourceGroupName, Name).GetAwaiter().GetResult().Body; + WriteObject(sss.ConvertToPSType(), enumerateCollection: false); + break; + case ParameterSetNames.ResourceId: + SecurityCenterClient.AscLocation = AzureIdUtilities.GetResourceLocation(ResourceId); + + sss = SecurityCenterClient.SecuritySolutions.GetWithHttpMessagesAsync(AzureIdUtilities.GetResourceGroup(ResourceId), AzureIdUtilities.GetResourceName(ResourceId)).GetAwaiter().GetResult().Body; + WriteObject(sss.ConvertToPSType(), enumerateCollection: false); + break; + default: + throw new PSInvalidOperationException(); + } + } + } +} diff --git a/src/Security/Security/Models/SecuritySolution/PSSecuritySecuritySolution.cs b/src/Security/Security/Models/SecuritySolution/PSSecuritySecuritySolution.cs new file mode 100644 index 000000000000..628fe9b3c381 --- /dev/null +++ b/src/Security/Security/Models/SecuritySolution/PSSecuritySecuritySolution.cs @@ -0,0 +1,31 @@ +// ---------------------------------------------------------------------------------- +// +// 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.SecuritySolutions +{ + public class PSSecuritySecuritySolution + { + public string Id { get; set; } + + public string Name { get; set; } + + public string provisioningState { get; set; } + + public string template { get; set; } + + public string SecurityFamily { get; set; } + + public string protectionStatus { get; set; } + } +} diff --git a/src/Security/Security/Models/SecuritySolution/PSSecuritySecuritySolutionConverters.cs b/src/Security/Security/Models/SecuritySolution/PSSecuritySecuritySolutionConverters.cs new file mode 100644 index 000000000000..0e115e13d738 --- /dev/null +++ b/src/Security/Security/Models/SecuritySolution/PSSecuritySecuritySolutionConverters.cs @@ -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. +// ---------------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Linq; +using Microsoft.Azure.Management.Security.Models; + +namespace Microsoft.Azure.Commands.Security.Models.SecuritySolutions +{ + public static class PSSecuritySecuritySolutionConverters + { + public static PSSecuritySecuritySolution ConvertToPSType(this SecuritySolution value) + { + return new PSSecuritySecuritySolution() + { + Id = value.Id, + Name = value.Name, + provisioningState = value.ProvisioningState, + template = value.Template, + SecurityFamily = value.SecurityFamily, + protectionStatus = value.ProtectionStatus + }; + } + + public static List ConvertToPSType(this IEnumerable value) + { + return value.Select(sss => sss.ConvertToPSType()).ToList(); + } + } +} diff --git a/src/Security/Security/help/Get-AzSecuritySolution.md b/src/Security/Security/help/Get-AzSecuritySolution.md new file mode 100644 index 000000000000..2c0cd566fabb --- /dev/null +++ b/src/Security/Security/help/Get-AzSecuritySolution.md @@ -0,0 +1,78 @@ +--- +external help file: Microsoft.Azure.PowerShell.Cmdlets.Security.dll-Help.xml +Module Name: Az.Security +online version: https://docs.microsoft.com/powershell/module/az.security/Get-AzSecuritySolutionsReferenceData +schema: 2.0.0 +--- + +# Get-AzSecuritySolution + +## SYNOPSIS +Get Security Solutions + +## SYNTAX + +### SubscriptionScope (Default) +``` +Get-AzSecuritySolution [-DefaultProfile ] [] +``` + +## DESCRIPTION +Get Security Solutions + +## EXAMPLES + +### Example 1 +```powershell +Get-AzSecuritySolution +``` + +```output +Id : /subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/QualysLICTest/providers/Microsoft.Security/locations/centralus/securitySolutions/QualysTest +Name : QualysLICTest +provisioningState : Succeeded +template : qualys.qualysAgent +SecurityFamily : Va +protectionStatus : Good + +Id : /subscriptions/67bc604b-54b2-4c78-a7ba-72504920a319/resourceGroups/OfriWafTest/providers/MicrosoftSecurity/locations/centralus/securitySolutions/WafTest +Name : WafTest +provisioningState : Succeeded +template : Microsoft.ApplicationGateway-ARM +SecurityFamily : SaasWaf +protectionStatus : Good +``` + +Get all Get Security Solutions in the subscription + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer +Parameter Sets: (All) +Aliases: AzContext, AzureRmContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +## OUTPUTS + +### Microsoft.Azure.Commands.Security.Models.ExternalSecuritySolutions.PSSecurityExternalSecuritySolution + +## NOTES + +## RELATED LINKS \ No newline at end of file