Exports M365 security audit results to a CSV file or outputs a specific test result as an object.
This function exports M365 security audit results from either an array of CISAuditResult objects or a CSV file.
It can export all results to a specified path or output a specific test result as an object.
Export-M365SecurityAuditTable [-AuditResults] <CISAuditResult[]> [-OutputTestNumber] <String> [<CommonParameters>] Export-M365SecurityAuditTable [-AuditResults] <CISAuditResult[]> [-ExportAllTests] -ExportPath <String> [-ExportOriginalTests] [<CommonParameters>] Export-M365SecurityAuditTable [-CsvPath] <String> [-OutputTestNumber] <String> [<CommonParameters>] Export-M365SecurityAuditTable [-CsvPath] <String> [-ExportAllTests] -ExportPath <String> [-ExportOriginalTests] [<CommonParameters>]
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
An array of CISAuditResult objects containing the audit results. | true | false | |||
The path to a CSV file containing the audit results. | true | false | |||
The test number to output as an object. Valid values are "1.1.1", "1.3.1", "6.1.2", "6.1.3", "7.3.4". | true | false | |||
Switch to export all test results. | true | false | False | ||
The path where the CSV files will be exported. | true | false | |||
Switch to export the original audit results to a CSV file. | false | false | False |
The input type is the type of the objects that you can pipe to the cmdlet.
The output type is the type of the objects that the cmdlet emits.
# Output object for a single test number from audit results
# Export all results from audit results to the specified path
# Output object for a single test number from CSV
# Export all results from CSV to the specified path
# Export all results from audit results to the specified path along with the original tests
# Export all results from CSV to the specified path along with the original tests
Retrieves user licenses and roles for administrative accounts from Microsoft 365 via the Graph API.
The Get-AdminRoleUserLicense function connects to Microsoft Graph and retrieves all users who are assigned administrative roles along with their user details and licenses. This function is useful for auditing and compliance
checks to ensure that administrators have appropriate licenses and role assignments.
Get-AdminRoleUserLicense [-SkipGraphConnection] [<CommonParameters>]
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
A switch parameter that, when set, skips the connection to Microsoft Graph if already established. This is useful for batch processing or when used within scripts where multiple calls are made and the connection is managed externally. |
false | false | False |
The input type is the type of the objects that you can pipe to the cmdlet.
The output type is the type of the objects that the cmdlet emits.
Get-AdminRoleUserLicense
Get-AdminRoleUserLicense -SkipGraphConnection
Retrieves the MFA (Multi-Factor Authentication) status for Azure Active Directory users.
The Get-MFAStatus function connects to Microsoft Online Service and retrieves the MFA status for all Azure Active Directory users, excluding guest accounts. Optionally, you can specify a single user by their User Principal
Name (UPN) to get their MFA status.
Get-MFAStatus [[-UserId] <String>] [<CommonParameters>]
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
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. | false | false |
The output type is the type of the objects that the cmdlet emits.
Get-MFAStatus
Get-MFAStatus -UserId "example@domain.com"
Invokes a security audit for Microsoft 365 environments.
The Invoke-M365SecurityAudit cmdlet performs a comprehensive security audit based on the specified parameters. It allows auditing of various configurations and settings within a Microsoft 365 environment, such as compliance
with CIS benchmarks.
Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>] Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -ELevel <String> -ProfileLevel <String> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>] Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG1 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>] Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG2 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>] Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG3 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>] Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeRecommendation <String[]> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>] Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -SkipRecommendation <String[]> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>]
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
The URL of the tenant admin. If not specified, none of the SharePoint Online tests will run. | false | false | |||
The domain name of the Microsoft 365 environment to test. This parameter is not mandatory and by default it will pass/fail all found domains as a group if a specific domain is not specified. | false | false | |||
Specifies the E-Level (E3 or E5) for the audit. This parameter is optional and can be combined with the ProfileLevel parameter. | true | false | |||
Specifies the profile level (L1 or L2) for the audit. This parameter is optional and can be combined with the ELevel parameter. | true | false | |||
If specified, includes tests where IG1 is true. | true | false | False | ||
If specified, includes tests where IG2 is true. | true | false | False | ||
If specified, includes tests where IG3 is true. | true | false | False | ||
Specifies specific recommendations to include in the audit. Accepts an array of recommendation numbers. | true | false | |||
Specifies specific recommendations to exclude from the audit. Accepts an array of recommendation numbers. | true | false | |||
If specified, the cmdlet will not establish a connection to Microsoft 365 services. | false | false | False | ||
If specified, the cmdlet will not disconnect from Microsoft 365 services after execution. | false | false | False | ||
If specified, the cmdlet will not check for the presence of required modules. | false | false | False | ||
wi | false | false | |||
cf | false | false |
The input type is the type of the objects that you can pipe to the cmdlet.
The output type is the type of the objects that the cmdlet emits.
Invoke-M365SecurityAudit
Invoke-M365SecurityAudit -TenantAdminUrl "https://contoso-admin.sharepoint.com" -M365DomainForPWPolicyTest "contoso.com" -ELevel "E5" -ProfileLevel "L1"
Invoke-M365SecurityAudit -TenantAdminUrl "https://contoso-admin.sharepoint.com" -M365DomainForPWPolicyTest "contoso.com" -IncludeIG1
Invoke-M365SecurityAudit -TenantAdminUrl "https://contoso-admin.sharepoint.com" -M365DomainForPWPolicyTest "contoso.com" -SkipRecommendation '1.1.3', '2.1.1'
$auditResults = Invoke-M365SecurityAudit -TenantAdminUrl "https://contoso-admin.sharepoint.com" -M365DomainForPWPolicyTest "contoso.com"
Invoke-M365SecurityAudit -WhatIf
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
None | true | false | |||
None | true | false |
Synchronizes data between an Excel file and either a CSV file or an output object from Invoke-M365SecurityAudit, and optionally updates the Excel worksheet.
The Sync-CISExcelAndCsvData function merges data from a specified Excel file with data from either a CSV file or an output object from Invoke-M365SecurityAudit based on a common key. It can also update the Excel worksheet
with the merged data. This function is particularly useful for updating Excel records with additional data from a CSV file or audit results while preserving the original formatting and structure of the Excel worksheet.
Sync-CISExcelAndCsvData -ExcelPath <String> -WorksheetName <String> -CsvPath <String> [-SkipUpdate] [<CommonParameters>] Sync-CISExcelAndCsvData -ExcelPath <String> -WorksheetName <String> -AuditResults <CISAuditResult[]> [-SkipUpdate] [<CommonParameters>]
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
The path to the Excel file that contains the original data. This parameter is mandatory. | true | false | |||
The name of the worksheet within the Excel file that contains the data to be synchronized. This parameter is mandatory. | true | false | |||
The path to the CSV file containing data to be merged with the Excel data. This parameter is mandatory when using the CsvInput parameter set. | true | false | |||
An array of CISAuditResult objects from Invoke-M365SecurityAudit to be merged with the Excel data. This parameter is mandatory when using the ObjectInput parameter set. It can also accept pipeline input. | true | true (ByValue) | |||
If specified, the function will return the merged data object without updating the Excel worksheet. This is useful for previewing the merged data. | false | false | False |
The input type is the type of the objects that you can pipe to the cmdlet.
The output type is the type of the objects that the cmdlet emits.
Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -WorksheetName "DataSheet" -CsvPath "path\to\data.csv"
$mergedData = Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -WorksheetName "DataSheet" -CsvPath "path\to\data.csv" -SkipUpdate
$auditResults = Invoke-M365SecurityAudit -TenantAdminUrl "https://tenant-admin.url" -DomainName "example.com"
$auditResults = Invoke-M365SecurityAudit -TenantAdminUrl "https://tenant-admin.url" -DomainName "example.com"
Invoke-M365SecurityAudit -TenantAdminUrl "https://tenant-admin.url" -DomainName "example.com" | Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -WorksheetName "DataSheet"