docs: Update Comment Help
This commit is contained in:
@@ -21,30 +21,30 @@
|
||||
Switch to export the results to an Excel file. When specified, results are exported in Excel format.
|
||||
.INPUTS
|
||||
[CISAuditResult[]] - An array of CISAuditResult objects.
|
||||
[string] - A path to a CSV file.
|
||||
[string] - A path to a CSV file.
|
||||
.OUTPUTS
|
||||
[PSCustomObject] - A custom object containing the path to the zip file and its hash.
|
||||
.EXAMPLE
|
||||
Export-M365SecurityAuditTable -AuditResults $object -OutputTestNumber 6.1.2
|
||||
# Outputs the result of test number 6.1.2 from the provided audit results as an object.
|
||||
# Outputs the result of test number 6.1.2 from the provided audit results as an object.
|
||||
.EXAMPLE
|
||||
Export-M365SecurityAuditTable -ExportAllTests -AuditResults $object -ExportPath "C:\temp"
|
||||
# Exports all audit results to the specified path in CSV format.
|
||||
# Exports all audit results to the specified path in CSV format.
|
||||
.EXAMPLE
|
||||
Export-M365SecurityAuditTable -CsvPath "C:\temp\auditresultstoday1.csv" -OutputTestNumber 6.1.2
|
||||
# Outputs the result of test number 6.1.2 from the CSV file as an object.
|
||||
# Outputs the result of test number 6.1.2 from the CSV file as an object.
|
||||
.EXAMPLE
|
||||
Export-M365SecurityAuditTable -ExportAllTests -CsvPath "C:\temp\auditresultstoday1.csv" -ExportPath "C:\temp"
|
||||
# Exports all audit results from the CSV file to the specified path in CSV format.
|
||||
# Exports all audit results from the CSV file to the specified path in CSV format.
|
||||
.EXAMPLE
|
||||
Export-M365SecurityAuditTable -ExportAllTests -AuditResults $object -ExportPath "C:\temp" -ExportOriginalTests
|
||||
# Exports all audit results along with the original test results to the specified path in CSV format.
|
||||
# Exports all audit results along with the original test results to the specified path in CSV format.
|
||||
.EXAMPLE
|
||||
Export-M365SecurityAuditTable -ExportAllTests -CsvPath "C:\temp\auditresultstoday1.csv" -ExportPath "C:\temp" -ExportOriginalTests
|
||||
# Exports all audit results from the CSV file along with the original test results to the specified path in CSV format.
|
||||
# Exports all audit results from the CSV file along with the original test results to the specified path in CSV format.
|
||||
.EXAMPLE
|
||||
Export-M365SecurityAuditTable -ExportAllTests -AuditResults $object -ExportPath "C:\temp" -ExportToExcel
|
||||
# Exports all audit results to the specified path in Excel format.
|
||||
# Exports all audit results to the specified path in Excel format.
|
||||
.LINK
|
||||
https://criticalsolutionsnetwork.github.io/M365FoundationsCISReport/#Export-M365SecurityAuditTable
|
||||
#>
|
||||
|
@@ -8,19 +8,19 @@
|
||||
.EXAMPLE
|
||||
PS> Get-AdminRoleUserLicense
|
||||
|
||||
This example retrieves all administrative role users along with their licenses by connecting to Microsoft Graph using the default scopes.
|
||||
This example retrieves all administrative role users along with their licenses by connecting to Microsoft Graph using the default scopes.
|
||||
.EXAMPLE
|
||||
PS> Get-AdminRoleUserLicense -SkipGraphConnection
|
||||
|
||||
This example retrieves all administrative role users along with their licenses without attempting to connect to Microsoft Graph, assuming that the connection is already established.
|
||||
This example retrieves all administrative role users along with their licenses without attempting to connect to Microsoft Graph, assuming that the connection is already established.
|
||||
.INPUTS
|
||||
None. You cannot pipe objects to Get-AdminRoleUserLicense.
|
||||
.OUTPUTS
|
||||
PSCustomObject
|
||||
Returns a custom object for each user with administrative roles that includes the following properties: RoleName, UserName, UserPrincipalName, UserId, HybridUser, and Licenses.
|
||||
Returns a custom object for each user with administrative roles that includes the following properties: RoleName, UserName, UserPrincipalName, UserId, HybridUser, and Licenses.
|
||||
.NOTES
|
||||
Creation Date: 2024-04-15
|
||||
Purpose/Change: Initial function development to support Microsoft 365 administrative role auditing.
|
||||
Purpose/Change: Initial function development to support Microsoft 365 administrative role auditing.
|
||||
.LINK
|
||||
https://criticalsolutionsnetwork.github.io/M365FoundationsCISReport/#Get-AdminRoleUserLicense
|
||||
#>
|
||||
|
@@ -7,20 +7,20 @@
|
||||
The User Principal Name (UPN) of a specific user to retrieve MFA status for. If not provided, the function retrieves MFA status for all users.
|
||||
.EXAMPLE
|
||||
Get-MFAStatus
|
||||
Retrieves the MFA status for all Azure Active Directory users.
|
||||
Retrieves the MFA status for all Azure Active Directory users.
|
||||
.EXAMPLE
|
||||
Get-MFAStatus -UserId "example@domain.com"
|
||||
Retrieves the MFA status for the specified user with the UPN "example@domain.com".
|
||||
Retrieves the MFA status for the specified user with the UPN "example@domain.com".
|
||||
.OUTPUTS
|
||||
System.Object
|
||||
Returns a sorted list of custom objects containing the following properties:
|
||||
- UserPrincipalName
|
||||
- DisplayName
|
||||
- MFAState
|
||||
- MFADefaultMethod
|
||||
- MFAPhoneNumber
|
||||
- PrimarySMTP
|
||||
- Aliases
|
||||
Returns a sorted list of custom objects containing the following properties:
|
||||
- UserPrincipalName
|
||||
- DisplayName
|
||||
- MFAState
|
||||
- MFADefaultMethod
|
||||
- MFAPhoneNumber
|
||||
- PrimarySMTP
|
||||
- Aliases
|
||||
.NOTES
|
||||
The function requires the MSOL module to be installed and connected to your tenant.
|
||||
Ensure that you have the necessary permissions to read user and MFA status information.
|
||||
|
@@ -16,11 +16,11 @@
|
||||
.EXAMPLE
|
||||
Grant-M365SecurityAuditConsent -UserPrincipalNameForConsent user@example.com
|
||||
|
||||
Grants Microsoft Graph permissions to user@example.com for the client application with the specified Application ID.
|
||||
Grants Microsoft Graph permissions to user@example.com for the client application with the specified Application ID.
|
||||
.EXAMPLE
|
||||
Grant-M365SecurityAuditConsent -UserPrincipalNameForConsent user@example.com -SkipGraphConnection
|
||||
|
||||
Grants Microsoft Graph permissions to user@example.com, skipping the connection to Microsoft Graph.
|
||||
Grants Microsoft Graph permissions to user@example.com, skipping the connection to Microsoft Graph.
|
||||
.NOTES
|
||||
This function requires the Microsoft.Graph module version 2.4.0 or higher.
|
||||
.LINK
|
||||
|
@@ -8,7 +8,7 @@
|
||||
The URL of the tenant admin. If not specified, none of the SharePoint Online tests will run.
|
||||
.PARAMETER DomainName
|
||||
The domain name of the Microsoft 365 environment to test. It is optional and will trigger various tests to run only for the specified domain.
|
||||
Tests Affected: 2.1.9/Test-EnableDKIM, 1.3.1/Test-PasswordNeverExpirePolicy, 2.1.4/Test-SafeAttachmentsPolicy
|
||||
Tests Affected: 2.1.9/Test-EnableDKIM, 1.3.1/Test-PasswordNeverExpirePolicy, 2.1.4/Test-SafeAttachmentsPolicy
|
||||
.PARAMETER ELevel
|
||||
Specifies the E-Level (E3 or E5) for the audit. This parameter is optional and can be combined with the ProfileLevel parameter.
|
||||
.PARAMETER ProfileLevel
|
||||
@@ -25,10 +25,10 @@
|
||||
Specifies specific recommendations to exclude from the audit. Accepts an array of recommendation numbers.
|
||||
.PARAMETER ApprovedCloudStorageProviders
|
||||
Specifies the approved cloud storage providers for the audit. Accepts an array of cloud storage provider names for test 8.1.1/Test-TeamsExternalFileSharing.
|
||||
Acceptable values: 'GoogleDrive', 'ShareFile', 'Box', 'DropBox', 'Egnyte'
|
||||
Acceptable values: 'GoogleDrive', 'ShareFile', 'Box', 'DropBox', 'Egnyte'
|
||||
.PARAMETER ApprovedFederatedDomains
|
||||
Specifies the approved federated domains for the audit test 8.2.1/Test-TeamsExternalAccess. Accepts an array of allowed domain names.
|
||||
Additional Tests may include this parameter in the future.
|
||||
Additional Tests may include this parameter in the future.
|
||||
.PARAMETER DoNotConnect
|
||||
If specified, the cmdlet will not establish a connection to Microsoft 365 services.
|
||||
.PARAMETER DoNotDisconnect
|
||||
@@ -40,90 +40,91 @@
|
||||
.EXAMPLE
|
||||
PS> Invoke-M365SecurityAudit
|
||||
|
||||
Performs a security audit using default parameters.
|
||||
Output:
|
||||
Performs a security audit using default parameters.
|
||||
Output:
|
||||
|
||||
Status : Fail
|
||||
ELevel : E3
|
||||
ProfileLevel: L1
|
||||
Connection : Microsoft Graph
|
||||
Rec : 1.1.1
|
||||
Result : False
|
||||
Details : Non-compliant accounts:
|
||||
Username | Roles | HybridStatus | Missing Licence
|
||||
user1@domain.com| Global Administrator | Cloud-Only | AAD_PREMIUM
|
||||
user2@domain.com| Global Administrator | Hybrid | AAD_PREMIUM, AAD_PREMIUM_P2
|
||||
FailureReason: Non-Compliant Accounts: 2
|
||||
Status : Fail
|
||||
ELevel : E3
|
||||
ProfileLevel: L1
|
||||
Connection : Microsoft Graph
|
||||
Rec : 1.1.1
|
||||
Result : False
|
||||
Details : Non-compliant accounts:
|
||||
Username | Roles | HybridStatus | Missing Licence
|
||||
user1@domain.com| Global Administrator | Cloud-Only | AAD_PREMIUM
|
||||
user2@domain.com| Global Administrator | Hybrid | AAD_PREMIUM, AAD_PREMIUM_P2
|
||||
FailureReason: Non-Compliant Accounts: 2
|
||||
.EXAMPLE
|
||||
PS> Invoke-M365SecurityAudit -TenantAdminUrl "https://contoso-admin.sharepoint.com" -DomainName "contoso.com" -ELevel "E5" -ProfileLevel "L1"
|
||||
|
||||
Performs a security audit for the E5 level and L1 profile in the specified Microsoft 365 environment.
|
||||
Output:
|
||||
Performs a security audit for the E5 level and L1 profile in the specified Microsoft 365 environment.
|
||||
Output:
|
||||
|
||||
Status : Fail
|
||||
ELevel : E5
|
||||
ProfileLevel: L1
|
||||
Connection : Microsoft Graph
|
||||
Rec : 1.1.1
|
||||
Result : False
|
||||
Details : Non-compliant accounts:
|
||||
Username | Roles | HybridStatus | Missing Licence
|
||||
user1@domain.com| Global Administrator | Cloud-Only | AAD_PREMIUM
|
||||
user2@domain.com| Global Administrator | Hybrid | AAD_PREMIUM, AAD_PREMIUM_P2
|
||||
FailureReason: Non-Compliant Accounts: 2
|
||||
Status : Fail
|
||||
ELevel : E5
|
||||
ProfileLevel: L1
|
||||
Connection : Microsoft Graph
|
||||
Rec : 1.1.1
|
||||
Result : False
|
||||
Details : Non-compliant accounts:
|
||||
Username | Roles | HybridStatus | Missing Licence
|
||||
user1@domain.com| Global Administrator | Cloud-Only | AAD_PREMIUM
|
||||
user2@domain.com| Global Administrator | Hybrid | AAD_PREMIUM, AAD_PREMIUM_P2
|
||||
FailureReason: Non-Compliant Accounts: 2
|
||||
.EXAMPLE
|
||||
PS> Invoke-M365SecurityAudit -TenantAdminUrl "https://contoso-admin.sharepoint.com" -DomainName "contoso.com" -IncludeIG1
|
||||
|
||||
Performs an audit including all tests where IG1 is true.
|
||||
Output:
|
||||
Performs an audit including all tests where IG1 is true.
|
||||
Output:
|
||||
|
||||
Status : Fail
|
||||
ELevel : E3
|
||||
ProfileLevel: L1
|
||||
Connection : Microsoft Graph
|
||||
Rec : 1.1.1
|
||||
Result : False
|
||||
Details : Non-compliant accounts:
|
||||
Username | Roles | HybridStatus | Missing Licence
|
||||
user1@domain.com| Global Administrator | Cloud-Only | AAD_PREMIUM
|
||||
user2@domain.com| Global Administrator | Hybrid | AAD_PREMIUM, AAD_PREMIUM_P2
|
||||
FailureReason: Non-Compliant Accounts: 2
|
||||
Status : Fail
|
||||
ELevel : E3
|
||||
ProfileLevel: L1
|
||||
Connection : Microsoft Graph
|
||||
Rec : 1.1.1
|
||||
Result : False
|
||||
Details : Non-compliant accounts:
|
||||
Username | Roles | HybridStatus | Missing Licence
|
||||
user1@domain.com| Global Administrator | Cloud-Only | AAD_PREMIUM
|
||||
user2@domain.com| Global Administrator | Hybrid | AAD_PREMIUM, AAD_PREMIUM_P2
|
||||
FailureReason: Non-Compliant Accounts: 2
|
||||
.EXAMPLE
|
||||
PS> Invoke-M365SecurityAudit -TenantAdminUrl "https://contoso-admin.sharepoint.com" -DomainName "contoso.com" -SkipRecommendation '1.1.3', '2.1.1'
|
||||
Performs an audit while excluding specific recommendations 1.1.3 and 2.1.1.
|
||||
Output:
|
||||
|
||||
Status : Fail
|
||||
ELevel : E3
|
||||
ProfileLevel: L1
|
||||
Connection : Microsoft Graph
|
||||
Rec : 1.1.1
|
||||
Result : False
|
||||
Details : Non-compliant accounts:
|
||||
Username | Roles | HybridStatus | Missing Licence
|
||||
user1@domain.com| Global Administrator | Cloud-Only | AAD_PREMIUM
|
||||
user2@domain.com| Global Administrator | Hybrid | AAD_PREMIUM, AAD_PREMIUM_P2
|
||||
FailureReason: Non-Compliant Accounts: 2
|
||||
Performs an audit while excluding specific recommendations 1.1.3 and 2.1.1.
|
||||
Output:
|
||||
|
||||
Status : Fail
|
||||
ELevel : E3
|
||||
ProfileLevel: L1
|
||||
Connection : Microsoft Graph
|
||||
Rec : 1.1.1
|
||||
Result : False
|
||||
Details : Non-compliant accounts:
|
||||
Username | Roles | HybridStatus | Missing Licence
|
||||
user1@domain.com| Global Administrator | Cloud-Only | AAD_PREMIUM
|
||||
user2@domain.com| Global Administrator | Hybrid | AAD_PREMIUM, AAD_PREMIUM_P2
|
||||
FailureReason: Non-Compliant Accounts: 2
|
||||
.EXAMPLE
|
||||
PS> $auditResults = Invoke-M365SecurityAudit -TenantAdminUrl "https://contoso-admin.sharepoint.com" -DomainName "contoso.com"
|
||||
PS> $auditResults | Export-Csv -Path "auditResults.csv" -NoTypeInformation
|
||||
|
||||
Captures the audit results into a variable and exports them to a CSV file.
|
||||
Output:
|
||||
CISAuditResult[]
|
||||
auditResults.csv
|
||||
Captures the audit results into a variable and exports them to a CSV file.
|
||||
Output:
|
||||
CISAuditResult[]
|
||||
auditResults.csv
|
||||
.EXAMPLE
|
||||
PS> Invoke-M365SecurityAudit -WhatIf
|
||||
|
||||
Displays what would happen if the cmdlet is run without actually performing the audit.
|
||||
Output:
|
||||
Displays what would happen if the cmdlet is run without actually performing the audit.
|
||||
Output:
|
||||
|
||||
What if: Performing the operation "Invoke-M365SecurityAudit" on target "Microsoft 365 environment".
|
||||
What if: Performing the operation "Invoke-M365SecurityAudit" on target "Microsoft 365 environment".
|
||||
.INPUTS
|
||||
None. You cannot pipe objects to Invoke-M365SecurityAudit.
|
||||
.OUTPUTS
|
||||
CISAuditResult[]
|
||||
The cmdlet returns an array of CISAuditResult objects representing the results of the security audit.
|
||||
The cmdlet returns an array of CISAuditResult objects representing the results of the security audit.
|
||||
.NOTES
|
||||
- This module is based on CIS benchmarks.
|
||||
- Governed by the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
|
||||
|
@@ -9,7 +9,7 @@
|
||||
The name of the worksheet within the Excel file to be processed.
|
||||
.EXAMPLE
|
||||
PS C:\> Remove-RowsWithEmptyCSVStatus -FilePath "C:\Reports\Report.xlsx" -WorksheetName "Sheet1"
|
||||
This command imports data from the "Sheet1" worksheet in the "Report.xlsx" file, removes rows where the 'CSV_Status' column is empty, and saves the filtered data to a new file named "Report-Filtered.xlsx" in the same directory.
|
||||
This command imports data from the "Sheet1" worksheet in the "Report.xlsx" file, removes rows where the 'CSV_Status' column is empty, and saves the filtered data to a new file named "Report-Filtered.xlsx" in the same directory.
|
||||
.NOTES
|
||||
This function requires the ImportExcel module to be installed.
|
||||
#>
|
||||
@@ -22,28 +22,21 @@ function Remove-RowsWithEmptyCSVStatus {
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$WorksheetName
|
||||
)
|
||||
|
||||
# Import the Excel file
|
||||
$ExcelData = Import-Excel -Path $FilePath -WorksheetName $WorksheetName
|
||||
|
||||
# Check if CSV_Status column exists
|
||||
if (-not $ExcelData.PSObject.Properties.Match("CSV_Status")) {
|
||||
throw "CSV_Status column not found in the worksheet."
|
||||
}
|
||||
|
||||
# Filter rows where CSV_Status is not empty
|
||||
$FilteredData = $ExcelData | Where-Object { $null -ne $_.CSV_Status -and $_.CSV_Status -ne '' }
|
||||
|
||||
# Get the original file name and directory
|
||||
$OriginalFileName = [System.IO.Path]::GetFileNameWithoutExtension($FilePath)
|
||||
$Directory = [System.IO.Path]::GetDirectoryName($FilePath)
|
||||
|
||||
# Create a new file name for the filtered data
|
||||
$NewFileName = "$OriginalFileName-Filtered.xlsx"
|
||||
$NewFilePath = Join-Path -Path $Directory -ChildPath $NewFileName
|
||||
|
||||
# Export the filtered data to a new Excel file
|
||||
$FilteredData | Export-Excel -Path $NewFilePath -WorksheetName $WorksheetName -Show
|
||||
|
||||
Write-Output "Filtered Excel file created at $NewFilePath"
|
||||
}
|
@@ -1,27 +1,27 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Synchronizes and updates data in an Excel worksheet with new information from a CSV file, including audit dates.
|
||||
Synchronizes and updates data in an Excel worksheet with new information from a CSV file, including audit dates.
|
||||
.DESCRIPTION
|
||||
The Sync-CISExcelAndCsvData function merges and updates data in a specified Excel worksheet from a CSV file. This includes adding or updating fields for connection status, details, failure reasons, and the date of the update. It's designed to ensure that the Excel document maintains a running log of changes over time, ideal for tracking remediation status and audit history.
|
||||
The Sync-CISExcelAndCsvData function merges and updates data in a specified Excel worksheet from a CSV file. This includes adding or updating fields for connection status, details, failure reasons, and the date of the update. It's designed to ensure that the Excel document maintains a running log of changes over time, ideal for tracking remediation status and audit history.
|
||||
.PARAMETER ExcelPath
|
||||
Specifies the path to the Excel file to be updated. This parameter is mandatory.
|
||||
Specifies the path to the Excel file to be updated. This parameter is mandatory.
|
||||
.PARAMETER CsvPath
|
||||
Specifies the path to the CSV file containing new data. This parameter is mandatory.
|
||||
Specifies the path to the CSV file containing new data. This parameter is mandatory.
|
||||
.PARAMETER SheetName
|
||||
Specifies the name of the worksheet in the Excel file where data will be merged and updated. This parameter is mandatory.
|
||||
Specifies the name of the worksheet in the Excel file where data will be merged and updated. This parameter is mandatory.
|
||||
.EXAMPLE
|
||||
PS> Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -CsvPath "path\to\data.csv" -SheetName "AuditData"
|
||||
Updates the 'AuditData' worksheet in 'excel.xlsx' with data from 'data.csv', adding new information and the date of the update.
|
||||
PS> Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -CsvPath "path\to\data.csv" -SheetName "AuditData"
|
||||
Updates the 'AuditData' worksheet in 'excel.xlsx' with data from 'data.csv', adding new information and the date of the update.
|
||||
.INPUTS
|
||||
System.String
|
||||
The function accepts strings for file paths and worksheet names.
|
||||
System.String
|
||||
The function accepts strings for file paths and worksheet names.
|
||||
.OUTPUTS
|
||||
None
|
||||
The function directly updates the Excel file and does not output any objects.
|
||||
.NOTES
|
||||
- Ensure that the 'ImportExcel' module is installed and up to date to handle Excel file manipulations.
|
||||
- It is recommended to back up the Excel file before running this function to avoid accidental data loss.
|
||||
- The CSV file should have columns that match expected headers like 'Connection', 'Details', 'FailureReason', and 'Status' for correct data mapping.
|
||||
- Ensure that the 'ImportExcel' module is installed and up to date to handle Excel file manipulations.
|
||||
- It is recommended to back up the Excel file before running this function to avoid accidental data loss.
|
||||
- The CSV file should have columns that match expected headers like 'Connection', 'Details', 'FailureReason', and 'Status' for correct data mapping.
|
||||
.LINK
|
||||
https://criticalsolutionsnetwork.github.io/M365FoundationsCISReport/#Sync-CISExcelAndCsvData
|
||||
#>
|
||||
|
Reference in New Issue
Block a user