diff --git a/BestPracticeAnalyser_All/run.ps1 b/BestPracticeAnalyser_All/run.ps1 index 71b679a9c66a..ddd92560ccda 100644 --- a/BestPracticeAnalyser_All/run.ps1 +++ b/BestPracticeAnalyser_All/run.ps1 @@ -92,6 +92,9 @@ $AddRow = foreach ($Template in $templates) { 'string' { $Result.Add($field.Name, [string]$FieldInfo) } + 'percentage' { + + } } } catch { Write-LogMessage -API 'BPA' -tenant $tenant -message "Error storing $($field.Name) for $($TenantName.displayName) with GUID $($TenantName.customerId). Error: $($_.Exception.Message)" -sev Error diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSAMSetup.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSAMSetup.ps1 index 9fca990f8f0c..1319ced9aa86 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSAMSetup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSAMSetup.ps1 @@ -8,7 +8,7 @@ Function Invoke-ExecSAMSetup { [CmdletBinding()] param($Request, $TriggerMetadata) - + $UserCreds = ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($request.headers.'x-ms-client-principal')) | ConvertFrom-Json) if ($Request.query.error) { Add-Type -AssemblyName System.Web Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBPA.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBPA.ps1 index 1933e6776f2d..eea73a9c4b9e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBPA.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBPA.ps1 @@ -1,6 +1,6 @@ - using namespace System.Net +using namespace System.Net - Function Invoke-ListBPA { +Function Invoke-ListBPA { <# .FUNCTIONALITY Entrypoint @@ -8,78 +8,76 @@ [CmdletBinding()] param($Request, $TriggerMetadata) - $APIName = $TriggerMetadata.FunctionName -# Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Accessed this API" -Sev "Debug" + $APIName = $TriggerMetadata.FunctionName + # Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Accessed this API" -Sev "Debug" -$Table = get-cipptable 'cachebpav2' -$name = $Request.query.Report -if ($name -eq $null) { $name = 'CIPP Best Practices v1.0 - Table view' } + $Table = get-cipptable 'cachebpav2' + $name = $Request.query.Report + if ($name -eq $null) { $name = 'CIPP Best Practices v1.0 - Table view' } -# Get all possible JSON files for reports, find the correct one, select the Columns -$JSONFields = @() -$Columns = $null -$CippRoot = (Get-Item $PSScriptRoot).Parent.FullName -(Get-ChildItem -Path "$CippRoot\Config\*.BPATemplate.json" -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object { - $Template = $(Get-Content $_) | ConvertFrom-Json - if ($Template.Name -eq $NAME) { - $JSONFields = $Template.Fields | Where-Object { $_.StoreAs -eq 'JSON' } | ForEach-Object { $_.name } - $Columns = $Template.fields.FrontendFields | Where-Object -Property name -NE $null - $Style = $Template.Style - } -}) + # Get all possible JSON files for reports, find the correct one, select the Columns + $JSONFields = @() + $Columns = $null +(Get-ChildItem -Path 'Config\*.BPATemplate.json' -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object { + $Template = $(Get-Content $_) | ConvertFrom-Json + if ($Template.Name -eq $NAME) { + $JSONFields = $Template.Fields | Where-Object { $_.StoreAs -eq 'JSON' } | ForEach-Object { $_.name } + $Columns = $Template.fields.FrontendFields | Where-Object -Property name -NE $null + $Style = $Template.Style + } + }) -if ($Request.query.tenantFilter -ne 'AllTenants' -and $Style -eq 'Tenant') { - $mergedObject = New-Object pscustomobject + if ($Request.query.tenantFilter -ne 'AllTenants' -and $Style -eq 'Tenant') { + $mergedObject = New-Object pscustomobject - $Data = (Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq '$($Request.query.tenantFilter)'") | ForEach-Object { - $row = $_ - $JSONFields | ForEach-Object { - $jsonContent = $row.$_ - if ($jsonContent -ne $null -and $jsonContent -ne 'FAILED') { - $row.$_ = $jsonContent | ConvertFrom-Json -Depth 15 + $Data = (Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq '$($Request.query.tenantFilter)'") | ForEach-Object { + $row = $_ + $JSONFields | ForEach-Object { + $jsonContent = $row.$_ + if ($jsonContent -ne $null -and $jsonContent -ne 'FAILED') { + $row.$_ = $jsonContent | ConvertFrom-Json -Depth 15 + } + } + $row.PSObject.Properties | ForEach-Object { + $mergedObject | Add-Member -NotePropertyName $_.Name -NotePropertyValue $_.Value -Force } } - $row.PSObject.Properties | ForEach-Object { - $mergedObject | Add-Member -NotePropertyName $_.Name -NotePropertyValue $_.Value -Force - } - } - $Data = $mergedObject -} -else { - $Tenants = Get-Tenants -IncludeErrors - $Data = (Get-CIPPAzDataTableEntity @Table -Filter "RowKey eq '$NAME'") | ForEach-Object { - $row = $_ - $JSONFields | ForEach-Object { - $jsonContent = $row.$_ - if ($jsonContent -ne $null -and $jsonContent -ne 'FAILED') { - $row.$_ = $jsonContent | ConvertFrom-Json -Depth 15 + $Data = $mergedObject + } else { + $Tenants = Get-Tenants -IncludeErrors + $Data = (Get-CIPPAzDataTableEntity @Table -Filter "RowKey eq '$NAME'") | ForEach-Object { + $row = $_ + $JSONFields | ForEach-Object { + $jsonContent = $row.$_ + if ($jsonContent -ne $null -and $jsonContent -ne 'FAILED') { + $row.$_ = $jsonContent | ConvertFrom-Json -Depth 15 + } } + $row | Where-Object -Property PartitionKey -In $Tenants.customerId } - $row | Where-Object -Property PartitionKey -In $Tenants.customerId - } -} + } -$Results = [PSCustomObject]@{ - Data = $Data - Columns = $Columns - Style = $Style -} + $Results = [PSCustomObject]@{ + Data = $Data + Columns = $Columns + Style = $Style + } -if (!$Results) { - $Results = @{ - Columns = @( value = 'Results'; name = 'Results') - Data = @(@{ Results = 'The BPA has not yet run.' }) + if (!$Results) { + $Results = @{ + Columns = @( value = 'Results'; name = 'Results') + Data = @(@{ Results = 'The BPA has not yet run.' }) + } } -} -# Associate values to output bindings by calling 'Push-OutputBinding'. -Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ - StatusCode = [HttpStatusCode]::OK - Body = ($Results | ConvertTo-Json -Depth 15) - }) + # Associate values to output bindings by calling 'Push-OutputBinding'. + Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ + StatusCode = [HttpStatusCode]::OK + Body = ($Results | ConvertTo-Json -Depth 15) + }) - } +} diff --git a/version_latest.txt b/version_latest.txt index 1163055e28e8..cfacfe40809c 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -4.7.0 \ No newline at end of file +4.7.1 \ No newline at end of file