From bf72ac0d94f0acd3a20406f86c0c997329606247 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Wed, 12 Feb 2025 23:49:08 -0500 Subject: [PATCH 01/12] fix mapping bug --- Modules/CippExtensions/Public/Halo/Get-HaloMapping.ps1 | 2 +- Modules/CippExtensions/Public/Hudu/Get-HuduMapping.ps1 | 2 +- .../CippExtensions/Public/NinjaOne/Get-NinjaOneOrgMapping.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/CippExtensions/Public/Halo/Get-HaloMapping.ps1 b/Modules/CippExtensions/Public/Halo/Get-HaloMapping.ps1 index 787159880e16..8f1b6d982f74 100644 --- a/Modules/CippExtensions/Public/Halo/Get-HaloMapping.ps1 +++ b/Modules/CippExtensions/Public/Halo/Get-HaloMapping.ps1 @@ -67,7 +67,7 @@ function Get-HaloMapping { } $MappingObj = [PSCustomObject]@{ Companies = @($HaloClients) - Mappings = $Mappings + Mappings = @($Mappings) } return $MappingObj diff --git a/Modules/CippExtensions/Public/Hudu/Get-HuduMapping.ps1 b/Modules/CippExtensions/Public/Hudu/Get-HuduMapping.ps1 index a56b84d2a06d..eed30b1d4147 100644 --- a/Modules/CippExtensions/Public/Hudu/Get-HuduMapping.ps1 +++ b/Modules/CippExtensions/Public/Hudu/Get-HuduMapping.ps1 @@ -46,7 +46,7 @@ function Get-HuduMapping { } $MappingObj = [PSCustomObject]@{ Companies = @($HuduCompanies) - Mappings = $Mappings + Mappings = @($Mappings) } return $MappingObj diff --git a/Modules/CippExtensions/Public/NinjaOne/Get-NinjaOneOrgMapping.ps1 b/Modules/CippExtensions/Public/NinjaOne/Get-NinjaOneOrgMapping.ps1 index 7bdba1ebef18..f6e789ee081a 100644 --- a/Modules/CippExtensions/Public/NinjaOne/Get-NinjaOneOrgMapping.ps1 +++ b/Modules/CippExtensions/Public/NinjaOne/Get-NinjaOneOrgMapping.ps1 @@ -53,7 +53,7 @@ function Get-NinjaOneOrgMapping { $MappingObj = [PSCustomObject]@{ Companies = @($NinjaOrgs | Sort-Object name) - Mappings = $Mappings + Mappings = @($Mappings) } return $MappingObj From e384ead5d4d9e3de884d3fc16a0d440873c99837 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Thu, 13 Feb 2025 00:01:43 -0500 Subject: [PATCH 02/12] fix missing headers --- Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 b/Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 index 382869c4f52a..32e907e15669 100644 --- a/Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 +++ b/Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 @@ -4,7 +4,8 @@ function Set-CIPPUserLicense { [Parameter(Mandatory)][string]$UserId, [Parameter(Mandatory)][string]$TenantFilter, [Parameter()][array]$AddLicenses = @(), - [Parameter()][array]$RemoveLicenses = @() + [Parameter()][array]$RemoveLicenses = @(), + $Headers ) # Build the addLicenses array @@ -30,10 +31,10 @@ function Set-CIPPUserLicense { $null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$UserId/assignLicense" -tenantid $TenantFilter -type POST -body $LicenseBodyJson -Verbose } catch { $ErrorMessage = Get-CippException -Exception $_ - Write-LogMessage -Headers $Request.Headers -API $APIName -tenant $TenantFilter -message "Failed to assign the license. Error: $($ErrorMessage.NormalizedError)" -Sev Error -LogData $ErrorMessage + Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message "Failed to assign the license. Error: $($ErrorMessage.NormalizedError)" -Sev Error -LogData $ErrorMessage throw "Failed to assign the license. $($ErrorMessage.NormalizedError)" } - Write-LogMessage -Headers $Request.Headers -API $APIName -tenant $TenantFilter -message "Assigned licenses to user $UserId. Added: $AddLicenses; Removed: $RemoveLicenses" -Sev 'Info' + Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message "Assigned licenses to user $UserId. Added: $AddLicenses; Removed: $RemoveLicenses" -Sev 'Info' return 'Set licenses successfully' } From 038e932d9d5c0be474b1f72e5c584b54177d5a2f Mon Sep 17 00:00:00 2001 From: John Duprey Date: Thu, 13 Feb 2025 00:12:48 -0500 Subject: [PATCH 03/12] Update Invoke-ExecGitHubAction.ps1 --- .../HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 index 16e4ec6202b1..9d0169bcbf9d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 @@ -26,7 +26,7 @@ function Invoke-ExecGitHubAction { $Configuration = ((Get-CIPPAzDataTableEntity @Table).config | ConvertFrom-Json).GitHub if (!$Configuration.Enabled) { - $Response = Invoke-RestMethod -Uri 'https://cippy.azurewebsites.net/api/ExecGitHubAction' -Method POST -Body ($Action | ConvertTo-Json -Depth 10) -ContentType 'application/json' + $Response = Invoke-RestMethod -Uri 'https://cippy.azurewebsites.net/api/ExecGitHubAction' -Method POST -Body ($Parameters | ConvertTo-Json -Depth 10) -ContentType 'application/json' $Results = $Response.Results $Metadata = $Response.Metadata } else { From 99d782ae2bd6cc7eab4fa7fcd948ab75df7e3bfd Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:08:46 +0100 Subject: [PATCH 04/12] fixes full params --- .../HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 index 16e4ec6202b1..20f540ec1382 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1 @@ -26,7 +26,9 @@ function Invoke-ExecGitHubAction { $Configuration = ((Get-CIPPAzDataTableEntity @Table).config | ConvertFrom-Json).GitHub if (!$Configuration.Enabled) { - $Response = Invoke-RestMethod -Uri 'https://cippy.azurewebsites.net/api/ExecGitHubAction' -Method POST -Body ($Action | ConvertTo-Json -Depth 10) -ContentType 'application/json' + Write-Host "$Action" + $FullParams = $Parameters | ConvertTo-Json | ConvertFrom-Json -AsHashtable + $Response = Invoke-RestMethod -Uri 'https://cippy.azurewebsites.net/api/ExecGitHubAction' -Method POST -Body ($FullParams | ConvertTo-Json -Depth 10) -ContentType 'application/json' $Results = $Response.Results $Metadata = $Response.Metadata } else { From 87d41f39902062bab3a18c9c4307b8a9d04d215c Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 13 Feb 2025 12:30:23 +0100 Subject: [PATCH 05/12] move parameter --- .../Standards/Invoke-CIPPStandardConditionalAccessTemplate.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardConditionalAccessTemplate.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardConditionalAccessTemplate.ps1 index be53a501e8a9..9c2e705610b7 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardConditionalAccessTemplate.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardConditionalAccessTemplate.ps1 @@ -39,7 +39,7 @@ function Invoke-CIPPStandardConditionalAccessTemplate { $Table = Get-CippTable -tablename 'templates' $Filter = "PartitionKey eq 'CATemplate' and RowKey eq '$($Setting.TemplateList.value)'" $JSONObj = (Get-CippAzDataTableEntity @Table -Filter $Filter).JSON - $null = New-CIPPCAPolicy -TenantFilter $tenant -state $Setting.state -RawJSON $JSONObj -Overwrite $true -APIName $APIName -Headers $Request.Headers -ReplacePattern 'displayName' + $null = New-CIPPCAPolicy -replacePattern 'displayName' -TenantFilter $tenant -state $Setting.state -RawJSON $JSONObj -Overwrite $true -APIName $APIName -Headers $Request.Headers } catch { $ErrorMessage = Get-NormalizedError -Message $_.Exception.Message Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to create or update conditional access rule $($JSONObj.displayName). Error: $ErrorMessage" -sev 'Error' From 25e000a64d0bfb364547e036ca6afeeab24f6abc Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:05:07 +0100 Subject: [PATCH 06/12] fixes rawjson output --- .../HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 index 26d39d4773c9..00020775fd83 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 @@ -31,7 +31,7 @@ Function Invoke-ListBPATemplates { $Templates = Get-CIPPAzDataTableEntity @Table -Filter $Filter if ($Request.Query.RawJson) { - $Templates + $Templates.JSON | ConvertFrom-Json } else { $Templates = $Templates | ForEach-Object { $Template = $_.JSON | ConvertFrom-Json From 4b8679966dc3b33af7fba2b1fb891ac209be6798 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:09:15 +0100 Subject: [PATCH 07/12] fix for templates --- .../HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 index 00020775fd83..1d24bf7e2ddd 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPATemplates.ps1 @@ -31,7 +31,7 @@ Function Invoke-ListBPATemplates { $Templates = Get-CIPPAzDataTableEntity @Table -Filter $Filter if ($Request.Query.RawJson) { - $Templates.JSON | ConvertFrom-Json + $Templates = $Templates.JSON | ConvertFrom-Json } else { $Templates = $Templates | ForEach-Object { $Template = $_.JSON | ConvertFrom-Json From 94523e7f2db61d5073848524e58c723441e3cb00 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Thu, 13 Feb 2025 12:57:37 -0500 Subject: [PATCH 08/12] more logging/output fixes --- .../CIPP/Core/Invoke-ExecEditTemplate.ps1 | 2 +- .../Endpoint/MEM/Invoke-ExecAssignPolicy.ps1 | 2 +- Modules/CIPPCore/Public/New-CIPPRestore.ps1 | 2 +- .../CIPPCore/Public/New-CIPPRestoreTask.ps1 | 18 +++++++++-------- .../CIPPCore/Public/Set-CIPPIntunePolicy.ps1 | 20 +++++++++---------- .../Public/Set-CIPPIntuneTemplate.ps1 | 5 +++-- .../Gradient/New-GradientServiceSyncRun.ps1 | 4 ++-- 7 files changed, 28 insertions(+), 25 deletions(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1 index 3299b5c922d0..2cf918816be6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1 @@ -24,7 +24,7 @@ Function Invoke-ExecEditTemplate { $OriginalTemplate = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'IntuneTemplate' and RowKey eq '$GUID'" $OriginalTemplate = ($OriginalTemplate.JSON | ConvertFrom-Json -Depth 100) $RawJSON = $OriginalTemplate.RAWJson - Set-CIPPIntuneTemplate -RawJSON $RawJSON -GUID $GUID -DisplayName $Request.body.displayName -Description $Request.body.description -templateType $OriginalTemplate.Type + Set-CIPPIntuneTemplate -RawJSON $RawJSON -GUID $GUID -DisplayName $Request.body.displayName -Description $Request.body.description -templateType $OriginalTemplate.Type -Headers $Request.Headers } else { $Table.Force = $true diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecAssignPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecAssignPolicy.ps1 index 44bd7e8a7438..6c1b711d7c4d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecAssignPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecAssignPolicy.ps1 @@ -20,7 +20,7 @@ Function Invoke-ExecAssignPolicy { $results = try { if ($AssignTo) { - $assign = Set-CIPPAssignedPolicy -PolicyId $ID -TenantFilter $tenant -GroupName $AssignTo -Type $Request.body.Type + $assign = Set-CIPPAssignedPolicy -PolicyId $ID -TenantFilter $tenant -GroupName $AssignTo -Type $Request.body.Type -Headers $Request.Headers Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($Tenant) -message "Assigned policy $($Displayname) to $AssignTo" -Sev 'Info' } "Successfully edited policy for $($Tenant)" diff --git a/Modules/CIPPCore/Public/New-CIPPRestore.ps1 b/Modules/CIPPCore/Public/New-CIPPRestore.ps1 index ec9ca53e4b12..484b6178199c 100644 --- a/Modules/CIPPCore/Public/New-CIPPRestore.ps1 +++ b/Modules/CIPPCore/Public/New-CIPPRestore.ps1 @@ -11,7 +11,7 @@ function New-CIPPRestore { Write-Host "Scheduled Restore psproperties: $(([pscustomobject]$RestoreValues).psobject.Properties)" Write-LogMessage -headers $Headers -API $APINAME -message 'Restored backup' -Sev 'Debug' $RestoreData = foreach ($ScheduledBackup in ([pscustomobject]$RestoreValues).psobject.Properties.Name | Where-Object { $_ -notin 'email', 'webhook', 'psa', 'backup', 'overwrite' }) { - New-CIPPRestoreTask -Task $ScheduledBackup -TenantFilter $TenantFilter -backup $RestoreValues.backup.value -overwrite $RestoreValues.overwrite + New-CIPPRestoreTask -Task $ScheduledBackup -TenantFilter $TenantFilter -backup $RestoreValues.backup.value -overwrite $RestoreValues.overwrite -Headers $Headers -APIName $APIName } return $RestoreData } diff --git a/Modules/CIPPCore/Public/New-CIPPRestoreTask.ps1 b/Modules/CIPPCore/Public/New-CIPPRestoreTask.ps1 index 9364749c54f2..3f4a3bc2a6cb 100644 --- a/Modules/CIPPCore/Public/New-CIPPRestoreTask.ps1 +++ b/Modules/CIPPCore/Public/New-CIPPRestoreTask.ps1 @@ -4,7 +4,9 @@ function New-CIPPRestoreTask { $Task, $TenantFilter, $backup, - $overwrite + $overwrite, + $APINAME, + $Headers ) $Table = Get-CippTable -tablename 'ScheduledBackup' $BackupData = Get-CIPPAzDataTableEntity @Table -Filter "RowKey eq '$backup'" @@ -99,7 +101,7 @@ function New-CIPPRestoreTask { $BackupConfig = $BackupData.intuneconfig | ConvertFrom-Json foreach ($backup in $backupConfig) { try { - Set-CIPPIntunePolicy -TemplateType $backup.Type -TenantFilter $TenantFilter -DisplayName $backup.DisplayName -Description $backup.Description -RawJSON ($backup.TemplateJson) -ErrorAction SilentlyContinue + Set-CIPPIntunePolicy -TemplateType $backup.Type -TenantFilter $TenantFilter -DisplayName $backup.DisplayName -Description $backup.Description -RawJSON ($backup.TemplateJson) -Headers $Headers -APINAME $APINAME -ErrorAction SilentlyContinue } catch { $ErrorMessage = Get-CippException -Exception $_ "Could not restore Intune Configuration $DisplayName : $($ErrorMessage.NormalizedError) " @@ -112,7 +114,7 @@ function New-CIPPRestoreTask { $BackupConfig = $BackupData.intunecompliance | ConvertFrom-Json foreach ($backup in $backupConfig) { try { - Set-CIPPIntunePolicy -TemplateType $backup.Type -TenantFilter $TenantFilter -DisplayName $backup.DisplayName -Description $backup.Description -RawJSON ($backup.TemplateJson) -ErrorAction SilentlyContinue + Set-CIPPIntunePolicy -TemplateType $backup.Type -TenantFilter $TenantFilter -DisplayName $backup.DisplayName -Description $backup.Description -RawJSON ($backup.TemplateJson) -Headers $Headers -APINAME $APINAME -ErrorAction SilentlyContinue } catch { $ErrorMessage = Get-CippException -Exception $_ "Could not restore Intune Compliance $DisplayName : $($ErrorMessage.NormalizedError) " @@ -126,7 +128,7 @@ function New-CIPPRestoreTask { $BackupConfig = $BackupData.intuneprotection | ConvertFrom-Json foreach ($backup in $backupConfig) { try { - Set-CIPPIntunePolicy -TemplateType $backup.Type -TenantFilter $TenantFilter -DisplayName $backup.DisplayName -Description $backup.Description -RawJSON ($backup.TemplateJson) -ErrorAction SilentlyContinue + Set-CIPPIntunePolicy -TemplateType $backup.Type -TenantFilter $TenantFilter -DisplayName $backup.DisplayName -Description $backup.Description -RawJSON ($backup.TemplateJson) -Headers $Headers -APINAME $APINAME -ErrorAction SilentlyContinue } catch { $ErrorMessage = Get-CippException -Exception $_ "Could not restore Intune Protection $DisplayName : $($ErrorMessage.NormalizedError) " @@ -281,7 +283,7 @@ function New-CIPPRestoreTask { foreach ($param in $ruleparams) { if ($rule.PSObject.Properties[$param]) { if ($param -eq 'Enabled') { - $cmdparams[$param] = if ($rule.State -eq 'Enabled') {$true} else {$false} + $cmdparams[$param] = if ($rule.State -eq 'Enabled') { $true } else { $false } } else { $cmdparams[$param] = $rule.$param } @@ -301,7 +303,7 @@ function New-CIPPRestoreTask { foreach ($param in $ruleparams) { if ($rule.PSObject.Properties[$param]) { if ($param -eq 'Enabled') { - $cmdparams[$param] = if ($rule.State -eq 'Enabled') {$true} else {$false} + $cmdparams[$param] = if ($rule.State -eq 'Enabled') { $true } else { $false } } else { $cmdparams[$param] = $rule.$param } @@ -438,7 +440,7 @@ function New-CIPPRestoreTask { foreach ($param in $ruleparams) { if ($rule.PSObject.Properties[$param]) { if ($param -eq 'Enabled') { - $cmdparams[$param] = if ($rule.State -eq 'Enabled') {$true} else {$false} + $cmdparams[$param] = if ($rule.State -eq 'Enabled') { $true } else { $false } } else { $cmdparams[$param] = $rule.$param } @@ -458,7 +460,7 @@ function New-CIPPRestoreTask { foreach ($param in $ruleparams) { if ($rule.PSObject.Properties[$param]) { if ($param -eq 'Enabled') { - $cmdparams[$param] = if ($rule.State -eq 'Enabled') {$true} else {$false} + $cmdparams[$param] = if ($rule.State -eq 'Enabled') { $true } else { $false } } else { $cmdparams[$param] = $rule.$param } diff --git a/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 b/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 index 0db2439052a0..85323c33a79d 100644 --- a/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 +++ b/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 @@ -7,9 +7,10 @@ function Set-CIPPIntunePolicy { $RawJSON, $AssignTo, $Headers, + $APINAME, $tenantFilter ) - $ReturnValue = try { + try { switch ($TemplateType) { 'AppProtection' { $TemplateType = ($RawJSON | ConvertFrom-Json).'@odata.type' -replace '#microsoft.graph.', '' @@ -39,13 +40,13 @@ function Set-CIPPIntunePolicy { $PostType = 'edited' $ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON - Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info' + Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info' $CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName } else { $RawJSON = ConvertTo-Json -InputObject $JSON -Depth 20 -Compress $PostType = 'added' $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenantFilter -type POST -body $RawJSON - Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info' + Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info' } } 'Admin' { @@ -62,13 +63,13 @@ function Set-CIPPIntunePolicy { $DeleteRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL('$($ExistingID.id)')/updateDefinitionValues" -tenantid $tenantFilter -type POST -body $DeleteJson $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL('$($ExistingID.id)')/updateDefinitionValues" -tenantid $tenantFilter -type POST -body $RawJSON $CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName - Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($Displayname) to template defaults" -Sev 'info' + Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($Displayname) to template defaults" -Sev 'info' $PostType = 'edited' } else { $PostType = 'added' $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenantFilter -type POST -body $CreateBody $UpdateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL('$($CreateRequest.id)')/updateDefinitionValues" -tenantid $tenantFilter -type POST -body $RawJSON - Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($Displayname) to template defaults" -Sev 'info' + Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($Displayname) to template defaults" -Sev 'info' } } @@ -86,11 +87,11 @@ function Set-CIPPIntunePolicy { Write-Host "Raw JSON is $RawJSON" $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON $CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName - Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info' + Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info' } else { $PostType = 'added' $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenantFilter -type POST -body $RawJSON - Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info' + Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info' } } @@ -106,7 +107,7 @@ function Set-CIPPIntunePolicy { } else { $PostType = 'added' $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenantFilter -type POST -body $RawJSON - Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info' + Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info' } } 'windowsDriverUpdateProfiles' { @@ -124,7 +125,7 @@ function Set-CIPPIntunePolicy { } else { $PostType = 'added' $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenantFilter -type POST -body $RawJSON - Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info' + Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info' } } @@ -142,5 +143,4 @@ function Set-CIPPIntunePolicy { Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Failed $($PostType) policy $($Displayname). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage throw "Failed to add or set policy for $($tenantFilter) with display name $($Displayname): $($ErrorMessage.NormalizedError)" } - } diff --git a/Modules/CIPPCore/Public/Set-CIPPIntuneTemplate.ps1 b/Modules/CIPPCore/Public/Set-CIPPIntuneTemplate.ps1 index 9ff552c5a878..82e213299226 100644 --- a/Modules/CIPPCore/Public/Set-CIPPIntuneTemplate.ps1 +++ b/Modules/CIPPCore/Public/Set-CIPPIntuneTemplate.ps1 @@ -5,7 +5,8 @@ function Set-CIPPIntuneTemplate { $GUID, $DisplayName, $Description, - $templateType + $templateType, + $Headers ) Write-Host "Received $DisplayName, $Description, $RawJSON, $templateType" if (!$DisplayName) { throw 'You must enter a displayname' } @@ -26,7 +27,7 @@ function Set-CIPPIntuneTemplate { GUID = "$GUID" PartitionKey = 'IntuneTemplate' } - Write-LogMessage -Headers $Request.Headers -API $APINAME -message "Created intune policy template named $($Request.body.displayname) with GUID $GUID" -Sev 'Debug' + Write-LogMessage -Headers $Headers -API $APINAME -message "Created intune policy template named $($Request.body.displayname) with GUID $GUID" -Sev 'Debug' return 'Successfully added template' } diff --git a/Modules/CippExtensions/Public/Gradient/New-GradientServiceSyncRun.ps1 b/Modules/CippExtensions/Public/Gradient/New-GradientServiceSyncRun.ps1 index e60feeaac807..cb85b1b60c74 100644 --- a/Modules/CippExtensions/Public/Gradient/New-GradientServiceSyncRun.ps1 +++ b/Modules/CippExtensions/Public/Gradient/New-GradientServiceSyncRun.ps1 @@ -23,7 +23,7 @@ function New-GradientServiceSyncRun { $ActivateRequest = Invoke-RestMethod -Uri 'https://app.usegradient.com/api/vendor-api/organization/status/active' -Method PATCH -Headers $GradientToken } } catch { - Write-LogMessage -Headers $Request.Headers -API $APINAME -message "Failed to create tenants in Gradient API. Error: $($_.Exception.Message)" -Sev 'Error' -tenant 'GradientAPI' + Write-LogMessage -API $APINAME -message "Failed to create tenants in Gradient API. Error: $($_.Exception.Message)" -Sev 'Error' -tenant 'GradientAPI' } @@ -83,7 +83,7 @@ function New-GradientServiceSyncRun { } | ConvertTo-Json -Depth 10 $Results = Invoke-RestMethod -Uri "https://app.usegradient.com/api/vendor-api/service/$($ExistingService.id)/count" -Method POST -Headers $GradientToken -Body $ServiceBody -ContentType 'application/json' } catch { - Write-LogMessage -Headers $Request.Headers -API $APINAME -message "Failed to create license in Gradient API. Error: $($_). $results" -Sev 'Error' -tenant $singlereq.tenant + Write-LogMessage -API $APINAME -message "Failed to create license in Gradient API. Error: $($_). $results" -Sev 'Error' -tenant $singlereq.tenant } } From 111d551779497df0d4aef6f674820c8f4d18430a Mon Sep 17 00:00:00 2001 From: John Duprey Date: Thu, 13 Feb 2025 13:54:39 -0500 Subject: [PATCH 09/12] fix duplicate sync issues --- .../Public/Hudu/Invoke-HuduExtensionSync.ps1 | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 b/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 index f30721b8d303..53b4f641ec1b 100644 --- a/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 +++ b/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 @@ -393,7 +393,7 @@ function Invoke-HuduExtensionSync { $CompanyResult.Logs.Add('Starting User Processing') $OutputUsers = foreach ($user in $licensedUsers) { try { - + $HuduUser = $null $UserGroups = foreach ($Group in $Groups) { if ($User.id -in $Group.Members.id) { $FoundGroup = $AllGroups | Where-Object { $_.id -eq $Group.id } @@ -685,13 +685,13 @@ function Invoke-HuduExtensionSync { } elseif ($HuduUserCount -eq 0) { if ($CreateUsers -eq $True) { $CompanyResult.Logs.Add("Creating $($User.displayName) in Hudu") - $HuduUser = (New-HuduAsset -Name $User.displayName -company_id $company_id -asset_layout_id $PeopleLayout.id -Fields $UserAssetFields).asset - if (!$HuduUser) { + $CreateHuduUser = (New-HuduAsset -Name $User.displayName -company_id $company_id -asset_layout_id $PeopleLayout.id -Fields $UserAssetFields).asset + if (!$CreateHuduUser) { $CompanyResult.Errors.add("User $($User.userPrincipalName): Unable to create user in Hudu. Check the User asset fields for 'Email Address'") } else { $AssetCache = [PSCustomObject]@{ PartitionKey = 'HuduUser' - RowKey = [string]$HuduUser.id + RowKey = [string]$CreateHuduUser.id CompanyId = [string]$company_id Hash = [string]$NewHash } @@ -851,13 +851,13 @@ function Invoke-HuduExtensionSync { } Add-CIPPAzDataTableEntity @HuduAssetCache -Entity $AssetCache -Force - $HuduUser = $People | Where-Object { $_.primary_mail -eq $Device.userPrincipalName -or ($_.cards.integrator_name -eq 'cw_manage' -and $_.cards.data.communicationItems.communicationType -eq 'Email' -and $_.cards.data.communicationItems.value -eq $Device.userPrincipalName) } + $RelHuduUser = $People | Where-Object { $_.primary_mail -eq $Device.userPrincipalName -or ($_.cards.integrator_name -eq 'cw_manage' -and $_.cards.data.communicationItems.communicationType -eq 'Email' -and $_.cards.data.communicationItems.value -eq $Device.userPrincipalName) } - if ($HuduUser) { - $Relation = $HuduRelations | Where-Object { $_.fromable_type -eq 'Asset' -and $_.fromable_id -eq $HuduUser.id -and $_.toable_type -eq 'Asset' -and $_toable_id -eq $HuduDevice.id } + if ($RelHuduUser) { + $Relation = $HuduRelations | Where-Object { $_.fromable_type -eq 'Asset' -and $_.fromable_id -eq $RelHuduUser.id -and $_.toable_type -eq 'Asset' -and $_toable_id -eq $HuduDevice.id } if (-not $Relation) { try { - $null = New-HuduRelation -FromableType 'Asset' -FromableID $HuduUser.id -ToableType 'Asset' -ToableID $HuduDevice.id -ea stop + $null = New-HuduRelation -FromableType 'Asset' -FromableID $RelHuduUser.id -ToableType 'Asset' -ToableID $HuduDevice.id -ea stop } catch {} } } @@ -875,23 +875,23 @@ function Invoke-HuduExtensionSync { } if ($DeviceCreation -eq $true) { $CompanyResult.Logs.Add("Creating $($device.deviceName) in Hudu") - $HuduDevice = (New-HuduAsset -Name $device.deviceName -company_id $company_id -asset_layout_id $DeviceLayoutID -Fields $DeviceAssetFields -PrimarySerial $Device.serialNumber).asset + $CreateHuduDevice = (New-HuduAsset -Name $device.deviceName -company_id $company_id -asset_layout_id $DeviceLayoutID -Fields $DeviceAssetFields -PrimarySerial $Device.serialNumber).asset - if (!$HuduDevice) { + if (!$CreateHuduDevice) { $CompanyResult.Errors.add("Device $($device.deviceName): Failed to create device in Hudu, check your device asset fields for 'Primary Serial'.") } else { $AssetCache = [PSCustomObject]@{ PartitionKey = 'HuduDevice' - RowKey = [string]$HuduDevice.id + RowKey = [string]$CreateHuduDevice.id CompanyId = [string]$company_id Hash = [string]$NewHash } Add-CIPPAzDataTableEntity @HuduAssetCache -Entity $AssetCache -Force - $HuduUser = $People | Where-Object { $_.primary_mail -eq $Device.userPrincipalName -or ($_.cards.integrator_name -eq 'cw_manage' -and $_.cards.data.communicationItems.communicationType -eq 'Email' -and $_.cards.data.communicationItems.value -eq $Device.userPrincipalName) } - if ($HuduUser) { + $RelHuduUser = $People | Where-Object { $_.primary_mail -eq $Device.userPrincipalName -or ($_.cards.integrator_name -eq 'cw_manage' -and $_.cards.data.communicationItems.communicationType -eq 'Email' -and $_.cards.data.communicationItems.value -eq $Device.userPrincipalName) } + if ($RelHuduUser) { try { - $null = New-HuduRelation -FromableType 'Asset' -FromableID $HuduUser.id -ToableType 'Asset' -ToableID $HuduDevice.id -ea stop + $null = New-HuduRelation -FromableType 'Asset' -FromableID $RelHuduUser.id -ToableType 'Asset' -ToableID $CreateHuduDevice.id -ea stop } catch { # No need to do anything here as its will be when relations already exist. } From 41e707f3f36c242ca05b54b5c506746c7c8edaf7 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:14:27 +0100 Subject: [PATCH 10/12] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/dev_cippjta72-proc.yml | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/dev_cippjta72-proc.yml diff --git a/.github/workflows/dev_cippjta72-proc.yml b/.github/workflows/dev_cippjta72-proc.yml new file mode 100644 index 000000000000..530581163549 --- /dev/null +++ b/.github/workflows/dev_cippjta72-proc.yml @@ -0,0 +1,30 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy Powershell project to Azure Function App - cippjta72-proc + +on: + push: + branches: + - dev + workflow_dispatch: + +env: + AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root + +jobs: + deploy: + runs-on: windows-latest + + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@v4 + + - name: 'Run Azure Functions Action' + uses: Azure/functions-action@v1 + id: fa + with: + app-name: 'cippjta72-proc' + slot-name: 'Production' + package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_A53AC5C52A55459DA0A3D8F1716638CB }} \ No newline at end of file From 6674e9bd51574ce291bb23bb94f4adbec1a6c84b Mon Sep 17 00:00:00 2001 From: John Duprey Date: Thu, 13 Feb 2025 17:17:03 -0500 Subject: [PATCH 11/12] hudu sync tweak --- .../Public/Hudu/Invoke-HuduExtensionSync.ps1 | 47 ++++--------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 b/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 index 53b4f641ec1b..1ae846b59bc9 100644 --- a/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 +++ b/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 @@ -9,6 +9,7 @@ function Invoke-HuduExtensionSync { ) try { Connect-HuduAPI -configuration $Configuration + $Configuration = $Configuration.Hudu $CompanyResult = [PSCustomObject]@{ Name = $Tenant.displayName @@ -78,7 +79,7 @@ function Invoke-HuduExtensionSync { Write-Host "Hudu People - Error: $_" } - Write-Host "CreateUsers: $CreateUsers" + Write-Host "Configuration: $($Configuration | ConvertTo-Json)" try { @@ -104,8 +105,6 @@ function Invoke-HuduExtensionSync { Write-Host "Hudu Devices - Error: $_" } - Write-Host "CreateDevices: $CreateDevices" - $importDomains = $Configuration.ImportDomains $monitordomains = $Configuration.MonitorDomains @@ -161,9 +160,7 @@ function Invoke-HuduExtensionSync { $Users = $ExtensionCache.Users $licensedUsers = $Users | Where-Object { $null -ne $_.assignedLicenses.skuId } | Sort-Object userPrincipalName - $CompanyResult.users = ($licensedUsers | Measure-Object).count - $AllRoles = $ExtensionCache.AllRoles @@ -264,32 +261,6 @@ function Invoke-HuduExtensionSync { } } - #$DeviceApps = $ExtensionCache.DeviceApps - <#$DeviceApps = Get-BulkResultByID -Results $TenantResults -ID 'DeviceApps' - - [System.Collections.Generic.List[PSCustomObject]]$RequestArray = @() - foreach ($InstalledApp in $DeviceApps | Where-Object { $_.isAssigned -eq $True }) { - $RequestArray.add(@{ - id = $InstalledApp.id - method = 'GET' - url = "/deviceAppManagement/mobileApps/$($InstalledApp.id)/deviceStatuses" - }) - } - try { - $InstalledAppDetailsReturn = New-GraphBulkRequest -Headers $AuthHeaders -Requests $RequestArray -tenantid $TenantFilter - } catch { - $CompanyResult.Errors.add("Company: Unable to fetch Installed Device Details $_") - $InstalledAppDetailsReturn = $null - }#> - <# - $DeviceAppInstallDetails = foreach ($DeviceApp in $DeviceApps) { - [pscustomobject]@{ - ID = $DeviceApp.id - DisplayName = $DeviceApp.displayName - #InstalledAppDetails = $DeviceAppStatus - } - }#> - $AllGroups = $ExtensionCache.Groups $Groups = foreach ($Group in $AllGroups) { @@ -635,14 +606,14 @@ function Invoke-HuduExtensionSync { [System.Collections.Generic.List[PSCustomObject]]$CIPPLinksFormatted = @() if ($EnableCIPP) { - $CIPPLinksFormatted.add((Get-HuduLinkBlock -URL "$($CIPPURL)/identity/administration/users/view?customerId=$($Tenant.customerid)&userId=$($User.id)&tenantDomain=$($Tenant.defaultDomainName)&userEmail=$($User.userPrincipalName)" -Icon 'far fa-eye' -Title 'CIPP - View User')) - $CIPPLinksFormatted.add((Get-HuduLinkBlock -URL "$($CIPPURL)/identity/administration/users/edit?customerId=$($Tenant.customerid)&userId=$($User.id)&tenantDomain=$($Tenant.defaultDomainName)&userEmail=$($User.userPrincipalName)" -Icon 'fas fa-user-cog' -Title 'CIPP - Edit User')) - $CIPPLinksFormatted.add((Get-HuduLinkBlock -URL "$($CIPPURL)/identity/administration/ViewBec?customerId=$($Tenant.customerid)&userId=$($User.id)&tenantDomain=$($Tenant.defaultDomainName)&ID=$($User.userPrincipalName)" -Icon 'fas fa-user-secret' -Title 'CIPP - BEC Tool')) + $CIPPLinksFormatted.add((Get-HuduLinkBlock -URL "$($CIPPURL)/identity/administration/users/user?tenantFilter=$($Tenant.defaultDomainName)&userId=$($User.id)" -Icon 'far fa-eye' -Title 'CIPP - View User')) + $CIPPLinksFormatted.add((Get-HuduLinkBlock -URL "$($CIPPURL)/identity/administration/users/user/edit?tenantFilter=$($Tenant.defaultDomainName)&userId=$($User.id)" -Icon 'fas fa-user-cog' -Title 'CIPP - Edit User')) + $CIPPLinksFormatted.add((Get-HuduLinkBlock -URL "$($CIPPURL)/identity/administration/users/user/bec?tenantFilter=$($Tenant.defaultDomainName)&userId=$($User.id))" -Icon 'fas fa-user-secret' -Title 'CIPP - BEC Tool')) } [System.Collections.Generic.List[PSCustomObject]]$UserLinksFormatted = @() - $UserLinksFormatted.add((Get-HuduLinkBlock -URL "https://aad.portal.azure.com/$($Tenant.defaultDomainName)/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Profile/userId/$($User.id)" -Icon 'fas fa-users-cog' -Title 'Entra ID')) - $UserLinksFormatted.add((Get-HuduLinkBlock -URL "https://aad.portal.azure.com/$($Tenant.defaultDomainName)/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/SignIns/userId/$($User.id)" -Icon 'fas fa-history' -Title 'Sign Ins')) + $UserLinksFormatted.add((Get-HuduLinkBlock -URL "https://entra.microsoft.com/$($Tenant.defaultDomainName)/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Profile/userId/$($User.id)" -Icon 'fas fa-users-cog' -Title 'Entra ID')) + $UserLinksFormatted.add((Get-HuduLinkBlock -URL "https://entra.microsoft.com/$($Tenant.defaultDomainName)/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/SignIns/userId/$($User.id)" -Icon 'fas fa-history' -Title 'Sign Ins')) $UserLinksFormatted.add((Get-HuduLinkBlock -URL "https://admin.teams.microsoft.com/users/$($User.id)/account?delegatedOrg=$($Tenant.defaultDomainName)" -Icon 'fas fa-users' -Title 'Teams Admin')) $UserLinksFormatted.add((Get-HuduLinkBlock -URL "https://intune.microsoft.com/$($Tenant.defaultDomainName)/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Profile/userId/$($User.ID)" -Icon 'fas fa-laptop' -Title 'Intune (User)')) $UserLinksFormatted.add((Get-HuduLinkBlock -URL "https://intune.microsoft.com/$($Tenant.defaultDomainName)/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Devices/userId/$($User.ID)" -Icon 'fas fa-laptop' -Title 'Intune (Devices)')) @@ -664,8 +635,8 @@ function Invoke-HuduExtensionSync { email_address = $user.userPrincipalName } $NewHash = Get-StringHash -String $UserBody - $HuduUserCount = ($HuduUser | Measure-Object).Count + if ($HuduUserCount -eq 1) { $ExistingAsset = Get-CIPPAzDataTableEntity @HuduAssetCache -Filter "PartitionKey eq 'HuduUser' and CompanyId eq '$company_id' and RowKey eq '$($HuduUser.id)'" $ExistingHash = $ExistingAsset.Hash @@ -683,7 +654,7 @@ function Invoke-HuduExtensionSync { } } elseif ($HuduUserCount -eq 0) { - if ($CreateUsers -eq $True) { + if ($CreateUsers -eq $true) { $CompanyResult.Logs.Add("Creating $($User.displayName) in Hudu") $CreateHuduUser = (New-HuduAsset -Name $User.displayName -company_id $company_id -asset_layout_id $PeopleLayout.id -Fields $UserAssetFields).asset if (!$CreateHuduUser) { From 01e37228c9533d6d31bb10ecd9afd2117ef9a2f8 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Thu, 13 Feb 2025 17:42:47 -0500 Subject: [PATCH 12/12] up version --- version_latest.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version_latest.txt b/version_latest.txt index b26a34e47056..77f5bec5b2b4 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -7.2.1 +7.2.2