MCSAssessment.psm1
|
<#
.SYNOPSIS Consolidated assessment script for Azure workloads, leveraging multiple tools to gather security and optimization recommendations. .DESCRIPTION This script runs all the necessary tools to compose the assessment of a workload in Azure, including Azure Resource Inventory, WARA, Defender for Cloud, Security Benchmark and PSRule. The output is a table in CSV format that can be easily analyzed and shared. .PARAMETER TenantID Specify the tenant ID of the workload. .PARAMETER SubscriptionID Use this parameter to specify Subscription in the Tenant .PARAMETER WorkloadName Use this parameter to specify the name of the workload. This will be used as suffix for the generated files. .PARAMETER SkipCompress Use this parameter to skip the final compression of the generated files in a ZIP file. .PARAMETER SkipARI Use this parameter to skip the Azure Resource Inventory collection. .PARAMETER SkipWARA Use this parameter to skip the WARA recommendations collection. .PARAMETER SkipMDC Use this parameter to skip the MDC collection. .PARAMETER SkipMCSB Use this parameter to skip the MCSB collection. .PARAMETER SkipPSRule Use this parameter to skip the PSRule collection. .PARAMETER FullWARA By default, only the WARA recommendations with automated remediation are included in the output. Use this parameter to include all the WARA recommendations, even those without automated remediation (non-automated ones will have "N/A" in the "Potential Benefit" column of the output). .EXAMPLE Default utilization. Specify tenant and Subscriptions that are part of the workload: PS C:\> Invoke-MCSAssessment -TenantID "00000000-0000-0000-0000-000000000000" -SubscriptionID 00000000-0000-0000-0000-000000000000,11111111-1111-1111-1111-111111111111 -WorkloadName "XYZ - Prod" Runs the script but skips Azure Resource Inventory collection: PS C:\> Invoke-MCSAssessment -TenantID "00000000-0000-0000-0000-000000000000" -SubscriptionID 00000000-0000-0000-0000-000000000000,11111111-1111-1111-1111-111111111111 -SkipARI -WorkloadName "XYZ - Prod" Runs the script and include all WARA recommendations (not only the automated ones): PS C:\> Invoke-MCSAssessment -TenantID "00000000-0000-0000-0000-000000000000" -SubscriptionID 00000000-0000-0000-0000-000000000000,11111111-1111-1111-1111-111111111111 -FullWARA -WorkloadName "XYZ - Prod" .NOTES AUTHORS: Claudio Merola | Azure Infrastucture/Automation/Devops/Governance Copyright (c) 2025 Microsoft Corporation. All rights reserved. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .LINK Official Repository: TBD #> foreach ($directory in @('src\Private', 'src\Public')) { Get-ChildItem -Path "$PSScriptRoot\$directory\*.ps1" -Recurse | ForEach-Object { . $_.FullName } } |