From 37c3b89f2cd095657a93cfd06895dabe4010edc4 Mon Sep 17 00:00:00 2001 From: quoteee <45695032+JulianHayward@users.noreply.github.com> Date: Tue, 24 Jan 2023 19:01:47 +0100 Subject: [PATCH] v6_major_20230124_1 --- README.md | 9 +++------ history.md | 5 +++++ pwsh/AzGovVizParallel.ps1 | 17 +++++++++++++---- pwsh/dev/devAzGovVizParallel.ps1 | 4 ++-- pwsh/dev/functions/exportBaseCSV.ps1 | 4 +++- .../processHierarchyMapOnlyCustomData.ps1 | 8 +++++++- pwsh/dev/functions/stats.ps1 | 1 + version.txt | 2 +- 8 files changed, 35 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e31a5612..a77e4a7c 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,10 @@ Listed as [security monitoring tool](https://docs.microsoft.com/en-us/azure/arch ## Release history -__Changes__ (2023-Jan-19 / Major) +__Changes__ (2023-Jan-24 / Major) -* Cover Preview [Azure Storage Account with Azure DNS zone endpoints](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview#azure-dns-zone-endpoints-preview) ([Issue #164](https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting/issues/164)) -* Add feature to simulate Management Group Hierarchy Map - * New parameter `-HierarchyMapOnlyCustomData` (documentation update pending) -* Private Endpoint feature - add Microsoft tenants (cross tenant PE) (`-MSTenantIds`) -* Use [AzAPICall](https://aka.ms/AzAPICall) PowerShell module version 1.1.67 +* Use [AzAPICall](https://aka.ms/AzAPICall) PowerShell module version 1.1.68 + * fix issue for Private DNS Zone resource diagnostics capability check Passed tests: Powershell Core 7.3.0 on Windows Passed tests: Powershell Core 7.2.7 Azure DevOps hosted agent ubuntu-22.04 diff --git a/history.md b/history.md index b430bfa7..4ad2eb44 100644 --- a/history.md +++ b/history.md @@ -4,6 +4,11 @@ ### AzGovViz version 6 +__Changes__ (2023-Jan-24 / Major) + +* Use [AzAPICall](https://aka.ms/AzAPICall) PowerShell module version 1.1.68 + * fix issue for Private DNS Zone resource diagnostics capability check + __Changes__ (2023-Jan-19 / Major) * Cover Preview [Azure Storage Account with Azure DNS zone endpoints](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview#azure-dns-zone-endpoints-preview) ([Issue #164](https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting/issues/164)) diff --git a/pwsh/AzGovVizParallel.ps1 b/pwsh/AzGovVizParallel.ps1 index b68222d0..24fd5a13 100644 --- a/pwsh/AzGovVizParallel.ps1 +++ b/pwsh/AzGovVizParallel.ps1 @@ -359,10 +359,10 @@ Param $Product = 'AzGovViz', [string] - $AzAPICallVersion = '1.1.67', + $AzAPICallVersion = '1.1.68', [string] - $ProductVersion = 'v6_major_20230119_1', + $ProductVersion = 'v6_major_20230124_1', [string] $GithubRepository = 'aka.ms/AzGovViz', @@ -2318,7 +2318,9 @@ function exportBaseCSV { $startBuildCSV = Get-Date $outprops = $newtable[0].PSObject.Properties.Name - $outprops.Set($outprops.IndexOf('PolicyAssignmentNotScopes'), @{L = 'PolicyAssignmentNotScopes'; E = { ($_.PolicyAssignmentNotScopes -join "$CsvDelimiterOpposite ") } }) + if (-not $HierarchyMapOnly -and -not $HierarchyMapOnlyCustomDataJSON) { + $outprops.Set($outprops.IndexOf('PolicyAssignmentNotScopes'), @{L = 'PolicyAssignmentNotScopes'; E = { ($_.PolicyAssignmentNotScopes -join "$CsvDelimiterOpposite ") } }) + } if ($CsvExportUseQuotesAsNeeded) { $newTable | Sort-Object -Property level, mgId, SubscriptionId, PolicyAssignmentId, RoleAssignmentId, BlueprintId, BlueprintAssignmentId | Select-Object -Property $outprops -ExcludeProperty PolicyAssignmentParameters | Export-Csv -Path "$($outputPath)$($DirectorySeparatorChar)$($fileName).csv" -Delimiter "$csvDelimiter" -NoTypeInformation -UseQuotes AsNeeded } @@ -7268,12 +7270,18 @@ function processHierarchyMapOnlyCustomData { #validate Write-Host ' ManagementGroupId validation' if (-not $ManagementGroupId) { - Write-Host ' ManagementGroupId validation failed - please provide ManagementGroupId (parameter -ManagementGroupId)' throw 'ManagementGroupId validation failed - please provide ManagementGroupId (parameter -ManagementGroupId)' } else { + if ($hierarchyMapOnlyCustomData.$ManagementGroupId) { + Write-Host " ManagementGroupId '$ManagementGroupId' is available in 'hierarchyMapOnlyCustomData'" + } + else { + throw "ManagementGroupId validation failed - Given ManagementGroupId '$ManagementGroupId' is NOT available in 'hierarchyMapOnlyCustomData'" + } Write-Host " ManagementGroupId validation passed '$ManagementGroupId'" -ForegroundColor Green } + Write-Host ' CustomData validation' if ($hierarchyMapOnlyCustomData.Keys.Count -gt 0) { Write-Host ' Checking Keys (sanity check on first item)' @@ -27874,6 +27882,7 @@ function stats { "identifier": "$($statsIdentifier)", "platform": "$($azAPICallConf['htParameters'].CodeRunPlatform)", "productVersion": "$($ProductVersion)", + "AzAPICallVersion": "$($AzAPICallVersion)", "psAzAccountsVersion": "$($azAPICallConf['htParameters'].AzAccountsVersion)", "psVersion": "$($PSVersionTable.PSVersion)", "scopeUsage": "$($scopeUsage)", diff --git a/pwsh/dev/devAzGovVizParallel.ps1 b/pwsh/dev/devAzGovVizParallel.ps1 index c69af309..4854580d 100644 --- a/pwsh/dev/devAzGovVizParallel.ps1 +++ b/pwsh/dev/devAzGovVizParallel.ps1 @@ -359,10 +359,10 @@ Param $Product = 'AzGovViz', [string] - $AzAPICallVersion = '1.1.67', + $AzAPICallVersion = '1.1.68', [string] - $ProductVersion = 'v6_major_20230119_1', + $ProductVersion = 'v6_major_20230124_1', [string] $GithubRepository = 'aka.ms/AzGovViz', diff --git a/pwsh/dev/functions/exportBaseCSV.ps1 b/pwsh/dev/functions/exportBaseCSV.ps1 index 42a41968..c05e8bd0 100644 --- a/pwsh/dev/functions/exportBaseCSV.ps1 +++ b/pwsh/dev/functions/exportBaseCSV.ps1 @@ -3,7 +3,9 @@ function exportBaseCSV { $startBuildCSV = Get-Date $outprops = $newtable[0].PSObject.Properties.Name - $outprops.Set($outprops.IndexOf('PolicyAssignmentNotScopes'), @{L = 'PolicyAssignmentNotScopes'; E = { ($_.PolicyAssignmentNotScopes -join "$CsvDelimiterOpposite ") } }) + if (-not $HierarchyMapOnly -and -not $HierarchyMapOnlyCustomDataJSON) { + $outprops.Set($outprops.IndexOf('PolicyAssignmentNotScopes'), @{L = 'PolicyAssignmentNotScopes'; E = { ($_.PolicyAssignmentNotScopes -join "$CsvDelimiterOpposite ") } }) + } if ($CsvExportUseQuotesAsNeeded) { $newTable | Sort-Object -Property level, mgId, SubscriptionId, PolicyAssignmentId, RoleAssignmentId, BlueprintId, BlueprintAssignmentId | Select-Object -Property $outprops -ExcludeProperty PolicyAssignmentParameters | Export-Csv -Path "$($outputPath)$($DirectorySeparatorChar)$($fileName).csv" -Delimiter "$csvDelimiter" -NoTypeInformation -UseQuotes AsNeeded } diff --git a/pwsh/dev/functions/processHierarchyMapOnlyCustomData.ps1 b/pwsh/dev/functions/processHierarchyMapOnlyCustomData.ps1 index bf8d6df2..0515eca8 100644 --- a/pwsh/dev/functions/processHierarchyMapOnlyCustomData.ps1 +++ b/pwsh/dev/functions/processHierarchyMapOnlyCustomData.ps1 @@ -19,12 +19,18 @@ function processHierarchyMapOnlyCustomData { #validate Write-Host ' ManagementGroupId validation' if (-not $ManagementGroupId) { - Write-Host ' ManagementGroupId validation failed - please provide ManagementGroupId (parameter -ManagementGroupId)' throw 'ManagementGroupId validation failed - please provide ManagementGroupId (parameter -ManagementGroupId)' } else { + if ($hierarchyMapOnlyCustomData.$ManagementGroupId) { + Write-Host " ManagementGroupId '$ManagementGroupId' is available in 'hierarchyMapOnlyCustomData'" + } + else { + throw "ManagementGroupId validation failed - Given ManagementGroupId '$ManagementGroupId' is NOT available in 'hierarchyMapOnlyCustomData'" + } Write-Host " ManagementGroupId validation passed '$ManagementGroupId'" -ForegroundColor Green } + Write-Host ' CustomData validation' if ($hierarchyMapOnlyCustomData.Keys.Count -gt 0) { Write-Host ' Checking Keys (sanity check on first item)' diff --git a/pwsh/dev/functions/stats.ps1 b/pwsh/dev/functions/stats.ps1 index fcc73aad..0bd487fc 100644 --- a/pwsh/dev/functions/stats.ps1 +++ b/pwsh/dev/functions/stats.ps1 @@ -93,6 +93,7 @@ function stats { "identifier": "$($statsIdentifier)", "platform": "$($azAPICallConf['htParameters'].CodeRunPlatform)", "productVersion": "$($ProductVersion)", + "AzAPICallVersion": "$($AzAPICallVersion)", "psAzAccountsVersion": "$($azAPICallConf['htParameters'].AzAccountsVersion)", "psVersion": "$($PSVersionTable.PSVersion)", "scopeUsage": "$($scopeUsage)", diff --git a/version.txt b/version.txt index c076234c..3425cb5d 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v6_major_20230119_1 \ No newline at end of file +v6_major_20230124_1 \ No newline at end of file