Skip to content

Commit 33b082b

Browse files
authored
Merge pull request #117 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 89a7c65 + dd09ebe commit 33b082b

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ Function Invoke-ListBPATemplates {
1818
$Table = Get-CippTable -tablename 'templates'
1919

2020
$Templates = Get-ChildItem 'Config\*.BPATemplate.json' | ForEach-Object {
21+
$TemplateJson = Get-Content $_ | ConvertFrom-Json | ConvertTo-Json -Compress -Depth 10
2122
$Entity = @{
22-
JSON = "$(Get-Content $_)"
23+
JSON = "$TemplateJson"
2324
RowKey = "$($_.name)"
2425
PartitionKey = 'BPATemplate'
2526
GUID = "$($_.name)"
@@ -31,10 +32,14 @@ Function Invoke-ListBPATemplates {
3132
$Templates = Get-CIPPAzDataTableEntity @Table -Filter $Filter
3233

3334
if ($Request.Query.RawJson) {
35+
foreach ($Template in $Templates) {
36+
$Template.JSON = $Template.JSON -replace '"parameters":', '"Parameters":'
37+
}
3438
$Templates = $Templates.JSON | ConvertFrom-Json
3539
} else {
3640
$Templates = $Templates | ForEach-Object {
37-
$Template = $_.JSON | ConvertFrom-Json
41+
$TemplateJson = $_.JSON -replace '"parameters":', '"Parameters":'
42+
$Template = $TemplateJson | ConvertFrom-Json
3843
@{
3944
GUID = $_.GUID
4045
Data = $Template.fields

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-AddBPATemplate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Function Invoke-AddBPATemplate {
1818
$Table = Get-CippTable -tablename 'templates'
1919
$Table.Force = $true
2020
Add-CIPPAzDataTableEntity @Table -Entity @{
21-
JSON = "$($Request.body | ConvertTo-Json -Depth 10)"
21+
JSON = "$($Request.body | ConvertTo-Json -Depth 10 -Compress)"
2222
RowKey = $Request.body.name
2323
PartitionKey = 'BPATemplate'
2424
GUID = $Request.body.name

Modules/CIPPCore/Public/Get-CIPPLAPSPassword.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ function Get-CIPPLapsPassword {
1212
$GraphRequest = (New-GraphGetRequest -noauthcheck $true -uri "https://graph.microsoft.com/beta/directory/deviceLocalCredentials/$($device)?`$select=credentials" -tenantid $TenantFilter).credentials | Select-Object -First 1 | ForEach-Object {
1313
$PlainText = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($_.passwordBase64))
1414
$date = $_.BackupDateTime
15-
"The password for $($_.AccountName) is $($PlainText) generated at $($date)"
15+
[PSCustomObject]@{
16+
resultText = "LAPS password retrieved, generated at $($date). Copy the password by clicking the copy button"
17+
copyField = $PlainText
18+
state = 'success'
19+
}
1620
}
1721
if ($GraphRequest) { return $GraphRequest } else { return "No LAPS password found for $device" }
1822
} catch {

Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ function Get-CIPPStandards {
1717
$Table = Get-CippTable -tablename 'templates'
1818
$Filter = "PartitionKey eq 'StandardsTemplateV2'"
1919
$Templates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter | Sort-Object TimeStamp).JSON |
20-
ForEach-Object {
21-
try {
22-
# Fix old "Action" => "action"
23-
$JSON = $_ -replace '"Action":', '"action":'
24-
ConvertFrom-Json -InputObject $JSON -ErrorAction SilentlyContinue
25-
} catch {}
26-
} |
27-
Where-Object {
28-
$_.GUID -like $TemplateId -and $_.runManually -eq $runManually
29-
}
20+
ForEach-Object {
21+
try {
22+
# Fix old "Action" => "action"
23+
$JSON = $_ -replace '"Action":', '"action":' -replace '"permissionlevel":', '"permissionLevel":'
24+
ConvertFrom-Json -InputObject $JSON -ErrorAction SilentlyContinue
25+
} catch {}
26+
} |
27+
Where-Object {
28+
$_.GUID -like $TemplateId -and $_.runManually -eq $runManually
29+
}
3030

3131
# 2. Get tenant list, filter if needed
3232
$AllTenantsList = Get-Tenants

0 commit comments

Comments
 (0)