Skip to content

Commit

Permalink
v6_major_20230103_1
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianHayward committed Jan 3, 2023
1 parent f5fe9f8 commit 0ceceb5
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 19 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,12 @@ Listed as [security monitoring tool](https://docs.microsoft.com/en-us/azure/arch

## Release history

__Changes__ (2022-Dec-29 / Major)
__Changes__ (2023-Jan-03 / Major)

* Fix issue for Private Endpoints feature

__Changes__ (2022-Dec-28 / Major)

* Instead of trying to get full properties of all resource types only approach available Private Endpoint resource types
* Use [AzAPICall](https://aka.ms/AzAPICall) PowerShell module version 1.1.63
* Optimize error output for unknown convertFrom-JSON errors
* Updated [API reference](#api-reference)
* 🚀 By the way - checkout the updated 'well performing' [__Az__`Alias`__Advertizer__](https://www.azadvertizer.net/azpolicyaliasesadvertizer_singlelines.html)
* Fix: lock-in the synchrsonized hashTable `htResourcePropertiesConvertfromJSONFailed` in dataCollectionFunctions foreach parallel loop
* Subscription may not be registered for location / skip
* Use [AzAPICall](https://aka.ms/AzAPICall) PowerShell module version 1.1.64
* Add ShowMemoryUsage at creation of __DefinitionInsights__

Passed tests: Powershell Core 7.3.0 on Windows
Passed tests: Powershell Core 7.2.7 Azure DevOps hosted agent ubuntu-22.04
Expand Down
7 changes: 7 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

### AzGovViz version 6

__Changes__ (2023-Jan-03 / Major)

* Fix issue for Private Endpoints feature
* Subscription may not be registered for location / skip
* Use [AzAPICall](https://aka.ms/AzAPICall) PowerShell module version 1.1.64
* Add ShowMemoryUsage at creation of __DefinitionInsights__

__Changes__ (2022-Dec-29 / Major)

* Fix issue for Private Endpoints feature
Expand Down
22 changes: 18 additions & 4 deletions pwsh/AzGovVizParallel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ Param
$Product = 'AzGovViz',

[string]
$AzAPICallVersion = '1.1.63',
$AzAPICallVersion = '1.1.64',

[string]
$ProductVersion = 'v6_major_20221229_1',
$ProductVersion = 'v6_major_20230103_1',

[string]
$GithubRepository = 'aka.ms/AzGovViz',
Expand Down Expand Up @@ -6101,6 +6101,7 @@ function processDefinitionInsights() {
#region definitionInsightsPolicyDefinitions
$startDefinitionInsightsPolicyDefinitions = Get-Date
Write-Host ' processing DefinitionInsights Policy definitions'
ShowMemoryUsage
$tfCount = $tenantAllPoliciesCount
$htmlTableId = 'definitionInsights_Policy'
[void]$htmlDefinitionInsights.AppendLine( @"
Expand Down Expand Up @@ -6225,6 +6226,7 @@ function processDefinitionInsights() {
$cnter++
if ($cnter % 1000 -eq 0) {
Write-Host " $cnter Policy definitions processed"
ShowMemoryUsage
}

$hasAssignments = 'false'
Expand Down Expand Up @@ -6467,6 +6469,7 @@ tf.init();}}
#region definitionInsightsPolicySetDefinitions
$startDefinitionInsightsPolicySetDefinitions = Get-Date
Write-Host ' processing DefinitionInsights PolicySet definitions'
ShowMemoryUsage
$tfCount = $tenantAllPolicySetsCount
$htmlTableId = 'definitionInsights_PolicySet'
[void]$htmlDefinitionInsights.AppendLine( @"
Expand Down Expand Up @@ -6756,6 +6759,7 @@ tf.init();}}
#region definitionInsightsRoleDefinitions
$startDefinitionInsightsRoleDefinitions = Get-Date
Write-Host ' processing DefinitionInsights Role definitions'
ShowMemoryUsage
$tfCount = $tenantAllRolesCount
$htmlTableId = 'definitionInsights_Roles'
[void]$htmlDefinitionInsights.AppendLine( @"
Expand Down Expand Up @@ -7060,6 +7064,7 @@ tf.init();}}

$endDefinitionInsights = Get-Date
Write-Host " DefinitionInsights processing duration: $((New-TimeSpan -Start $startDefinitionInsights -End $endDefinitionInsights).TotalMinutes) minutes ($((New-TimeSpan -Start $startDefinitionInsights -End $endDefinitionInsights).TotalSeconds) seconds)"
ShowMemoryUsage
}
function processDiagramMermaid() {
if ($ManagementGroupId -ne $azAPICallConf['checkContext'].Tenant.Id) {
Expand Down Expand Up @@ -32947,15 +32952,24 @@ if ($azAPICallConf['htParameters'].HierarchyMapOnly -eq $false) {
#Write-Host $currentTask
$uri = "$($azAPICallConf['azAPIEndpointUrls'].ARM)/subscriptions/$($azAPICallConf['checkcontext'].Subscription.Id)/providers/Microsoft.Network/locations/$($location.name)/availablePrivateEndpointTypes?api-version=2022-07-01"
$method = 'GET'
$availablePrivateEndpointTypes = AzAPICall -AzAPICallConfiguration $azAPICallConf -uri $uri -method $method -currentTask $currentTask -skipOnErrorCode 400
$availablePrivateEndpointTypes = AzAPICall -AzAPICallConfiguration $azAPICallConf -uri $uri -method $method -currentTask $currentTask -skipOnErrorCode 400, 409
Write-Host " Returned $($availablePrivateEndpointTypes.Count) 'Available Private Endpoint Types' for location $($location.name)"
foreach ($availablePrivateEndpointType in $availablePrivateEndpointTypes) {
if (-not $htAvailablePrivateEndpointTypes.(($availablePrivateEndpointType.resourceName).ToLower())) {
$script:htAvailablePrivateEndpointTypes.(($availablePrivateEndpointType.resourceName).ToLower()) = @{}
}
}
} -ThrottleLimit $ThrottleLimit
Write-Host " Created ht for $($htAvailablePrivateEndpointTypes.Keys.Count) 'Available Private Endpoint Types'"

if ($htAvailablePrivateEndpointTypes.Keys.Count -gt 0) {
Write-Host " Created ht for $($htAvailablePrivateEndpointTypes.Keys.Count) 'Available Private Endpoint Types'"
}
else {
$throwmsg = "$($htAvailablePrivateEndpointTypes.Keys.Count) 'Available Private Endpoint Types' - Please use another Subscription for the AzContext -> use parameter: -SubscriptionId4AzContext '<subscriptionId>'"
Write-Host $throwmsg -ForegroundColor DarkRed
Throw $throwmsg
}

$endGetAvailablePrivateEndpointTypes = Get-Date
Write-Host "Getting 'Available Private Endpoint Types' duration: $((New-TimeSpan -Start $startGetAvailablePrivateEndpointTypes -End $endGetAvailablePrivateEndpointTypes).TotalMinutes) minutes ($((New-TimeSpan -Start $startGetAvailablePrivateEndpointTypes -End $endGetAvailablePrivateEndpointTypes).TotalSeconds) seconds)"
#endregion Getting Available Private Endpoint Types
Expand Down
17 changes: 13 additions & 4 deletions pwsh/dev/devAzGovVizParallel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ Param
$Product = 'AzGovViz',

[string]
$AzAPICallVersion = '1.1.63',
$AzAPICallVersion = '1.1.64',

[string]
$ProductVersion = 'v6_major_20221229_1',
$ProductVersion = 'v6_major_20230103_1',

[string]
$GithubRepository = 'aka.ms/AzGovViz',
Expand Down Expand Up @@ -1039,15 +1039,24 @@ if ($azAPICallConf['htParameters'].HierarchyMapOnly -eq $false) {
#Write-Host $currentTask
$uri = "$($azAPICallConf['azAPIEndpointUrls'].ARM)/subscriptions/$($azAPICallConf['checkcontext'].Subscription.Id)/providers/Microsoft.Network/locations/$($location.name)/availablePrivateEndpointTypes?api-version=2022-07-01"
$method = 'GET'
$availablePrivateEndpointTypes = AzAPICall -AzAPICallConfiguration $azAPICallConf -uri $uri -method $method -currentTask $currentTask -skipOnErrorCode 400
$availablePrivateEndpointTypes = AzAPICall -AzAPICallConfiguration $azAPICallConf -uri $uri -method $method -currentTask $currentTask -skipOnErrorCode 400, 409
Write-Host " Returned $($availablePrivateEndpointTypes.Count) 'Available Private Endpoint Types' for location $($location.name)"
foreach ($availablePrivateEndpointType in $availablePrivateEndpointTypes) {
if (-not $htAvailablePrivateEndpointTypes.(($availablePrivateEndpointType.resourceName).ToLower())) {
$script:htAvailablePrivateEndpointTypes.(($availablePrivateEndpointType.resourceName).ToLower()) = @{}
}
}
} -ThrottleLimit $ThrottleLimit
Write-Host " Created ht for $($htAvailablePrivateEndpointTypes.Keys.Count) 'Available Private Endpoint Types'"

if ($htAvailablePrivateEndpointTypes.Keys.Count -gt 0) {
Write-Host " Created ht for $($htAvailablePrivateEndpointTypes.Keys.Count) 'Available Private Endpoint Types'"
}
else {
$throwmsg = "$($htAvailablePrivateEndpointTypes.Keys.Count) 'Available Private Endpoint Types' - Please use another Subscription for the AzContext -> use parameter: -SubscriptionId4AzContext '<subscriptionId>'"
Write-Host $throwmsg -ForegroundColor DarkRed
Throw $throwmsg
}

$endGetAvailablePrivateEndpointTypes = Get-Date
Write-Host "Getting 'Available Private Endpoint Types' duration: $((New-TimeSpan -Start $startGetAvailablePrivateEndpointTypes -End $endGetAvailablePrivateEndpointTypes).TotalMinutes) minutes ($((New-TimeSpan -Start $startGetAvailablePrivateEndpointTypes -End $endGetAvailablePrivateEndpointTypes).TotalSeconds) seconds)"
#endregion Getting Available Private Endpoint Types
Expand Down
5 changes: 5 additions & 0 deletions pwsh/dev/functions/processDefinitionInsights.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function processDefinitionInsights() {
#region definitionInsightsPolicyDefinitions
$startDefinitionInsightsPolicyDefinitions = Get-Date
Write-Host ' processing DefinitionInsights Policy definitions'
ShowMemoryUsage
$tfCount = $tenantAllPoliciesCount
$htmlTableId = 'definitionInsights_Policy'
[void]$htmlDefinitionInsights.AppendLine( @"
Expand Down Expand Up @@ -208,6 +209,7 @@ function processDefinitionInsights() {
$cnter++
if ($cnter % 1000 -eq 0) {
Write-Host " $cnter Policy definitions processed"
ShowMemoryUsage
}

$hasAssignments = 'false'
Expand Down Expand Up @@ -450,6 +452,7 @@ tf.init();}}
#region definitionInsightsPolicySetDefinitions
$startDefinitionInsightsPolicySetDefinitions = Get-Date
Write-Host ' processing DefinitionInsights PolicySet definitions'
ShowMemoryUsage
$tfCount = $tenantAllPolicySetsCount
$htmlTableId = 'definitionInsights_PolicySet'
[void]$htmlDefinitionInsights.AppendLine( @"
Expand Down Expand Up @@ -739,6 +742,7 @@ tf.init();}}
#region definitionInsightsRoleDefinitions
$startDefinitionInsightsRoleDefinitions = Get-Date
Write-Host ' processing DefinitionInsights Role definitions'
ShowMemoryUsage
$tfCount = $tenantAllRolesCount
$htmlTableId = 'definitionInsights_Roles'
[void]$htmlDefinitionInsights.AppendLine( @"
Expand Down Expand Up @@ -1043,4 +1047,5 @@ tf.init();}}

$endDefinitionInsights = Get-Date
Write-Host " DefinitionInsights processing duration: $((New-TimeSpan -Start $startDefinitionInsights -End $endDefinitionInsights).TotalMinutes) minutes ($((New-TimeSpan -Start $startDefinitionInsights -End $endDefinitionInsights).TotalSeconds) seconds)"
ShowMemoryUsage
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v6_major_20221229_1
v6_major_20230103_1

0 comments on commit 0ceceb5

Please sign in to comment.