fix: Manual rebase export

This commit is contained in:
DrIOS
2024-07-02 10:00:26 -05:00
7 changed files with 25 additions and 7 deletions

View File

@@ -4,6 +4,12 @@ The format is based on and uses the types of changes according to [Keep a Change
## [Unreleased] ## [Unreleased]
### Added
- Added hash and compress steps to `Export-M365SecurityAuditTable` function.
## [0.1.21] - 2024-07-01
### Fixed ### Fixed
- SPO tests formatting and output. - SPO tests formatting and output.

BIN
README.md

Binary file not shown.

Binary file not shown.

View File

@@ -190,10 +190,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## INPUTS ## INPUTS
### [CISAuditResult[]], [string] ### [CISAuditResult[]] - An array of CISAuditResult objects.
### [string] - A path to a CSV file.
## OUTPUTS ## OUTPUTS
### [PSCustomObject] ### [PSCustomObject] - A custom object containing the path to the zip file and its hash.
## NOTES ## NOTES
## RELATED LINKS ## RELATED LINKS

View File

@@ -4,7 +4,7 @@ Import-Module .\output\module\M365FoundationsCISReport\*\*.psd1
<# <#
$ver = "v0.1.18" $ver = "v0.1.22"
git checkout main git checkout main
git pull origin main git pull origin main
git tag -a $ver -m "Release version $ver refactor Update" git tag -a $ver -m "Release version $ver refactor Update"
@@ -59,6 +59,5 @@ Set-Secret -Name "GitHubToken" -Vault ModuleBuildCreds
$GalleryApiToken = Get-Secret -Name "GalleryApiToken" -Vault ModuleBuildCreds -AsPlainText $GalleryApiToken = Get-Secret -Name "GalleryApiToken" -Vault ModuleBuildCreds -AsPlainText
$GitHubToken = Get-Secret -Name "GitHubToken" -Vault ModuleBuildCreds -AsPlainText $GitHubToken = Get-Secret -Name "GitHubToken" -Vault ModuleBuildCreds -AsPlainText
$GalleryApiToken $GalleryApiToken
$GitHubToken $GitHubToken

View File

@@ -221,17 +221,21 @@ function Export-M365SecurityAuditTable {
} }
$fileHashes | Set-Content -Path $hashFilePath $fileHashes | Set-Content -Path $hashFilePath
$createdFiles += $hashFilePath # Add the hash file to the array $createdFiles += $hashFilePath # Add the hash file to the array
# Create a zip file and add all the created files # Create a zip file and add all the created files
$zipFilePath = "$ExportPath\$timestamp`_M365FoundationsAudit.zip" $zipFilePath = "$ExportPath\$timestamp`_M365FoundationsAudit.zip"
Compress-Archive -Path $createdFiles -DestinationPath $zipFilePath Compress-Archive -Path $createdFiles -DestinationPath $zipFilePath
# Remove the original files after they have been added to the zip # Remove the original files after they have been added to the zip
foreach ($file in $createdFiles) { foreach ($file in $createdFiles) {
Remove-Item -Path $file -Force Remove-Item -Path $file -Force
} }
# Compute the hash for the zip file and rename it # Compute the hash for the zip file and rename it
$zipHash = Get-FileHash -Path $zipFilePath -Algorithm SHA256 $zipHash = Get-FileHash -Path $zipFilePath -Algorithm SHA256
$newZipFilePath = "$ExportPath\$timestamp`_M365FoundationsAudit_$($zipHash.Hash.Substring(0, 8)).zip" $newZipFilePath = "$ExportPath\$timestamp`_M365FoundationsAudit_$($zipHash.Hash.Substring(0, 8)).zip"
Rename-Item -Path $zipFilePath -NewName $newZipFilePath Rename-Item -Path $zipFilePath -NewName $newZipFilePath
# Output the zip file path with hash # Output the zip file path with hash
[PSCustomObject]@{ [PSCustomObject]@{
ZipFilePath = $newZipFilePath ZipFilePath = $newZipFilePath

View File

@@ -277,7 +277,15 @@
<command:inputTypes> <command:inputTypes>
<command:inputType> <command:inputType>
<dev:type> <dev:type>
<maml:name>[CISAuditResult[]], [string]</maml:name> <maml:name>[CISAuditResult[]] - An array of CISAuditResult objects.</maml:name>
</dev:type>
<maml:description>
<maml:para></maml:para>
</maml:description>
</command:inputType>
<command:inputType>
<dev:type>
<maml:name>[string] - A path to a CSV file.</maml:name>
</dev:type> </dev:type>
<maml:description> <maml:description>
<maml:para></maml:para> <maml:para></maml:para>
@@ -287,7 +295,7 @@
<command:returnValues> <command:returnValues>
<command:returnValue> <command:returnValue>
<dev:type> <dev:type>
<maml:name>[PSCustomObject]</maml:name> <maml:name>[PSCustomObject] - A custom object containing the path to the zip file and its hash.</maml:name>
</dev:type> </dev:type>
<maml:description> <maml:description>
<maml:para></maml:para> <maml:para></maml:para>