diff --git a/AddChocoApp/Choco.App.xml b/AddChocoApp/Choco.App.xml index fb0aac775d73..40094d0f0d7b 100644 --- a/AddChocoApp/Choco.App.xml +++ b/AddChocoApp/Choco.App.xml @@ -1,15 +1,15 @@ - Install.ps1 - 28319 + install.ps1 + 1154 IntunePackage.intunewin - Install.ps1 + install.ps1 - bmoyHXFtIws7JrnXNDV4rjzap+Be+4ZJEDJkTfbVIL8= - xNh8ZUZ6TLsAtihUEAU/NHiRfutDzz+eSgEdpaXUo9Q= - 3aQFPhO8ywEC4Ojby1lR0w== - PXX+hj3DXEpzMEMYBDXmAIlSyDIGuAwmAHIQpZIt8hU= + v8i9okyqxp8xlw3/r2QXMNnXcuGwrBkD54QQ7F/UJbc= + XjT9kWc7gQRKRdEQ/PA/lbQDDH8kFjnuPFILxAldRTI= + iyAbM3kIYqA4AlWP89S5oA== + w+2KMctRWmJzYjKcMTAKCLz15K559SgZ3pnQuQD3P/I= ProfileVersion1 - fx41h3rGZYZO3Jux7JnPgatlmpMc2ZFIZS8ipF5VDDw= + tyjBbJZ+Zj9AqD7UjEfQfe/HojN/q1+zFPidXWbiVuE= SHA256 \ No newline at end of file diff --git a/AddChocoApp/IntunePackage.intunewin b/AddChocoApp/IntunePackage.intunewin index f388884134ed..67b9f50124d0 100644 Binary files a/AddChocoApp/IntunePackage.intunewin and b/AddChocoApp/IntunePackage.intunewin differ diff --git a/AddChocoApp/IntunePackage/Install.ps1 b/AddChocoApp/IntunePackage/Install.ps1 index fd5e86dfc71e..bb16f3504e14 100644 --- a/AddChocoApp/IntunePackage/Install.ps1 +++ b/AddChocoApp/IntunePackage/Install.ps1 @@ -12,6 +12,10 @@ param ( [string] $CustomRepo, + [Parameter()] + [string] + $CustomArguments, + [Parameter()] [switch] $Trace @@ -36,13 +40,23 @@ try { try { $localprograms = & "$chocoPath" list --localonly $CustomRepoString = if ($CustomRepo) { "--source $customrepo" } else { $null } + $CustomArgsArray = if ($CustomArguments) { $CustomArguments -split '\s+' } else { @() } + if ($localprograms -like "*$Packagename*" ) { Write-Host "Upgrading $packagename" - & "$chocoPath" upgrade $Packagename $CustomRepoString + if ($CustomArgsArray.Count -gt 0) { + & "$chocoPath" upgrade $Packagename $CustomRepoString $CustomArgsArray + } else { + & "$chocoPath" upgrade $Packagename $CustomRepoString + } } else { Write-Host "Installing $packagename" - & "$chocoPath" install $Packagename -y $CustomRepoString + if ($CustomArgsArray.Count -gt 0) { + & "$chocoPath" install $Packagename -y $CustomRepoString $CustomArgsArray + } else { + & "$chocoPath" install $Packagename -y $CustomRepoString + } } Write-Host 'Completed.' } diff --git a/Config/standards.json b/Config/standards.json index 73cee383935e..3c40463ff676 100644 --- a/Config/standards.json +++ b/Config/standards.json @@ -2291,6 +2291,13 @@ ], "helpText": "This creates a Safe Links policy that automatically scans, tracks, and and enables safe links for Email, Office, and Teams for both external and internal senders", "addedComponent": [ + { + "type": "textField", + "name": "standards.SafeLinksPolicy.name", + "label": "Policy Name", + "required": true, + "defaultValue": "CIPP Default SafeLinks Policy" + }, { "type": "switch", "label": "AllowClickThrough", @@ -2338,6 +2345,13 @@ ], "helpText": "This creates a Anti-Phishing policy that automatically enables Mailbox Intelligence and spoofing, optional switches for Mail tips.", "addedComponent": [ + { + "type": "textField", + "name": "standards.AntiPhishPolicy.name", + "label": "Policy Name", + "required": true, + "defaultValue": "CIPP Default Anti-Phishing Policy" + }, { "type": "number", "label": "Phishing email threshold. (Default 1)", @@ -2548,6 +2562,13 @@ ], "helpText": "This creates a Safe Attachment policy", "addedComponent": [ + { + "type": "textField", + "name": "standards.SafeAttachmentPolicy.name", + "label": "Policy Name", + "required": true, + "defaultValue": "CIPP Default Safe Attachment Policy" + }, { "type": "select", "multiple": false, @@ -2692,6 +2713,13 @@ ], "helpText": "This creates a Malware filter policy that enables the default File filter and Zero-hour auto purge for malware.", "addedComponent": [ + { + "type": "textField", + "name": "standards.MalwareFilterPolicy.name", + "label": "Policy Name", + "required": true, + "defaultValue": "CIPP Default Malware Policy" + }, { "type": "select", "multiple": false, @@ -2811,7 +2839,15 @@ "cat": "Defender Standards", "tag": [], "helpText": "This standard creates a Spam filter policy similar to the default strict policy.", + "docsDescription": "This standard creates a Spam filter policy similar to the default strict policy, the following settings are configured to on by default: IncreaseScoreWithNumericIps, IncreaseScoreWithRedirectToOtherPort, MarkAsSpamEmptyMessages, MarkAsSpamJavaScriptInHtml, MarkAsSpamSpfRecordHardFail, MarkAsSpamFromAddressAuthFail, MarkAsSpamNdrBackscatter, MarkAsSpamBulkMail, InlineSafetyTipsEnabled, PhishZapEnabled, SpamZapEnabled", "addedComponent": [ + { + "type": "textField", + "name": "standards.SpamFilterPolicy.name", + "label": "Policy Name", + "required": true, + "defaultValue": "CIPP Default Spam Filter Policy" + }, { "type": "number", "label": "Bulk email threshold (Default 7)", @@ -4772,6 +4808,30 @@ "type": "textField", "required": false, "helpText": "Enter the group name to exclude from the assignment. Wildcards are allowed." + }, + { + "type": "textField", + "required": false, + "name": "assignmentFilter", + "label": "Assignment Filter Name (Optional)", + "helpText": "Enter the assignment filter name to apply to this policy assignment. Wildcards are allowed." + }, + { + "name": "assignmentFilterType", + "label": "Assignment Filter Mode (Optional)", + "type": "radio", + "required": false, + "helpText": "Choose whether to include or exclude devices matching the filter. Only applies if you specified a filter name above. Defaults to Include if not specified.", + "options": [ + { + "label": "Include - Assign to devices matching the filter", + "value": "include" + }, + { + "label": "Exclude - Assign to devices NOT matching the filter", + "value": "exclude" + } + ] } ] }, @@ -4915,6 +4975,35 @@ } ] }, + { + "name": "standards.AssignmentFilterTemplate", + "label": "Assignment Filter Template", + "multi": true, + "cat": "Templates", + "disabledFeatures": { + "report": true, + "warn": true, + "remediate": false + }, + "impact": "Medium Impact", + "addedDate": "2025-10-04", + "helpText": "Deploy and manage assignment filter templates.", + "executiveText": "Creates standardized assignment filters with predefined settings. These templates ensure consistent assignment filter configurations across the organization, streamlining assignment management.", + "addedComponent": [ + { + "type": "autoComplete", + "name": "assignmentFilterTemplate", + "label": "Select Assignment Filter Template", + "api": { + "url": "/api/ListAssignmentFilterTemplates", + "labelField": "Displayname", + "altLabelField": "displayName", + "valueField": "GUID", + "queryKey": "ListAssignmentFilterTemplates" + } + } + ] + }, { "name": "standards.MailboxRecipientLimits", "cat": "Exchange Standards", diff --git a/Modules/CIPPCore/Public/CippQueue/Invoke-RemoveCippQueue.ps1 b/Modules/CIPPCore/Public/CippQueue/Invoke-RemoveCippQueue.ps1 index 7238262a74b2..8756a956725a 100644 --- a/Modules/CIPPCore/Public/CippQueue/Invoke-RemoveCippQueue.ps1 +++ b/Modules/CIPPCore/Public/CippQueue/Invoke-RemoveCippQueue.ps1 @@ -6,11 +6,6 @@ function Invoke-RemoveCippQueue { CIPP.Core.ReadWrite #> param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $CippQueue = Get-CippTable -TableName 'CippQueue' Clear-AzDataTable @CippQueue $CippQueueTasks = Get-CippTable -TableName 'CippQueueTasks' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAddAlert.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAddAlert.ps1 index e1dccc4fac56..4dc4587bede7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAddAlert.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAddAlert.ps1 @@ -9,8 +9,6 @@ function Invoke-ExecAddAlert { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAzBobbyTables.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAzBobbyTables.ps1 index 5fb0714eaf67..c9e1da70bc2a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAzBobbyTables.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAzBobbyTables.ps1 @@ -12,11 +12,6 @@ function Invoke-ExecAzBobbyTables { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $AllowList = @( 'Add-AzDataTableEntity' 'Add-CIPPAzDataTableEntity' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecCPVRefresh.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecCPVRefresh.ps1 index c97d0ca65be5..5459d1fab375 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecCPVRefresh.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecCPVRefresh.ps1 @@ -11,11 +11,6 @@ function Invoke-ExecCPVRefresh { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $InstanceId = Start-UpdatePermissionsOrchestrator return @{ diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecCippFunction.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecCippFunction.ps1 index 088d28b3c856..222e7abed29d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecCippFunction.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecCippFunction.ps1 @@ -11,11 +11,6 @@ function Invoke-ExecCippFunction { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $BlockList = @( 'Get-GraphToken' 'Get-GraphTokenFromCert' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecDurableFunctions.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecDurableFunctions.ps1 index 30b1dc00f47c..c46814ae598e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecDurableFunctions.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecDurableFunctions.ps1 @@ -7,11 +7,6 @@ function Invoke-ExecDurableFunctions { #> [CmdletBinding(SupportsShouldProcess = $true)] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Collect info $StorageContext = New-AzStorageContext -ConnectionString $env:AzureWebJobsStorage $FunctionName = $env:WEBSITE_SITE_NAME 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 e5a122dba3dc..30fd19ec4f86 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 @@ -11,9 +11,6 @@ function Invoke-ExecEditTemplate { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $Table = Get-CippTable -tablename 'templates' $guid = $request.body.id ? $request.body.id : $request.body.GUID @@ -44,7 +41,6 @@ function Invoke-ExecEditTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecGeoIPLookup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecGeoIPLookup.ps1 index 2f3f6483ecd4..4e75715e93ca 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecGeoIPLookup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecGeoIPLookup.ps1 @@ -9,11 +9,6 @@ Function Invoke-ExecGeoIPLookup { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $IP = $Request.Query.IP ?? $Request.Body.IP if (-not $IP) { @@ -23,7 +18,6 @@ Function Invoke-ExecGeoIPLookup { $locationInfo = Get-CIPPGeoIPLocation -IP $IP } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $LocationInfo diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 index 5a1561b3d854..19e3a5d87dd1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecListBackup { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Type = $Request.Query.Type $TenantFilter = $Request.Query.tenantFilter $NameOnly = $Request.Query.NameOnly diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecPartnerWebhook.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecPartnerWebhook.ps1 index 9600b1988e5d..6a7a86b59a2c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecPartnerWebhook.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecPartnerWebhook.ps1 @@ -6,11 +6,6 @@ function Invoke-ExecPartnerWebhook { CIPP.AppSettings.ReadWrite #> Param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - switch ($Request.Query.Action) { 'ListEventTypes' { $Uri = 'https://api.partnercenter.microsoft.com/webhooks/v1/registration/events' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecServicePrincipals.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecServicePrincipals.ps1 index 0dd3e51b1f8a..1c3fd744bf4c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecServicePrincipals.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecServicePrincipals.ps1 @@ -7,11 +7,6 @@ function Invoke-ExecServicePrincipals { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $env:TenantID $Success = $true diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetCIPPAutoBackup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetCIPPAutoBackup.ps1 index 4f87f126c2e2..f089cd2bae21 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetCIPPAutoBackup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetCIPPAutoBackup.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecSetCIPPAutoBackup { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $unixtime = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds if ($Request.Body.Enabled -eq $true) { $Table = Get-CIPPTable -TableName 'ScheduledTasks' @@ -39,7 +34,6 @@ function Invoke-ExecSetCIPPAutoBackup { $Result = @{ 'Results' = 'Scheduled Task Successfully created' } } Write-LogMessage -headers $Request.Headers -API $Request.Params.CIPPEndpoint -message 'Scheduled automatic CIPP backups' -Sev 'Info' - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Result diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetPackageTag.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetPackageTag.ps1 index 1216448e1810..c2249f768aab 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetPackageTag.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetPackageTag.ps1 @@ -62,7 +62,6 @@ function Invoke-ExecSetPackageTag { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetCippAlerts.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetCippAlerts.ps1 index 499e06dcb81c..b9dba4b0e574 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetCippAlerts.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetCippAlerts.ps1 @@ -9,11 +9,6 @@ function Invoke-GetCippAlerts { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Alerts = [System.Collections.Generic.List[object]]::new() $Table = Get-CippTable -tablename CippAlerts $PartitionKey = Get-Date -UFormat '%Y%m%d' @@ -60,7 +55,7 @@ function Invoke-GetCippAlerts { type = 'error' }) } - if ((!$env:WEBSITE_RUN_FROM_PACKAGE -or [string]::IsNullOrEmpty($env:WEBSITE_RUN_FROM_PACKAGE)) -and $env:AzureWebJobsStorage -ne 'UseDevelopmentStorage=true' -or $env:NonLocalHostAzurite -ne 'true') { + if ((!$env:WEBSITE_RUN_FROM_PACKAGE -or [string]::IsNullOrEmpty($env:WEBSITE_RUN_FROM_PACKAGE)) -and $env:AzureWebJobsStorage -ne 'UseDevelopmentStorage=true' -and $env:NonLocalHostAzurite -ne 'true') { $Alerts.Add( @{ title = 'Function App in Write Mode' @@ -72,7 +67,6 @@ function Invoke-GetCippAlerts { if ($Rows) { $Rows | ForEach-Object { $Alerts.Add($_) } } $Alerts = @($Alerts) - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Alerts diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetVersion.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetVersion.ps1 index 21719fd4f659..17d2a15f5c3e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetVersion.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetVersion.ps1 @@ -9,16 +9,10 @@ Function Invoke-GetVersion { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $CIPPVersion = $request.query.LocalVersion $Version = Assert-CippVersion -CIPPVersion $CIPPVersion - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Version diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListApiTest.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListApiTest.ps1 index caaa034cfa65..f4eeda9925b4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListApiTest.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListApiTest.ps1 @@ -7,12 +7,6 @@ function Invoke-ListApiTest { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = ($Request | ConvertTo-Json -Depth 5) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListDirectoryObjects.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListDirectoryObjects.ps1 index 0c0257871091..9d9201b17e1c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListDirectoryObjects.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListDirectoryObjects.ps1 @@ -7,11 +7,6 @@ function Invoke-ListDirectoryObjects { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $Request.Body.partnerLookup ? $env:TenantID : $Request.Body.tenantFilter $AsApp = $Request.Body.asApp $Ids = $Request.Body.ids diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListExtensionCacheData.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListExtensionCacheData.ps1 index 10d7318a09ed..155d8e7059e2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListExtensionCacheData.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListExtensionCacheData.ps1 @@ -11,11 +11,6 @@ function Invoke-ListExtensionCacheData { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $Request.Query.tenantFilter ?? $Request.Body.tenantFilter $DataTypes = $Request.Query.dataTypes -split ',' ?? $Request.Body.dataTypes ?? 'All' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListGraphBulkRequest.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListGraphBulkRequest.ps1 index cd8e606f10a1..757b0de55348 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListGraphBulkRequest.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListGraphBulkRequest.ps1 @@ -7,11 +7,6 @@ function Invoke-ListGraphBulkRequest { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $Request.Body.tenantFilter $AsApp = $Request.Body.asApp $Requests = $Request.Body.requests diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/invoke-ListEmptyResults.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/invoke-ListEmptyResults.ps1 index 0e6c087c3062..a086b28cd4ae 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/invoke-ListEmptyResults.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/invoke-ListEmptyResults.ps1 @@ -11,12 +11,6 @@ Function invoke-ListEmptyResults { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @() diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionMapping.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionMapping.ps1 index b0523cd8b775..6cb6fd2975d7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionMapping.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionMapping.ps1 @@ -118,7 +118,6 @@ Function Invoke-ExecExtensionMapping { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Result diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionSync.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionSync.ps1 index f2c23a02c978..4cf4d1139046 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionSync.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionSync.ps1 @@ -9,11 +9,6 @@ Function Invoke-ExecExtensionSync { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - switch ($Request.Query.Extension) { 'Gradient' { try { diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionTest.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionTest.ps1 index 6cce035a8761..54dbcfd3a80f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionTest.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionTest.ps1 @@ -9,11 +9,6 @@ Function Invoke-ExecExtensionTest { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CIPPTable -TableName Extensionsconfig $Configuration = ((Get-CIPPAzDataTableEntity @Table).config | ConvertFrom-Json) # Interact with query parameters or the body of the request. @@ -101,7 +96,6 @@ Function Invoke-ExecExtensionTest { $Results = [pscustomobject]@{'Results' = "Failed to connect: $($_.Exception.Message). Line $($_.InvocationInfo.ScriptLineNumber)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionsConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionsConfig.ps1 index bbb2b66a79c6..5a5ac8980ddb 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionsConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ExecExtensionsConfig.ps1 @@ -9,8 +9,6 @@ Function Invoke-ExecExtensionsConfig { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -77,7 +75,6 @@ Function Invoke-ExecExtensionsConfig { - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ListExtensionSync.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ListExtensionSync.ps1 index 2b48bd5b13b7..fb376771f544 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ListExtensionSync.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ListExtensionSync.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListExtensionSync { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $ScheduledTasksTable = Get-CIPPTable -TableName 'ScheduledTasks' $ScheduledTasks = Get-CIPPAzDataTableEntity @ScheduledTasksTable -Filter 'Hidden eq true' | Where-Object { $_.Command -match 'CippExtension' } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItemDetails.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItemDetails.ps1 index 98a594611c8d..47fac1271602 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItemDetails.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItemDetails.ps1 @@ -11,9 +11,6 @@ function Invoke-ListScheduledItemDetails { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Get parameters from the request $RowKey = $Request.Query.RowKey ?? $Request.Body.RowKey diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItems.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItems.ps1 index 20d3c27115cf..949754fb7fb7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItems.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItems.ps1 @@ -9,11 +9,6 @@ function Invoke-ListScheduledItems { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $ScheduledItemFilter = [System.Collections.Generic.List[string]]::new() $ScheduledItemFilter.Add("PartitionKey eq 'ScheduledTask'") @@ -112,7 +107,6 @@ function Invoke-ListScheduledItems { $Task } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($ScheduledTasks | Sort-Object -Property ScheduledTime, ExecutedTime -Descending) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecAccessChecks.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecAccessChecks.ps1 index 71f517a61cfd..e0f3b84648b6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecAccessChecks.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecAccessChecks.ps1 @@ -11,9 +11,6 @@ function Invoke-ExecAccessChecks { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CIPPTable -tablename 'AccessChecks' $LastRun = (Get-Date).ToUniversalTime() $4HoursAgo = (Get-Date).AddHours(-1).ToUniversalTime() @@ -141,7 +138,6 @@ function Invoke-ExecAccessChecks { 'Metadata' = $Metadata } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecBackendURLs.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecBackendURLs.ps1 index 21873220d221..96509067c991 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecBackendURLs.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecBackendURLs.ps1 @@ -9,11 +9,6 @@ Function Invoke-ExecBackendURLs { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Subscription = ($env:WEBSITE_OWNER_NAME).split('+') | Select-Object -First 1 $SWAName = $env:WEBSITE_SITE_NAME -replace 'cipp', 'CIPP-SWA-' @@ -44,7 +39,6 @@ Function Invoke-ExecBackendURLs { $body = @{Results = $Results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [httpstatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecBrandingSettings.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecBrandingSettings.ps1 index c1fdd84287d2..f9b3b2fa0f83 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecBrandingSettings.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecBrandingSettings.ps1 @@ -11,9 +11,6 @@ Function Invoke-ExecBrandingSettings { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $StatusCode = [HttpStatusCode]::OK @{} @@ -115,7 +112,6 @@ Function Invoke-ExecBrandingSettings { $body = [pscustomobject]@{'Results' = $Results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecCPVPermissions.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecCPVPermissions.ps1 index e4a5428478a3..1ccde247e52f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecCPVPermissions.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecCPVPermissions.ps1 @@ -9,10 +9,6 @@ function Invoke-ExecCPVPermissions { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $TenantFilter = $Request.Body.tenantFilter $Tenant = Get-Tenants -TenantFilter $TenantFilter -IncludeErrors @@ -54,7 +50,6 @@ function Invoke-ExecCPVPermissions { $GraphRequest = 'Tenant not found' $Success = $false } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{ diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecDnsConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecDnsConfig.ps1 index 0fb6bf4e62d5..dc9643c0dd11 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecDnsConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecDnsConfig.ps1 @@ -11,9 +11,6 @@ Function Invoke-ExecDnsConfig { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # List of supported resolvers $ValidResolvers = @( 'Google' @@ -106,7 +103,6 @@ Function Invoke-ExecDnsConfig { $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeLicenses.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeLicenses.ps1 index 6545969a6a97..f9bd90a72926 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeLicenses.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeLicenses.ps1 @@ -11,11 +11,6 @@ Function Invoke-ExecExcludeLicenses { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - $Table = Get-CIPPTable -TableName ExcludedLicenses try { @@ -64,7 +59,6 @@ Function Invoke-ExecExcludeLicenses { $body = [pscustomobject]@{'Results' = "Failed. $($_.Exception.Message)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 index 252252a259bd..56e89acc564a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 @@ -65,7 +65,6 @@ Function Invoke-ExecExcludeTenant { } if (!$body) { $body = @() } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecMaintenanceScripts.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecMaintenanceScripts.ps1 index 3650ea0b22b5..5fc747c1f30a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecMaintenanceScripts.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecMaintenanceScripts.ps1 @@ -11,8 +11,6 @@ Function Invoke-ExecMaintenanceScripts { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - try { $GraphToken = Get-GraphToken -returnRefresh $true $AccessTokenDetails = Read-JwtAccessDetails -Token $GraphToken.access_token @@ -72,7 +70,6 @@ Function Invoke-ExecMaintenanceScripts { $Body = @{Status = "Failed to retrieve maintenance scripts $($_.Exception.Message)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecNotificationConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecNotificationConfig.ps1 index f2e544eeedf5..86abe89702e1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecNotificationConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecNotificationConfig.ps1 @@ -9,11 +9,6 @@ Function Invoke-ExecNotificationConfig { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $sev = ([pscustomobject]$Request.body.Severity).value -join (',') $config = @{ email = $Request.body.email @@ -26,7 +21,6 @@ Function Invoke-ExecNotificationConfig { $Results = Set-cippNotificationConfig @Config $body = [pscustomobject]@{'Results' = $Results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecPasswordConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecPasswordConfig.ps1 index 253e88107f81..cb58f3759a88 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecPasswordConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecPasswordConfig.ps1 @@ -9,11 +9,6 @@ Function Invoke-ExecPasswordConfig { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CIPPTable -TableName Settings $PasswordType = (Get-CIPPAzDataTableEntity @Table) @@ -39,7 +34,6 @@ Function Invoke-ExecPasswordConfig { $body = [pscustomobject]@{'Results' = $Results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecRestoreBackup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecRestoreBackup.ps1 index 2b2906857e83..1838134d889d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecRestoreBackup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecRestoreBackup.ps1 @@ -11,8 +11,6 @@ function Invoke-ExecRestoreBackup { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - try { if ($Request.Body.BackupName -like 'CippBackup_*') { @@ -56,7 +54,6 @@ function Invoke-ExecRestoreBackup { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecRunBackup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecRunBackup.ps1 index ea136832ac98..5547c79ba224 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecRunBackup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecRunBackup.ps1 @@ -35,7 +35,6 @@ Function Invoke-ExecRunBackup { } | ConvertTo-Json -Depth 5 -Compress Write-LogMessage -headers $Request.Headers -API $APINAME -message 'Failed to create CIPP backup' -Sev 'Error' -LogData (Get-CippException -Exception $_) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ListCustomRole.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ListCustomRole.ps1 index d6fa4edf96ff..0fac4036a55f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ListCustomRole.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ListCustomRole.ps1 @@ -7,11 +7,6 @@ function Invoke-ListCustomRole { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $DefaultRoles = @('readonly', 'editor', 'admin', 'superadmin') $Table = Get-CippTable -tablename 'CustomRoles' $CustomRoles = Get-CIPPAzDataTableEntity @Table diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecAddTenant.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecAddTenant.ps1 index 79f07402c704..8ade9c5e6986 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecAddTenant.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecAddTenant.ps1 @@ -73,7 +73,6 @@ function Invoke-ExecAddTenant { $Results = @{'message' = "Failed to add tenant: $($_.Exception.Message)"; 'state' = 'error'; 'severity' = 'error' } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecCombinedSetup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecCombinedSetup.ps1 index ec8101fdb7d1..bb9f4c91a7eb 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecCombinedSetup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecCombinedSetup.ps1 @@ -117,7 +117,6 @@ function Invoke-ExecCombinedSetup { $Results = [pscustomobject]@{'Results' = "Failed. $($_.InvocationInfo.ScriptLineNumber): $($_.Exception.message)"; severity = 'failed' } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecCreateSAMApp.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecCreateSAMApp.ps1 index 38d776968312..1900961223af 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecCreateSAMApp.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecCreateSAMApp.ps1 @@ -104,7 +104,6 @@ function Invoke-ExecCreateSAMApp { $Results = [pscustomobject]@{'Results' = "Failed. $($_.InvocationInfo.ScriptLineNumber): $($_.Exception.message)"; severity = 'failed' } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecDeviceCodeLogon.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecDeviceCodeLogon.ps1 index 7755ef5da694..9f04f12acdc8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecDeviceCodeLogon.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecDeviceCodeLogon.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecDeviceCodeLogon { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $clientId = $Request.Query.clientId $scope = $Request.Query.scope @@ -60,7 +55,6 @@ function Invoke-ExecDeviceCodeLogon { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results | ConvertTo-Json diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecSAMSetup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecSAMSetup.ps1 index ea8c8da6faa6..6bb62c0aa6f6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecSAMSetup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecSAMSetup.ps1 @@ -23,11 +23,6 @@ function Invoke-ExecSAMSetup { }) exit } - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - if ($env:AzureWebJobsStorage -eq 'UseDevelopmentStorage=true' -or $env:NonLocalHostAzurite -eq 'true') { $DevSecretsTable = Get-CIPPTable -tablename 'DevSecrets' $Secret = Get-CIPPAzDataTableEntity @DevSecretsTable -Filter "PartitionKey eq 'Secret' and RowKey eq 'Secret'" @@ -239,7 +234,6 @@ function Invoke-ExecSAMSetup { $Results = [pscustomobject]@{'Results' = "Failed. $($_.InvocationInfo.ScriptLineNumber): $($_.Exception.message)" ; step = $step } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecUpdateRefreshToken.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecUpdateRefreshToken.ps1 index 8010c41e36b8..40b5957d550b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecUpdateRefreshToken.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecUpdateRefreshToken.ps1 @@ -58,7 +58,6 @@ Function Invoke-ExecUpdateRefreshToken { $Results = [pscustomobject]@{'Results' = "Failed. $($_.InvocationInfo.ScriptLineNumber): $($_.Exception.message)"; severity = 'failed' } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-AddContact.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-AddContact.ps1 index 1f2c88621d17..16409f847d4f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-AddContact.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-AddContact.ps1 @@ -99,7 +99,6 @@ Function Invoke-AddContact { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-AddContactTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-AddContactTemplates.ps1 index eacd4607d75a..fb229af6e02a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-AddContactTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-AddContactTemplates.ps1 @@ -60,7 +60,6 @@ Function Invoke-AddContactTemplates { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-DeployContactTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-DeployContactTemplates.ps1 index ffb65003282e..e33aedb7ec30 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-DeployContactTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-DeployContactTemplates.ps1 @@ -176,7 +176,6 @@ Function Invoke-DeployContactTemplates { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Results} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-EditContact.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-EditContact.ps1 index a1ca08138943..59dc2202e4d2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-EditContact.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-EditContact.ps1 @@ -86,7 +86,6 @@ Function Invoke-EditContact { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-EditContactTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-EditContactTemplates.ps1 index ea50459bd998..4e5f37b5f8fb 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-EditContactTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-EditContactTemplates.ps1 @@ -76,7 +76,6 @@ Function Invoke-EditContactTemplates { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-ListContactTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-ListContactTemplates.ps1 index 8ed1a6c1c16b..2ad5044d7b54 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-ListContactTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-ListContactTemplates.ps1 @@ -58,7 +58,6 @@ Function Invoke-ListContactTemplates { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Templates) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-RemoveContact.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-RemoveContact.ps1 index d29841e1f103..b35fa0f63c5f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-RemoveContact.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-RemoveContact.ps1 @@ -34,7 +34,6 @@ Function Invoke-RemoveContact { } $Results = [pscustomobject]@{'Results' = $Result } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-RemoveContactTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-RemoveContactTemplates.ps1 index 067d2981164d..038e65524e32 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-RemoveContactTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-RemoveContactTemplates.ps1 @@ -29,7 +29,6 @@ Function Invoke-RemoveContactTemplates { Write-LogMessage -Headers $User -API $APINAME -message $Result -Sev 'Error' -LogData $ErrorMessage $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-AddSharedMailbox.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-AddSharedMailbox.ps1 index 678f6611d7a4..5e9ba10ecaee 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-AddSharedMailbox.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-AddSharedMailbox.ps1 @@ -73,7 +73,6 @@ function Invoke-AddSharedMailbox { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecConvertMailbox.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecConvertMailbox.ps1 index 3fb34dbe8ebc..42b37d446281 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecConvertMailbox.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecConvertMailbox.ps1 @@ -26,7 +26,6 @@ Function Invoke-ExecConvertMailbox { $Results = $_.Exception.Message $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecCopyForSent.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecCopyForSent.ps1 index 79bfdda9dba6..ce64100bb927 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecCopyForSent.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecCopyForSent.ps1 @@ -28,7 +28,6 @@ Function Invoke-ExecCopyForSent { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEditCalendarPermissions.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEditCalendarPermissions.ps1 index e9e3f1100f33..b96d92a55cf0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEditCalendarPermissions.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEditCalendarPermissions.ps1 @@ -9,8 +9,6 @@ function Invoke-ExecEditCalendarPermissions { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -37,7 +35,6 @@ function Invoke-ExecEditCalendarPermissions { Write-Information $_.InvocationInfo.PositionMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEditMailboxPermissions.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEditMailboxPermissions.ps1 index 40802232b6be..300de9a87f12 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEditMailboxPermissions.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEditMailboxPermissions.ps1 @@ -110,7 +110,6 @@ Function Invoke-ExecEditMailboxPermissions { $body = [pscustomobject]@{'Results' = @($results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEmailForward.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEmailForward.ps1 index 3175dcbeb38b..1f88210ec7d4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEmailForward.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEmailForward.ps1 @@ -61,7 +61,6 @@ Function Invoke-ExecEmailForward { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEnableArchive.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEnableArchive.ps1 index 49cc24cacb8f..3bc73a5aa13f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEnableArchive.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEnableArchive.ps1 @@ -28,7 +28,6 @@ Function Invoke-ExecEnableArchive { $StatusCode = [HttpStatusCode]::InternalServerError } $Results = [pscustomobject]@{'Results' = "$ResultsArch" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEnableAutoExpandingArchive.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEnableAutoExpandingArchive.ps1 index a2747e09fa9a..2b4ddcafb517 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEnableAutoExpandingArchive.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecEnableAutoExpandingArchive.ps1 @@ -7,8 +7,6 @@ function Invoke-ExecEnableAutoExpandingArchive { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsDelete.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsDelete.ps1 index d0820fb00bce..143b0e6ee0b7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsDelete.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsDelete.ps1 @@ -27,7 +27,6 @@ Function Invoke-ExecGroupsDelete { $Result = "$($_.Exception.Message)" $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsDeliveryManagement.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsDeliveryManagement.ps1 index a055e788b3f0..04f234e7c60d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsDeliveryManagement.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsDeliveryManagement.ps1 @@ -27,7 +27,6 @@ Function Invoke-ExecGroupsDeliveryManagement { $Result = "$($_.Exception.Message)" $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsHideFromGAL.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsHideFromGAL.ps1 index 21787ac46ca1..44b735e81ce8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsHideFromGAL.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecGroupsHideFromGAL.ps1 @@ -27,7 +27,6 @@ Function Invoke-ExecGroupsHideFromGAL { $Result = "$($_.Exception.Message)" $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecHVEUser.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecHVEUser.ps1 index 2d33258e9f50..83de89756610 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecHVEUser.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecHVEUser.ps1 @@ -100,7 +100,6 @@ function Invoke-ExecHVEUser { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecHideFromGAL.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecHideFromGAL.ps1 index 2b712982717d..ed9e32c87442 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecHideFromGAL.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecHideFromGAL.ps1 @@ -29,7 +29,6 @@ Function Invoke-ExecHideFromGAL { $Result = $_.Exception.Message $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecMailboxMobileDevices.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecMailboxMobileDevices.ps1 index bb5d4675e5a5..381fc9cc3bc9 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecMailboxMobileDevices.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecMailboxMobileDevices.ps1 @@ -11,10 +11,6 @@ Function Invoke-ExecMailboxMobileDevices { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. Try { $MobileResults = Set-CIPPMobileDevice -UserId $request.query.Userid -Guid $request.query.guid -DeviceId $request.query.deviceid -Quarantine $request.query.Quarantine -tenantFilter $request.query.tenantfilter -APIName $APINAME -Delete $Request.query.Delete -Headers $Request.Headers @@ -23,7 +19,6 @@ Function Invoke-ExecMailboxMobileDevices { $Results = [pscustomobject]@{'Results' = "Failed $($request.query.Userid): $($_.Exception.Message)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecModifyCalPerms.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecModifyCalPerms.ps1 index 469254dc85d4..67ff2a1eb43b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecModifyCalPerms.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecModifyCalPerms.ps1 @@ -109,7 +109,6 @@ function Invoke-ExecModifyCalPerms { $Body = [pscustomobject]@{'Results' = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = if ($HasErrors) { [HttpStatusCode]::InternalServerError } else { [HttpStatusCode]::OK } Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecModifyContactPerms.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecModifyContactPerms.ps1 index 4ed3a6a8d3c4..d7c6252b4709 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecModifyContactPerms.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecModifyContactPerms.ps1 @@ -108,7 +108,6 @@ function Invoke-ExecModifyContactPerms { $Body = [pscustomobject]@{'Results' = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = if ($HasErrors) { [HttpStatusCode]::InternalServerError } else { [HttpStatusCode]::OK } Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecRemoveMailboxRule.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecRemoveMailboxRule.ps1 index d6a820528e7b..1727334eb008 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecRemoveMailboxRule.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecRemoveMailboxRule.ps1 @@ -29,7 +29,6 @@ Function Invoke-ExecRemoveMailboxRule { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecRemoveRestrictedUser.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecRemoveRestrictedUser.ps1 index d7cc9a4e901d..70d043e9adc8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecRemoveRestrictedUser.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecRemoveRestrictedUser.ps1 @@ -38,7 +38,6 @@ function Invoke-ExecRemoveRestrictedUser { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetLitigationHold.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetLitigationHold.ps1 index 610767343be8..6f8e0d3c9a63 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetLitigationHold.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetLitigationHold.ps1 @@ -50,7 +50,6 @@ function Invoke-ExecSetLitigationHold { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxEmailSize.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxEmailSize.ps1 index 3662a0ce128a..5fe95a402ea6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxEmailSize.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxEmailSize.ps1 @@ -40,7 +40,6 @@ Function Invoke-ExecSetMailboxEmailSize { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxLocale.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxLocale.ps1 index 5e0cc9859188..d9dffd065219 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxLocale.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxLocale.ps1 @@ -27,7 +27,6 @@ Function Invoke-ExecSetMailboxLocale { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxQuota.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxQuota.ps1 index 3f746f726202..abb8b197596d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxQuota.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxQuota.ps1 @@ -41,7 +41,6 @@ Function Invoke-ExecSetMailboxQuota { $body = [pscustomobject]@{'Results' = @("Could not adjust mailbox quota: $($_.Exception.message)") } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxRule.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxRule.ps1 index 0b5c3d217069..622b3e47e73a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxRule.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetMailboxRule.ps1 @@ -49,7 +49,6 @@ Function Invoke-ExecSetMailboxRule { $StatusCode = [HttpStatusCode]::OK } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetOoO.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetOoO.ps1 index d92bf5819e31..a221568b0745 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetOoO.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetOoO.ps1 @@ -65,7 +65,6 @@ Function Invoke-ExecSetOoO { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetRecipientLimits.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetRecipientLimits.ps1 index d2c8efb4ac17..924a4f95e21f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetRecipientLimits.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetRecipientLimits.ps1 @@ -32,7 +32,7 @@ function Invoke-ExecSetRecipientLimits { try { $null = New-ExoRequest @ExoRequest $Results = "Recipient limit for $UserPrincipalName has been set to $recipientLimit" - + Write-LogMessage -API $APIName -tenant $TenantFilter -message $Results -sev Info $StatusCode = [HttpStatusCode]::OK } catch { @@ -42,7 +42,6 @@ function Invoke-ExecSetRecipientLimits { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetRetentionHold.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetRetentionHold.ps1 index 80d1d8ec1fe6..86d1af8b30d8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetRetentionHold.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetRetentionHold.ps1 @@ -32,7 +32,7 @@ function Invoke-ExecSetRetentionHold { try { $null = New-ExoRequest @ExoRequest $Results = "Retention hold for $UserPrincipalName with Id $Identity has been set to $RetentionHoldState" - + Write-LogMessage -API $APIName -tenant $TenantFilter -message $Results -sev Info $StatusCode = [HttpStatusCode]::OK } catch { @@ -42,7 +42,6 @@ function Invoke-ExecSetRetentionHold { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecStartManagedFolderAssistant.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecStartManagedFolderAssistant.ps1 index 1cddbf19810b..81b6b93f29b3 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecStartManagedFolderAssistant.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecStartManagedFolderAssistant.ps1 @@ -42,7 +42,6 @@ Function Invoke-ExecStartManagedFolderAssistant { } $Body = [pscustomobject] @{ 'Results' = $Result } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListCalendarPermissions.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListCalendarPermissions.ps1 index 0c404b0528de..0a76fef089be 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListCalendarPermissions.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListCalendarPermissions.ps1 @@ -11,9 +11,6 @@ Function Invoke-ListCalendarPermissions { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $UserID = $Request.Query.UserID $TenantFilter = $Request.Query.tenantFilter @@ -32,7 +29,6 @@ Function Invoke-ListCalendarPermissions { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListContactPermissions.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListContactPermissions.ps1 index 1db0ee75679b..60a5802e2cd4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListContactPermissions.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListContactPermissions.ps1 @@ -11,9 +11,6 @@ Function Invoke-ListContactPermissions { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $UserID = $Request.Query.UserID $TenantFilter = $Request.Query.tenantFilter @@ -32,7 +29,6 @@ Function Invoke-ListContactPermissions { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxMobileDevices.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxMobileDevices.ps1 index 5c24d91cd661..4f8514b29b87 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxMobileDevices.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxMobileDevices.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListMailboxMobileDevices { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $Mailbox = $Request.Query.Mailbox @@ -46,7 +40,6 @@ Function Invoke-ListMailboxMobileDevices { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxRules.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxRules.ps1 index 86a142f05706..b65140defb3d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxRules.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxRules.ps1 @@ -9,11 +9,6 @@ function Invoke-ListMailboxRules { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxes.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxes.ps1 index 996b65792c2d..32967c524234 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxes.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxes.ps1 @@ -9,11 +9,6 @@ function Invoke-ListMailboxes { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter try { @@ -87,7 +82,6 @@ function Invoke-ListMailboxes { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListOoO.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListOoO.ps1 index 39b57f0461dc..cdab8fcbe829 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListOoO.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListOoO.ps1 @@ -24,7 +24,6 @@ Function Invoke-ListOoO { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListRestrictedUsers.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListRestrictedUsers.ps1 index 21381528c724..ea5b79953c85 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListRestrictedUsers.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListRestrictedUsers.ps1 @@ -11,11 +11,6 @@ function Invoke-ListRestrictedUsers { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -52,7 +47,6 @@ function Invoke-ListRestrictedUsers { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListSharedMailboxStatistics.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListSharedMailboxStatistics.ps1 index 0f1128891711..ec779849d482 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListSharedMailboxStatistics.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListSharedMailboxStatistics.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListSharedMailboxStatistics { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # XXX Seems like an unused endpoint? -Bobby # Interact with query parameters or the body of the request. @@ -32,7 +27,6 @@ Function Invoke-ListSharedMailboxStatistics { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListmailboxPermissions.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListmailboxPermissions.ps1 index 0957d08c48c0..8cfe017091ea 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListmailboxPermissions.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListmailboxPermissions.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListmailboxPermissions { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $UserID = $Request.Query.userId @@ -70,7 +65,6 @@ Function Invoke-ListmailboxPermissions { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecManageRetentionPolicies.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecManageRetentionPolicies.ps1 index 7f39e8b87ec8..a5f3ef39dbf8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecManageRetentionPolicies.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecManageRetentionPolicies.ps1 @@ -11,9 +11,6 @@ Function Invoke-ExecManageRetentionPolicies { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Results = [System.Collections.Generic.List[string]]::new() $TenantFilter = $Request.Query.tenantFilter ?? $Request.body.tenantFilter $CmdletArray = [System.Collections.ArrayList]::new() @@ -249,7 +246,6 @@ Function Invoke-ExecManageRetentionPolicies { # If no results are found, we will return an empty message to prevent null reference errors in the frontend $GraphRequest = $GraphRequest ?? @() - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $GraphRequest diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecManageRetentionTags.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecManageRetentionTags.ps1 index 23b371949dc1..d54924a8b0b3 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecManageRetentionTags.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecManageRetentionTags.ps1 @@ -11,9 +11,6 @@ Function Invoke-ExecManageRetentionTags { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Results = [System.Collections.Generic.List[string]]::new() $TenantFilter = $Request.Query.tenantFilter ?? $Request.body.tenantFilter $CmdletArray = [System.Collections.ArrayList]::new() @@ -350,7 +347,6 @@ Function Invoke-ExecManageRetentionTags { # If no results are found, we will return an empty message to prevent null reference errors in the frontend $GraphRequest = $GraphRequest ?? @() - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $GraphRequest diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecSetMailboxRetentionPolicies.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecSetMailboxRetentionPolicies.ps1 index 7887dfb0cb92..a06d21dc813f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecSetMailboxRetentionPolicies.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Mailbox Retention/Invoke-ExecSetMailboxRetentionPolicies.ps1 @@ -11,9 +11,6 @@ Function Invoke-ExecSetMailboxRetentionPolicies { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Results = [System.Collections.Generic.List[string]]::new() $TenantFilter = $Request.Query.tenantFilter ?? $Request.body.tenantFilter $CmdletArray = [System.Collections.ArrayList]::new() @@ -143,7 +140,6 @@ Function Invoke-ExecSetMailboxRetentionPolicies { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListAntiPhishingFilters.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListAntiPhishingFilters.ps1 index 9385840d6634..e5f77dbe1893 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListAntiPhishingFilters.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListAntiPhishingFilters.ps1 @@ -7,12 +7,6 @@ function Invoke-ListAntiPhishingFilters { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter $Policies = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Get-AntiPhishPolicy' | Select-Object -Property * @@ -24,7 +18,6 @@ function Invoke-ListAntiPhishingFilters { @{ Name = 'RecipientDomainIs'; Expression = { foreach ($item in $Rules) { if ($item.AntiPhishPolicy -eq $_.Name) { $item.RecipientDomainIs } } } }, @{ Name = 'State'; Expression = { foreach ($item in $Rules) { if ($item.AntiPhishPolicy -eq $_.Name) { $item.State } } } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Output diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListGlobalAddressList.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListGlobalAddressList.ps1 index ee4bdc72edb8..269019526f02 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListGlobalAddressList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListGlobalAddressList.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListGlobalAddressList { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $Request.Query.tenantFilter try { @@ -27,7 +22,6 @@ Function Invoke-ListGlobalAddressList { $GAL = $ErrorMessage.NormalizedError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GAL) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListMailboxCAS.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListMailboxCAS.ps1 index a54e45cff183..97940c5493ee 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListMailboxCAS.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListMailboxCAS.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListMailboxCAS { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter try { @@ -33,7 +27,6 @@ Function Invoke-ListMailboxCAS { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListMalwareFilters.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListMalwareFilters.ps1 index 2dfa27f1a3a9..05a1152b65b2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListMalwareFilters.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListMalwareFilters.ps1 @@ -7,11 +7,6 @@ function Invoke-ListMalwareFilters { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $Policies = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Get-MalwareFilterPolicy' | Select-Object -Property * @@ -23,7 +18,6 @@ function Invoke-ListMalwareFilters { @{ Name = 'RecipientDomainIs'; Expression = { foreach ($item in $Rules) { if ($item.MalwareFilterPolicy -eq $_.Name) { $item.RecipientDomainIs } } } }, @{ Name = 'State'; Expression = { foreach ($item in $Rules) { if ($item.MalwareFilterPolicy -eq $_.Name) { $item.State } } } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Output diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListSafeAttachmentsFilters.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListSafeAttachmentsFilters.ps1 index a383be0dbb3e..1e0d39b2ea83 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListSafeAttachmentsFilters.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListSafeAttachmentsFilters.ps1 @@ -7,11 +7,6 @@ function Invoke-ListSafeAttachmentsFilters { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter $Policies = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Get-SafeAttachmentPolicy' | Select-Object -Property * @@ -23,7 +18,6 @@ function Invoke-ListSafeAttachmentsFilters { @{ Name = 'RecipientDomainIs'; Expression = { foreach ($item in $Rules) { if ($item.SafeAttachmentPolicy -eq $_.Name) { $item.RecipientDomainIs } } } }, @{ Name = 'State'; Expression = { foreach ($item in $Rules) { if ($item.SafeAttachmentPolicy -eq $_.Name) { $item.State } } } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Output diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListSharedMailboxAccountEnabled.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListSharedMailboxAccountEnabled.ps1 index 9a2a14e6d1aa..404da4812109 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListSharedMailboxAccountEnabled.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Reports/Invoke-ListSharedMailboxAccountEnabled.ps1 @@ -11,10 +11,6 @@ function Invoke-ListSharedMailboxAccountEnabled { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - $TenantFilter = $Request.Query.tenantFilter # Get Shared Mailbox Stuff @@ -45,7 +41,6 @@ function Invoke-ListSharedMailboxAccountEnabled { Write-LogMessage -API $APIName -tenant $TenantFilter -message "Shared Mailbox List on $($TenantFilter). Error: $($_.exception.message)" -sev 'Error' } $GraphRequest = $SharedMailboxDetails - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddEquipmentMailbox.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddEquipmentMailbox.ps1 index 9924645a056d..d18593aa7ea6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddEquipmentMailbox.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddEquipmentMailbox.ps1 @@ -53,7 +53,6 @@ Function Invoke-AddEquipmentMailbox { $Body = [pscustomobject]@{ 'Results' = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddRoomList.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddRoomList.ps1 index f21a07376a6f..fd4ee1fc5495 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddRoomList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddRoomList.ps1 @@ -49,7 +49,6 @@ Function Invoke-AddRoomList { } $Body = [pscustomobject] @{ 'Results' = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddRoomMailbox.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddRoomMailbox.ps1 index 4dc080fcc970..446ea831c80a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddRoomMailbox.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-AddRoomMailbox.ps1 @@ -48,7 +48,6 @@ Function Invoke-AddRoomMailbox { } $Body = [pscustomobject] @{ 'Results' = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditEquipmentMailbox.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditEquipmentMailbox.ps1 index 9a7c495597c8..8fda335af8a6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditEquipmentMailbox.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditEquipmentMailbox.ps1 @@ -107,7 +107,6 @@ Function Invoke-EditEquipmentMailbox { $Body = [pscustomobject]@{ 'Results' = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomList.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomList.ps1 index 830de93bce1a..90ba0898e203 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomList.ps1 @@ -169,7 +169,6 @@ Function Invoke-EditRoomList { Write-LogMessage -headers $Headers -API $APIName -tenant $TenantId -message "Failed to edit room list: $($_.Exception.Message)" -Sev 'Error' } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{'Results' = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomMailbox.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomMailbox.ps1 index 7ba5e3396e68..921ca1d98d7c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomMailbox.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomMailbox.ps1 @@ -11,9 +11,6 @@ Function Invoke-EditRoomMailbox { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Tenant = $Request.Body.tenantID @@ -117,7 +114,6 @@ Function Invoke-EditRoomMailbox { $Body = [pscustomobject]@{ 'Results' = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListEquipment.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListEquipment.ps1 index 05827b9d9a34..c52c4bb5a0d1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListEquipment.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListEquipment.ps1 @@ -9,11 +9,6 @@ function Invoke-ListEquipment { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $EquipmentId = $Request.Query.EquipmentId $Tenant = $Request.Query.TenantFilter @@ -91,7 +86,6 @@ function Invoke-ListEquipment { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Results | Sort-Object displayName) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRoomLists.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRoomLists.ps1 index b0ac834f71c6..0c9bc293d3e9 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRoomLists.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRoomLists.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListRoomLists { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $GroupID = $Request.Query.groupID @@ -108,7 +103,6 @@ Function Invoke-ListRoomLists { $ResponseBody = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $ResponseBody diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRooms.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRooms.ps1 index 6bec38bb70c4..9e036b8534ff 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRooms.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRooms.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListRooms { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $RoomId = $Request.Query.roomId @@ -173,7 +168,6 @@ Function Invoke-ListRooms { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest | Sort-Object displayName) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddQuarantinePolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddQuarantinePolicy.ps1 index 0c3b48af23dd..1d65a1d76538 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddQuarantinePolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddQuarantinePolicy.ps1 @@ -58,7 +58,6 @@ Function Invoke-AddQuarantinePolicy { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{Results = @($Result) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddSpamFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddSpamFilter.ps1 index a1550683e923..2b391b49e029 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddSpamFilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddSpamFilter.ps1 @@ -40,7 +40,6 @@ Function Invoke-AddSpamFilter { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{Results = @($Result) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddSpamFilterTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddSpamFilterTemplate.ps1 index b53d770762bb..5b701544ffa5 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddSpamFilterTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddSpamFilterTemplate.ps1 @@ -44,7 +44,6 @@ Function Invoke-AddSpamFilterTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddTenantAllowBlockList.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddTenantAllowBlockList.ps1 index 48d1ff951a25..ee53a1d1b0e8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddTenantAllowBlockList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-AddTenantAllowBlockList.ps1 @@ -11,9 +11,6 @@ Function Invoke-AddTenantAllowBlockList { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $BlockListObject = $Request.Body if ($Request.Body.tenantId -eq 'AllTenants') { $Tenants = (Get-Tenants).defaultDomainName } else { $Tenants = @($Request.body.tenantId) } $Results = [System.Collections.Generic.List[string]]::new() @@ -52,7 +49,6 @@ Function Invoke-AddTenantAllowBlockList { Write-LogMessage -headers $Request.Headers -API $APIName -tenant $Tenant -message $result -Sev 'Error' } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{ diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditAntiPhishingFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditAntiPhishingFilter.ps1 index a7c31ef6284d..f8fe23dadea5 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditAntiPhishingFilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditAntiPhishingFilter.ps1 @@ -49,7 +49,6 @@ function Invoke-EditAntiPhishingFilter { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditMalwareFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditMalwareFilter.ps1 index 42d2b588df7d..abb210506e71 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditMalwareFilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditMalwareFilter.ps1 @@ -49,7 +49,6 @@ function Invoke-EditMalwareFilter { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditQuarantinePolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditQuarantinePolicy.ps1 index 93fd2cad11cc..f242fd2705c2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditQuarantinePolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditQuarantinePolicy.ps1 @@ -70,7 +70,6 @@ Function Invoke-EditQuarantinePolicy { Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message $Result -Sev Error -LogData $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSafeAttachmentsFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSafeAttachmentsFilter.ps1 index dbae4c645c86..9f34e4b143a3 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSafeAttachmentsFilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSafeAttachmentsFilter.ps1 @@ -49,7 +49,6 @@ function Invoke-EditSafeAttachmentsFilter { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 index 90d0b07b18f1..ce85cc37fd9c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 @@ -11,9 +11,6 @@ Function Invoke-EditSpamFilter { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $request.Query.tenantFilter $Name = $Request.Query.name ?? $Request.Body.name $State = $State ?? $Request.Body.state @@ -33,7 +30,6 @@ Function Invoke-EditSpamFilter { Write-LogMessage -headers $Request.Headers -API $APIName -tenant $TenantFilter -message $Result -Sev 'Error' -LogData $ErrorMessage $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ExecQuarantineManagement.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ExecQuarantineManagement.ps1 index 017824c6bd9d..00ce1f490fb6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ExecQuarantineManagement.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ExecQuarantineManagement.ps1 @@ -11,13 +11,6 @@ function Invoke-ExecQuarantineManagement { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - - # Interact with query parameters or the body of the request. try { $TenantFilter = $Request.Body.tenantFilter | Select-Object -First 1 @@ -38,7 +31,6 @@ function Invoke-ExecQuarantineManagement { Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $TenantFilter -message "Quarantine Management failed: $($_.Exception.Message)" -Sev 'Error' -LogData $_ $Results = [pscustomobject]@{'Results' = "Failed. $($_.Exception.Message)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListConnectionFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListConnectionFilter.ps1 index ca46b6a98a9d..c590b38ca0e9 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListConnectionFilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListConnectionFilter.ps1 @@ -9,10 +9,6 @@ Function Invoke-ListConnectionFilter { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $Tenantfilter = $request.Query.tenantfilter try { @@ -24,7 +20,6 @@ Function Invoke-ListConnectionFilter { $Policies = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Policies) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListConnectionFilterTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListConnectionFilterTemplates.ps1 index fad20fe687c0..a3f93e8e8ba2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListConnectionFilterTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListConnectionFilterTemplates.ps1 @@ -9,10 +9,6 @@ Function Invoke-ListConnectionFilterTemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $Table = Get-CippTable -tablename 'templates' #List new policies @@ -28,7 +24,6 @@ Function Invoke-ListConnectionFilterTemplates { if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property RowKey -EQ $Request.query.id } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Templates) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantine.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantine.ps1 index 47611c44ac46..b01f46feebf4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantine.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantine.ps1 @@ -7,11 +7,6 @@ function Invoke-ListMailQuarantine { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -85,7 +80,6 @@ function Invoke-ListMailQuarantine { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantineMessage.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantineMessage.ps1 index 9343e84fcbe7..d83c59360755 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantineMessage.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantineMessage.ps1 @@ -7,11 +7,6 @@ function Invoke-ListMailQuarantineMessage { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $Identity = $Request.Query.Identity @@ -31,7 +26,6 @@ function Invoke-ListMailQuarantineMessage { $Body = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListQuarantinePolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListQuarantinePolicy.ps1 index ef4b22abae01..79ef6d2c172f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListQuarantinePolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListQuarantinePolicy.ps1 @@ -7,11 +7,6 @@ function Invoke-ListQuarantinePolicy { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter ?? $Request.body.TenantFilter $QuarantinePolicyType = $Request.Query.Type ?? 'QuarantinePolicy' @@ -35,7 +30,6 @@ function Invoke-ListQuarantinePolicy { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Policies) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListSpamFilterTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListSpamFilterTemplates.ps1 index 3eaaddddad9b..80d7e607b049 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListSpamFilterTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListSpamFilterTemplates.ps1 @@ -9,10 +9,6 @@ Function Invoke-ListSpamFilterTemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $Table = Get-CippTable -tablename 'templates' #List new policies @@ -28,7 +24,6 @@ Function Invoke-ListSpamFilterTemplates { if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property RowKey -EQ $Request.query.id } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Templates) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListSpamfilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListSpamfilter.ps1 index 2c78c1f1c90a..11ece29dc634 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListSpamfilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListSpamfilter.ps1 @@ -9,10 +9,6 @@ Function Invoke-ListSpamfilter { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $Tenantfilter = $request.Query.tenantfilter try { @@ -26,7 +22,6 @@ Function Invoke-ListSpamfilter { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveConnectionfilterTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveConnectionfilterTemplate.ps1 index af77ee0fd2ce..0c87e034e81c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveConnectionfilterTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveConnectionfilterTemplate.ps1 @@ -31,7 +31,6 @@ Function Invoke-RemoveConnectionfilterTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveQuarantinePolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveQuarantinePolicy.ps1 index 33c7b3d8a640..95a2410fc41f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveQuarantinePolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveQuarantinePolicy.ps1 @@ -36,7 +36,6 @@ Function Invoke-RemoveQuarantinePolicy { $StatusCode = [HttpStatusCode]::OK - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 index 1e6c61695fad..0137fa6f6916 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 @@ -34,7 +34,6 @@ Function Invoke-RemoveSpamfilter { Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message $Result -Sev Error -LogData $ErrorMessage $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilterTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilterTemplate.ps1 index e7f77c6cf067..9fafc2ace80a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilterTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilterTemplate.ps1 @@ -31,7 +31,6 @@ Function Invoke-RemoveSpamfilterTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ExecMailTest.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ExecMailTest.ps1 index 194020652c22..7284192b3af8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ExecMailTest.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ExecMailTest.ps1 @@ -8,11 +8,6 @@ Function Invoke-ExecMailTest { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { switch ($Request.Query.Action) { 'CheckConfig' { @@ -82,7 +77,6 @@ Function Invoke-ExecMailTest { Results = @($ErrorMessage) } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ExecMailboxRestore.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ExecMailboxRestore.ps1 index 2163043158a8..261387c348bf 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ExecMailboxRestore.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ExecMailboxRestore.ps1 @@ -6,11 +6,6 @@ function Invoke-ExecMailboxRestore { Exchange.Mailbox.ReadWrite #> Param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { switch ($Request.Query.Action) { 'Remove' { @@ -123,7 +118,6 @@ function Invoke-ExecMailboxRestore { colour = 'danger' } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListExoRequest.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListExoRequest.ps1 index 3d8dae57d7f7..84b8abd072ca 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListExoRequest.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListExoRequest.ps1 @@ -1,10 +1,5 @@ function Invoke-ListExoRequest { param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $AllowedVerbs = @( 'Get' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListMailboxRestores.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListMailboxRestores.ps1 index 44020a7861a1..bb1dff0b0cfb 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListMailboxRestores.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListMailboxRestores.ps1 @@ -6,11 +6,6 @@ function Invoke-ListMailboxRestores { Exchange.Mailbox.Read #> param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter try { @@ -42,7 +37,6 @@ function Invoke-ListMailboxRestores { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListMessageTrace.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListMessageTrace.ps1 index 51642023c1a0..0a5fcac61490 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListMessageTrace.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Tools/Invoke-ListMessageTrace.ps1 @@ -11,9 +11,6 @@ function Invoke-ListMessageTrace { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $TenantFilter = $Request.Body.tenantFilter @@ -78,7 +75,6 @@ function Invoke-ListMessageTrace { $trace = @{Status = "Failed to retrieve message trace $($_.Exception.Message)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($trace) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddConnectionFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddConnectionFilter.ps1 index e8f30651ec24..7a9dc2eadfd8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddConnectionFilter.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddConnectionFilter.ps1 @@ -32,7 +32,6 @@ Function Invoke-AddConnectionFilter { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{Results = @($Result) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddConnectionFilterTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddConnectionFilterTemplate.ps1 index 6f393cca09cb..b6d88c56f4c2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddConnectionFilterTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddConnectionFilterTemplate.ps1 @@ -47,7 +47,6 @@ function Invoke-AddConnectionFilterTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddExConnector.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddExConnector.ps1 index b8486cfe3994..b17d9b065c79 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddExConnector.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddExConnector.ps1 @@ -40,7 +40,6 @@ function Invoke-AddExConnector { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{Results = @($Result) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddExConnectorTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddExConnectorTemplate.ps1 index 21d620a91eff..59aea3c727aa 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddExConnectorTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddExConnectorTemplate.ps1 @@ -52,7 +52,6 @@ Function Invoke-AddExConnectorTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportRule.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportRule.ps1 index 62d6e713755f..1c4f894e4c7f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportRule.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportRule.ps1 @@ -48,7 +48,6 @@ function Invoke-AddTransportRule { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{Results = @($Result) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportTemplate.ps1 index 2d3553376c99..8087ba47ca38 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportTemplate.ps1 @@ -46,7 +46,6 @@ Function Invoke-AddTransportTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-EditExConnector.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-EditExConnector.ps1 index 0d24db1a89cc..12458bcca200 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-EditExConnector.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-EditExConnector.ps1 @@ -34,7 +34,6 @@ function Invoke-EditExConnector { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-EditTransportRule.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-EditTransportRule.ps1 index c821160a3b46..38fed2114ce4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-EditTransportRule.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-EditTransportRule.ps1 @@ -35,7 +35,6 @@ function Invoke-EditTransportRule { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ExecNewTransportRule.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ExecNewTransportRule.ps1 index 37cb5aa281d5..f211d5ab5b43 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ExecNewTransportRule.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ExecNewTransportRule.ps1 @@ -445,7 +445,6 @@ function Invoke-ExecNewTransportRule { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExConnectorTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExConnectorTemplates.ps1 index 13fc1dc0161f..211116890062 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExConnectorTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExConnectorTemplates.ps1 @@ -9,10 +9,6 @@ Function Invoke-ListExConnectorTemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $Table = Get-CippTable -tablename 'templates' #List new policies @@ -30,7 +26,6 @@ Function Invoke-ListExConnectorTemplates { if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property RowKey -EQ $Request.query.id } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Templates) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExchangeConnectors.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExchangeConnectors.ps1 index 06a49ddd2a37..8d3717f2ef51 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExchangeConnectors.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExchangeConnectors.ps1 @@ -9,10 +9,6 @@ function Invoke-ListExchangeConnectors { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $TenantFilter = $request.Query.tenantFilter $Results = try { @@ -25,7 +21,6 @@ function Invoke-ListExchangeConnectors { $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListTransportRules.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListTransportRules.ps1 index fd167092c7f4..77993fbee10e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListTransportRules.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListTransportRules.ps1 @@ -9,11 +9,6 @@ function Invoke-ListTransportRules { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -85,7 +80,6 @@ function Invoke-ListTransportRules { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListTransportRulesTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListTransportRulesTemplates.ps1 index 7a95bcbdfb79..c7355d11fb09 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListTransportRulesTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListTransportRulesTemplates.ps1 @@ -9,10 +9,6 @@ Function Invoke-ListTransportRulesTemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $Table = Get-CippTable -tablename 'templates' $Templates = Get-ChildItem 'Config\*.TransportRuleTemplate.json' | ForEach-Object { @@ -40,7 +36,6 @@ Function Invoke-ListTransportRulesTemplates { if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property RowKey -EQ $Request.query.id } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Templates) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveExConnector.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveExConnector.ps1 index b1faa62196ca..bb7e353f5c3f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveExConnector.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveExConnector.ps1 @@ -30,7 +30,6 @@ Function Invoke-RemoveExConnector { $Result = $ErrorMessage.NormalizedError $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveExConnectorTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveExConnectorTemplate.ps1 index f0997ba5032d..2e72587c9855 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveExConnectorTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveExConnectorTemplate.ps1 @@ -31,7 +31,6 @@ Function Invoke-RemoveExConnectorTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveTransportRule.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveTransportRule.ps1 index d0887d06d496..60f72357d1de 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveTransportRule.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveTransportRule.ps1 @@ -34,7 +34,6 @@ Function Invoke-RemoveTransportRule { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveTransportRuleTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveTransportRuleTemplate.ps1 index 2a08ded4cdec..c36b86aec5f2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveTransportRuleTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-RemoveTransportRuleTemplate.ps1 @@ -31,7 +31,6 @@ Function Invoke-RemoveTransportRuleTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddChocoApp.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddChocoApp.ps1 index d203b0dcf6e5..fc4712750daf 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddChocoApp.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddChocoApp.ps1 @@ -25,6 +25,9 @@ Function Invoke-AddChocoApp { if ($ChocoApp.customrepo) { $intuneBody.installCommandLine = $intuneBody.installCommandLine + " -CustomRepo $($ChocoApp.CustomRepo)" } + if ($ChocoApp.customArguments) { + $intuneBody.installCommandLine = $intuneBody.installCommandLine + " -CustomArguments '$($ChocoApp.customArguments)'" + } $intuneBody.UninstallCommandLine = "powershell.exe -ExecutionPolicy Bypass .\Uninstall.ps1 -Packagename $($ChocoApp.PackageName)" $intuneBody.detectionRules[0].path = "$($ENV:SystemDrive)\programdata\chocolatey\lib" $intuneBody.detectionRules[0].fileOrFolderName = "$($ChocoApp.PackageName)" @@ -32,12 +35,18 @@ Function Invoke-AddChocoApp { $Tenants = $Request.Body.selectedTenants.defaultDomainName $Results = foreach ($Tenant in $Tenants) { try { + # Apply CIPP text replacement for tenant-specific variables + $TenantIntuneBody = $intuneBody | ConvertTo-Json -Depth 15 | ConvertFrom-Json + if ($TenantIntuneBody.installCommandLine -match '%') { + $TenantIntuneBody.installCommandLine = Get-CIPPTextReplacement -TenantFilter $Tenant -Text $TenantIntuneBody.installCommandLine + } + $CompleteObject = [PSCustomObject]@{ tenant = $Tenant ApplicationName = $ChocoApp.ApplicationName assignTo = $AssignTo InstallationIntent = $Request.Body.InstallationIntent - IntuneBody = $intuneBody + IntuneBody = $TenantIntuneBody } | ConvertTo-Json -Depth 15 $Table = Get-CippTable -tablename 'apps' $Table.Force = $true @@ -56,7 +65,6 @@ Function Invoke-AddChocoApp { $body = [PSCustomObject]@{'Results' = $Results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddMSPApp.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddMSPApp.ps1 index cb58bc42f08f..ec28ce9828d4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddMSPApp.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddMSPApp.ps1 @@ -87,7 +87,6 @@ function Invoke-AddMSPApp { $body = [PSCustomObject]@{'Results' = $Results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddOfficeApp.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddOfficeApp.ps1 index 65660392b5df..47093a65d22b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddOfficeApp.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddOfficeApp.ps1 @@ -10,11 +10,6 @@ Function Invoke-AddOfficeApp { [CmdletBinding()] param($Request, $TriggerMetadata) - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Input bindings are passed in via param block. $Tenants = $Request.body.selectedTenants.defaultDomainName if ('AllTenants' -in $Tenants) { $Tenants = (Get-Tenants).defaultDomainName } @@ -24,51 +19,74 @@ Function Invoke-AddOfficeApp { try { $ExistingO365 = New-graphGetRequest -Uri 'https://graph.microsoft.com/beta/deviceAppManagement/mobileApps' -tenantid $tenant | Where-Object { $_.displayname -eq 'Microsoft 365 Apps for Windows 10 and later' } if (!$ExistingO365) { - $Arch = if ($request.body.arch) { 'x64' } else { 'x86' } - $products = @('o365ProPlusRetail') - $ExcludedApps = [pscustomobject]@{ - infoPath = $true - sharePointDesigner = $true - excel = $false - lync = $false - oneNote = $false - outlook = $false - powerPoint = $false - publisher = $false - teams = $false - word = $false - access = $false - bing = $false - } - foreach ($ExcludedApp in $request.body.excludedApps.value) { - $ExcludedApps.$excludedapp = $true + # Check if custom XML is provided + if ($request.body.useCustomXml -and $request.body.customXml) { + # Use custom XML configuration + $ObjBody = [pscustomobject]@{ + '@odata.type' = '#microsoft.graph.officeSuiteApp' + 'displayName' = 'Microsoft 365 Apps for Windows 10 and later' + 'description' = 'Microsoft 365 Apps for Windows 10 and later' + 'informationUrl' = 'https://products.office.com/en-us/explore-office-for-home' + 'isFeatured' = $true + 'publisher' = 'Microsoft' + 'notes' = '' + 'owner' = 'Microsoft' + 'officeConfigurationXml' = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($request.body.customXml)) + 'largeIcon' = @{ + 'type' = 'image/png' + 'value' = 'iVBORw0KGgoAAAANSUhEUgAAAF0AAAAeCAMAAAEOZNKlAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJhUExURf////7z7/i9qfF1S/KCW/i+qv3q5P/9/PrQwfOMae1RG+s8AOxGDfBtQPWhhPvUx/759/zg1vWgg+9fLu5WIvKFX/rSxP728/nCr/FyR+tBBvOMaO1UH+1RHOs+AvSScP3u6f/+/v3s5vzg1+xFDO9kNPOOa/i7pvzj2/vWyes9Af76+Pzh2PrTxf/6+f7y7vOGYexHDv3t5+1SHfi8qPOIZPvb0O1NFuxDCe9hMPSVdPnFs/3q4/vaz/STcu5VIe5YJPWcfv718v/9/e1MFfF4T/F4TvF2TP3o4exECvF0SexIEPONavzn3/vZze1QGvF3Te5dK+5cKvrPwPrQwvKAWe1OGPexmexKEveulfezm/BxRfamiuxLE/apj/zf1e5YJfSXd/OHYv3r5feznPakiPze1P7x7f739f3w6+xJEfnEsvWdf/Wfge1LFPe1nu9iMvnDsfBqPOs/BPOIY/WZevJ/V/zl3fnIt/vTxuxHD+xEC+9mN+5ZJv749vBpO/KBWvBwRP/8+/SUc/etlPjArP/7+vOLZ/F7UvWae/708e1OF/aihvSWdvi8p+tABfSZefvVyPWihfSVde9lNvami+9jM/zi2fKEXvBuQvOKZvalifF5UPJ/WPSPbe9eLfrKuvvd0uxBB/7w7Pzj2vrRw/rOv+1PGfi/q/eymu5bKf3n4PnJuPBrPf3t6PWfgvWegOxCCO9nOO9oOfaskvSYePi5pPi2oPnGtO5eLPevlvKDXfrNvv739Pzd0/708O9gL+9lNfJ9VfrLu/OPbPnDsPBrPus+A/nArfarkQAAAGr5HKgAAADLdFJOU/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AvuakogAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAz5JREFUOE+tVTtu4zAQHQjppmWzwIJbEVCzpTpjbxD3grQHSOXKRXgCAT6EC7UBVAmp3KwBnmvfzNCyZTmxgeTZJsXx43B+HBHRE34ZkXgkerXFTheeiCkRrbB4UXmp4wSWz5raaQEMTM5TZwuiXoaKgV+6FsmkZQcSy0kA71yMTMGHanX+AzMMGLAQCxU1F/ZwjULPugazl82GM0NEKm/U8EqFwEkO3/EAT4grgl0nucwlk9pcpTTJ4VPA4g/Rb3yIRhhp507e9nTQmZ1OS5RO4sS7nIRPEeHXCHdkw9ZEW2yVE5oIS7peD58Avs7CN+PVCmHh21oOqBdjDzIs+FldPJ74TFESUSJEfVzy9U/dhu+AuOT6eBp6gGKyXEx8euO450ZE4CMfstMFT44broWw/itkYErWXRx+fFArt9Ca9os78TFed0LVIUsmIHrwbwaw3BEOnOk94qVpQ6Ka2HjxewJnfyd6jUtGDQLdWlzmYNYLeKbbGOucJsNabCq1Yub0o92rtR+i30V2dapxYVEePXcOjeCKPnYyit7BtKeNlZqHbr+gt7i+AChWA9RsRs03pxTQc67ouWpxyESvjK5Vs3DVSy3IpkxPm5X+wZoBi+MFHWW69/w8FRhc7VBe6HAhMB2b8Q0XqDzTNZtXUMnKMjwKVaCrB/CSUL7WSx/HsdJC86lFGXwnioTeOMPjV+szlFvrZLA5VMVK4y+41l4e1xfx7Z88o4hkilRUH/qKqwNVlgDgpvYCpH3XwAy5eMCRnezIUxffVXoDql2rTHFDO+pjWnTWzAfrYXn6BFECblUpWGrvPZvBipETjS5ydM7tdXpH41ZCEbBNy/+wFZu71QO2t9pgT+iZEf657Q1vpN94PQNDxUHeKR103LV9nPVOtDikcNKO+2naCw7yKBhOe9Hm79pe8C4/CfC2wDjXnqC94kEeBU3WwN7dt/2UScXas7zDl5GpkY+M8WKv2J7fd4Ib2rGTk+jsC2cleEM7jI9veF7B0MBJrsZqfKd/81q9pR2NZfwJK2JzsmIT1Ns8jUH0UusQBpU8d2JzsHiXg1zXGLqxfitUNTDT/nUUeqDBp2HZVr+Ocqi/Ty3Rf4Jn82xxfSNtAAAAAElFTkSuQmCC' + } + } } - $ObjBody = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.officeSuiteApp' - 'displayName' = 'Microsoft 365 Apps for Windows 10 and later' - 'description' = 'Microsoft 365 Apps for Windows 10 and later' - 'informationUrl' = 'https://products.office.com/en-us/explore-office-for-home' - 'isFeatured' = $true - 'publisher' = 'Microsoft' - 'notes' = '' - 'owner' = 'Microsoft' - 'autoAcceptEula' = [bool]$request.body.AcceptLicense - 'excludedApps' = $ExcludedApps - 'officePlatformArchitecture' = $Arch - 'officeSuiteAppDefaultFileFormat' = 'OfficeOpenXMLFormat' - 'localesToInstall' = @($request.body.languages.value) - 'shouldUninstallOlderVersionsOfOffice' = [bool]$request.body.RemoveVersions - 'updateChannel' = $request.body.updateChannel.value - 'useSharedComputerActivation' = [bool]$request.body.SharedComputerActivation - 'productIds' = $products - 'largeIcon' = @{ - 'type' = 'image/png' - 'value' = 'iVBORw0KGgoAAAANSUhEUgAAAF0AAAAeCAMAAAEOZNKlAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJhUExURf////7z7/i9qfF1S/KCW/i+qv3q5P/9/PrQwfOMae1RG+s8AOxGDfBtQPWhhPvUx/759/zg1vWgg+9fLu5WIvKFX/rSxP728/nCr/FyR+tBBvOMaO1UH+1RHOs+AvSScP3u6f/+/v3s5vzg1+xFDO9kNPOOa/i7pvzj2/vWyes9Af76+Pzh2PrTxf/6+f7y7vOGYexHDv3t5+1SHfi8qPOIZPvb0O1NFuxDCe9hMPSVdPnFs/3q4/vaz/STcu5VIe5YJPWcfv718v/9/e1MFfF4T/F4TvF2TP3o4exECvF0SexIEPONavzn3/vZze1QGvF3Te5dK+5cKvrPwPrQwvKAWe1OGPexmexKEveulfezm/BxRfamiuxLE/apj/zf1e5YJfSXd/OHYv3r5feznPakiPze1P7x7f739f3w6+xJEfnEsvWdf/Wfge1LFPe1nu9iMvnDsfBqPOs/BPOIY/WZevJ/V/zl3fnIt/vTxuxHD+xEC+9mN+5ZJv749vBpO/KBWvBwRP/8+/SUc/etlPjArP/7+vOLZ/F7UvWae/708e1OF/aihvSWdvi8p+tABfSZefvVyPWihfSVde9lNvami+9jM/zi2fKEXvBuQvOKZvalifF5UPJ/WPSPbe9eLfrKuvvd0uxBB/7w7Pzj2vrRw/rOv+1PGfi/q/eymu5bKf3n4PnJuPBrPf3t6PWfgvWegOxCCO9nOO9oOfaskvSYePi5pPi2oPnGtO5eLPevlvKDXfrNvv739Pzd0/708O9gL+9lNfJ9VfrLu/OPbPnDsPBrPus+A/nArfarkQAAAGr5HKgAAADLdFJOU/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AvuakogAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAz5JREFUOE+tVTtu4zAQHQjppmWzwIJbEVCzpTpjbxD3grQHSOXKRXgCAT6EC7UBVAmp3KwBnmvfzNCyZTmxgeTZJsXx43B+HBHRE34ZkXgkerXFTheeiCkRrbB4UXmp4wSWz5raaQEMTM5TZwuiXoaKgV+6FsmkZQcSy0kA71yMTMGHanX+AzMMGLAQCxU1F/ZwjULPugazl82GM0NEKm/U8EqFwEkO3/EAT4grgl0nucwlk9pcpTTJ4VPA4g/Rb3yIRhhp507e9nTQmZ1OS5RO4sS7nIRPEeHXCHdkw9ZEW2yVE5oIS7peD58Avs7CN+PVCmHh21oOqBdjDzIs+FldPJ74TFESUSJEfVzy9U/dhu+AuOT6eBp6gGKyXEx8euO450ZE4CMfstMFT44broWw/itkYErWXRx+fFArt9Ca9os78TFed0LVIUsmIHrwbwaw3BEOnOk94qVpQ6Ka2HjxewJnfyd6jUtGDQLdWlzmYNYLeKbbGOucJsNabCq1Yub0o92rtR+i30V2dapxYVEePXcOjeCKPnYyit7BtKeNlZqHbr+gt7i+AChWA9RsRs03pxTQc67ouWpxyESvjK5Vs3DVSy3IpkxPm5X+wZoBi+MFHWW69/w8FRhc7VBe6HAhMB2b8Q0XqDzTNZtXUMnKMjwKVaCrB/CSUL7WSx/HsdJC86lFGXwnioTeOMPjV+szlFvrZLA5VMVK4y+41l4e1xfx7Z88o4hkilRUH/qKqwNVlgDgpvYCpH3XwAy5eMCRnezIUxffVXoDql2rTHFDO+pjWnTWzAfrYXn6BFECblUpWGrvPZvBipETjS5ydM7tdXpH41ZCEbBNy/+wFZu71QO2t9pgT+iZEf657Q1vpN94PQNDxUHeKR103LV9nPVOtDikcNKO+2naCw7yKBhOe9Hm79pe8C4/CfC2wDjXnqC94kEeBU3WwN7dt/2UScXas7zDl5GpkY+M8WKv2J7fd4Ib2rGTk+jsC2cleEM7jI9veF7B0MBJrsZqfKd/81q9pR2NZfwJK2JzsmIT1Ns8jUH0UusQBpU8d2JzsHiXg1zXGLqxfitUNTDT/nUUeqDBp2HZVr+Ocqi/Ty3Rf4Jn82xxfSNtAAAAAElFTkSuQmCC' + else { + # Use standard configuration + $Arch = if ($request.body.arch) { 'x64' } else { 'x86' } + $products = @('o365ProPlusRetail') + $ExcludedApps = [pscustomobject]@{ + infoPath = $true + sharePointDesigner = $true + excel = $false + lync = $false + oneNote = $false + outlook = $false + powerPoint = $false + publisher = $false + teams = $false + word = $false + access = $false + bing = $false + } + foreach ($ExcludedApp in $request.body.excludedApps.value) { + $ExcludedApps.$excludedapp = $true + } + $ObjBody = [pscustomobject]@{ + '@odata.type' = '#microsoft.graph.officeSuiteApp' + 'displayName' = 'Microsoft 365 Apps for Windows 10 and later' + 'description' = 'Microsoft 365 Apps for Windows 10 and later' + 'informationUrl' = 'https://products.office.com/en-us/explore-office-for-home' + 'isFeatured' = $true + 'publisher' = 'Microsoft' + 'notes' = '' + 'owner' = 'Microsoft' + 'autoAcceptEula' = [bool]$request.body.AcceptLicense + 'excludedApps' = $ExcludedApps + 'officePlatformArchitecture' = $Arch + 'officeSuiteAppDefaultFileFormat' = 'OfficeOpenXMLFormat' + 'localesToInstall' = @($request.body.languages.value) + 'shouldUninstallOlderVersionsOfOffice' = [bool]$request.body.RemoveVersions + 'updateChannel' = $request.body.updateChannel.value + 'useSharedComputerActivation' = [bool]$request.body.SharedComputerActivation + 'productIds' = $products + 'largeIcon' = @{ + 'type' = 'image/png' + 'value' = 'iVBORw0KGgoAAAANSUhEUgAAAF0AAAAeCAMAAAEOZNKlAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJhUExURf////7z7/i9qfF1S/KCW/i+qv3q5P/9/PrQwfOMae1RG+s8AOxGDfBtQPWhhPvUx/759/zg1vWgg+9fLu5WIvKFX/rSxP728/nCr/FyR+tBBvOMaO1UH+1RHOs+AvSScP3u6f/+/v3s5vzg1+xFDO9kNPOOa/i7pvzj2/vWyes9Af76+Pzh2PrTxf/6+f7y7vOGYexHDv3t5+1SHfi8qPOIZPvb0O1NFuxDCe9hMPSVdPnFs/3q4/vaz/STcu5VIe5YJPWcfv718v/9/e1MFfF4T/F4TvF2TP3o4exECvF0SexIEPONavzn3/vZze1QGvF3Te5dK+5cKvrPwPrQwvKAWe1OGPexmexKEveulfezm/BxRfamiuxLE/apj/zf1e5YJfSXd/OHYv3r5feznPakiPze1P7x7f739f3w6+xJEfnEsvWdf/Wfge1LFPe1nu9iMvnDsfBqPOs/BPOIY/WZevJ/V/zl3fnIt/vTxuxHD+xEC+9mN+5ZJv749vBpO/KBWvBwRP/8+/SUc/etlPjArP/7+vOLZ/F7UvWae/708e1OF/aihvSWdvi8p+tABfSZefvVyPWihfSVde9lNvami+9jM/zi2fKEXvBuQvOKZvalifF5UPJ/WPSPbe9eLfrKuvvd0uxBB/7w7Pzj2vrRw/rOv+1PGfi/q/eymu5bKf3n4PnJuPBrPf3t6PWfgvWegOxCCO9nOO9oOfaskvSYePi5pPi2oPnGtO5eLPevlvKDXfrNvv739Pzd0/708O9gL+9lNfJ9VfrLu/OPbPnDsPBrPus+A/nArfarkQAAAGr5HKgAAADLdFJOU/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AvuakogAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAz5JREFUOE+tVTtu4zAQHQjppmWzwIJbEVCzpTpjbxD3grQHSOXKRXgCAT6EC7UBVAmp3KwBnmvfzNCyZTmxgeTZJsXx43B+HBHRE34ZkXgkerXFTheeiCkRrbB4UXmp4wSWz5raaQEMTM5TZwuiXoaKgV+6FsmkZQcSy0kA71yMTMGHanX+AzMMGLAQCxU1F/ZwjULPugazl82GM0NEKm/U8EqFwEkO3/EAT4grgl0nucwlk9pcpTTJ4VPA4g/Rb3yIRhhp507e9nTQmZ1OS5RO4sS7nIRPEeHXCHdkw9ZEW2yVE5oIS7peD58Avs7CN+PVCmHh21oOqBdjDzIs+FldPJ74TFESUSJEfVzy9U/dhu+AuOT6eBp6gGKyXEx8euO450ZE4CMfstMFT44broWw/itkYErWXRx+fFArt9Ca9os78TFed0LVIUsmIHrwbwaw3BEOnOk94qVpQ6Ka2HjxewJnfyd6jUtGDQLdWlzmYNYLeKbbGOucJsNabCq1Yub0o92rtR+i30V2dapxYVEePXcOjeCKPnYyit7BtKeNlZqHbr+gt7i+AChWA9RsRs03pxTQc67ouWpxyESvjK5Vs3DVSy3IpkxPm5X+wZoBi+MFHWW69/w8FRhc7VBe6HAhMB2b8Q0XqDzTNZtXUMnKMjwKVaCrB/CSUL7WSx/HsdJC86lFGXwnioTeOMPjV+szlFvrZLA5VMVK4y+41l4e1xfx7Z88oXLhMo/hbYyqDV3FGjfD+Atbk7YjJAy9h/F4fWNbC6lwKUrhVUBPnPCDDsL0A/mLWxujCLvx4hE/VhOTf8j/C3kf3PWRqJKUAAAAASUVORK5CYII=' + } } } Write-Host ($ObjBody | ConvertTo-Json -Compress) $OfficeAppID = New-graphPostRequest -Uri 'https://graph.microsoft.com/beta/deviceAppManagement/mobileApps' -tenantid $tenant -Body (ConvertTo-Json -InputObject $ObjBody -Depth 10) -type POST - } else { + } + else { "Office deployment already exists for $($Tenant)" Continue } @@ -79,7 +97,8 @@ Function Invoke-AddOfficeApp { Write-LogMessage -headers $Request.Headers -API $APIName -tenant $($tenant) -message "Assigned Office to $AssignTo" -Sev 'Info' } "Successfully added Office App for $($Tenant)" - } catch { + } + catch { "Failed to add Office App for $($Tenant): $($_.Exception.Message)" Write-LogMessage -headers $Request.Headers -API $APIName -tenant $($tenant) -message "Failed to add Office App. Error: $($_.Exception.Message)" -Sev 'Error' continue @@ -89,12 +108,8 @@ Function Invoke-AddOfficeApp { $body = [pscustomobject]@{'Results' = $results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body }) - - - } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddStoreApp.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddStoreApp.ps1 index f017bade6249..5e00996d9c47 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddStoreApp.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-AddStoreApp.ps1 @@ -58,7 +58,6 @@ Function Invoke-AddStoreApp { $body = [pscustomobject]@{'Results' = $Results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ExecAssignApp.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ExecAssignApp.ps1 index 28dfcc771191..4a5219c27edb 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ExecAssignApp.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ExecAssignApp.ps1 @@ -52,7 +52,6 @@ Function Invoke-ExecAssignApp { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ExecSyncVPP.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ExecSyncVPP.ps1 index 198f5c8f11ab..8779ed1a2f1b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ExecSyncVPP.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ExecSyncVPP.ps1 @@ -38,7 +38,6 @@ function Invoke-ExecSyncVPP { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListApplicationQueue.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListApplicationQueue.ps1 index ac05a353f9bc..8b5fa020a809 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListApplicationQueue.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListApplicationQueue.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListApplicationQueue { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - $Table = Get-CippTable -tablename 'apps' $QueuedApps = (Get-CIPPAzDataTableEntity @Table) @@ -32,7 +26,6 @@ Function Invoke-ListApplicationQueue { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($CurrentApps) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListApps.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListApps.ps1 index 88fd739f0b77..75bf1a3c2abd 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListApps.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListApps.ps1 @@ -9,14 +9,6 @@ Function Invoke-ListApps { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter try { @@ -28,7 +20,6 @@ Function Invoke-ListApps { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListAppsRepository.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListAppsRepository.ps1 index 4f6364de19b7..98fd1beb7270 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListAppsRepository.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-ListAppsRepository.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListAppsRepository { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Search = $Request.Body.Search $Repository = $Request.Body.Repository $Packages = @() diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-RemoveApp.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-RemoveApp.ps1 index 259b2a77b340..21f0d7779f73 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-RemoveApp.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications/Invoke-RemoveApp.ps1 @@ -32,7 +32,6 @@ Function Invoke-RemoveApp { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = "$Result" } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAPDevice.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAPDevice.ps1 index 0d60bad82baf..48f483c47ee7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAPDevice.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAPDevice.ps1 @@ -11,11 +11,6 @@ Function Invoke-AddAPDevice { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - $TenantFilter = (Get-Tenants | Where-Object { $_.defaultDomainName -eq $Request.body.TenantFilter.value }).customerId $GroupName = if ($Request.body.Groupname) { $Request.body.Groupname } else { (New-Guid).GUID } Write-Host $GroupName @@ -67,7 +62,6 @@ Function Invoke-AddAPDevice { $body = [pscustomobject]@{'Results' = $Result } Write-Host $body - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAutopilotConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAutopilotConfig.ps1 index 443dfe999503..15a36447de55 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAutopilotConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAutopilotConfig.ps1 @@ -9,11 +9,6 @@ function Invoke-AddAutopilotConfig { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Input bindings are passed in via param block. $Tenants = $Request.Body.selectedTenants.value $Profbod = [pscustomobject]$Request.Body @@ -39,7 +34,6 @@ function Invoke-AddAutopilotConfig { Set-CIPPDefaultAPDeploymentProfile @profileParams } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddEnrollment.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddEnrollment.ps1 index 8ecb14446691..0ce238a77f03 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddEnrollment.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddEnrollment.ps1 @@ -9,11 +9,6 @@ function Invoke-AddEnrollment { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Input bindings are passed in via param block. $Tenants = $Request.Body.selectedTenants.value $Profbod = $Request.Body @@ -33,7 +28,6 @@ function Invoke-AddEnrollment { Set-CIPPDefaultAPEnrollment @ParamSplat } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecAssignAPDevice.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecAssignAPDevice.ps1 index 1eb7e8c7abca..91ba7706fffa 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecAssignAPDevice.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecAssignAPDevice.ps1 @@ -36,7 +36,6 @@ Function Invoke-ExecAssignAPDevice { $Results = [pscustomobject]@{'Results' = "$results" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecRenameAPDevice.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecRenameAPDevice.ps1 index 41210ba856fb..94bb1bbf323a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecRenameAPDevice.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecRenameAPDevice.ps1 @@ -10,8 +10,6 @@ Function Invoke-ExecRenameAPDevice { [CmdletBinding()] param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $TenantFilter = $Request.Body.tenantFilter @@ -52,7 +50,6 @@ Function Invoke-ExecRenameAPDevice { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecSetAPDeviceGroupTag.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecSetAPDeviceGroupTag.ps1 index a2e7dc03ece4..add5432e72ae 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecSetAPDeviceGroupTag.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecSetAPDeviceGroupTag.ps1 @@ -45,7 +45,6 @@ Function Invoke-ExecSetAPDeviceGroupTag { $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecSyncAPDevices.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecSyncAPDevices.ps1 index c2b241d66b48..8e0fb9cd015d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecSyncAPDevices.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ExecSyncAPDevices.ps1 @@ -28,7 +28,6 @@ Function Invoke-ExecSyncAPDevices { $Results = [pscustomobject]@{'Results' = "$Results" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ListAPDevices.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ListAPDevices.ps1 index 5c4deecbb8e2..086c0e1e2a3b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ListAPDevices.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ListAPDevices.ps1 @@ -9,14 +9,6 @@ Function Invoke-ListAPDevices { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter try { @@ -28,7 +20,6 @@ Function Invoke-ListAPDevices { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ListAutopilotconfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ListAutopilotconfig.ps1 index 83589b297b0f..d99a9a644684 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ListAutopilotconfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-ListAutopilotconfig.ps1 @@ -9,12 +9,6 @@ function Invoke-ListAutopilotconfig { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter try { @@ -33,7 +27,6 @@ function Invoke-ListAutopilotconfig { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-RemoveAPDevice.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-RemoveAPDevice.ps1 index f03893fd5745..14c05a8ce90d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-RemoveAPDevice.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-RemoveAPDevice.ps1 @@ -11,9 +11,6 @@ Function Invoke-RemoveAPDevice { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter ?? $Request.body.tenantFilter $Deviceid = $Request.Query.ID ?? $Request.body.ID @@ -37,7 +34,6 @@ Function Invoke-RemoveAPDevice { $null = New-GraphPOSTRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotSettings/sync' -tenantid $TenantFilter -type POST -body '{}' $Body = [pscustomobject]@{'Results' = "$Result" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-RemoveAutopilotConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-RemoveAutopilotConfig.ps1 index ad97d22004a4..bc3de65e5d30 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-RemoveAutopilotConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-RemoveAutopilotConfig.ps1 @@ -48,7 +48,6 @@ function Invoke-RemoveAutopilotConfig { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = "$Result" } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddAssignmentFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddAssignmentFilter.ps1 new file mode 100644 index 000000000000..d39f111b9cf8 --- /dev/null +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddAssignmentFilter.ps1 @@ -0,0 +1,44 @@ +using namespace System.Net + +function Invoke-AddAssignmentFilter { + <# + .FUNCTIONALITY + Entrypoint + .ROLE + Endpoint.MEM.ReadWrite + #> + [CmdletBinding()] + param($Request, $TriggerMetadata) + + $APIName = $Request.Params.CIPPEndpoint + $SelectedTenants = if ('AllTenants' -in $Request.body.tenantFilter) { (Get-Tenants).defaultDomainName } else { $Request.body.tenantFilter.value ? $Request.body.tenantFilter.value : $Request.body.tenantFilter } + Write-LogMessage -headers $Request.Headers -API $APIName -message 'Accessed this API' -Sev Debug + + + $FilterObject = $Request.body + + $Results = foreach ($tenant in $SelectedTenants) { + try { + # Use the centralized New-CIPPAssignmentFilter function + $Result = New-CIPPAssignmentFilter -FilterObject $FilterObject -TenantFilter $tenant -APIName $APIName -ExecutingUser $Request.Headers.'x-ms-client-principal-name' + + if ($Result.Success) { + "Successfully created assignment filter $($FilterObject.displayName) for $($tenant)" + $StatusCode = [HttpStatusCode]::OK + } else { + throw $Result.Message + } + } catch { + $ErrorMessage = Get-CippException -Exception $_ + Write-LogMessage -headers $Request.Headers -API $APIName -tenant $tenant -message "Assignment filter creation API failed. $($ErrorMessage.NormalizedError)" -Sev Error -LogData $ErrorMessage + "Failed to create assignment filter $($FilterObject.displayName) for $($tenant): $($ErrorMessage.NormalizedError)" + $StatusCode = [HttpStatusCode]::InternalServerError + } + } + + # Associate values to output bindings by calling 'Push-OutputBinding'. + return ([HttpResponseContext]@{ + StatusCode = $StatusCode + Body = @{'Results' = @($Results) } + }) +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddAssignmentFilterTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddAssignmentFilterTemplate.ps1 new file mode 100644 index 000000000000..82e49666f3d0 --- /dev/null +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddAssignmentFilterTemplate.ps1 @@ -0,0 +1,67 @@ +using namespace System.Net + +function Invoke-AddAssignmentFilterTemplate { + <# + .FUNCTIONALITY + Entrypoint,AnyTenant + .ROLE + Endpoint.MEM.ReadWrite + #> + [CmdletBinding()] + param($Request, $TriggerMetadata) + $APIName = $Request.Params.CIPPEndpoint + $Headers = $Request.Headers + + + $GUID = $Request.Body.GUID ?? (New-Guid).GUID + try { + if (!$Request.Body.displayName) { + throw 'You must enter a displayname' + } + + if (!$Request.Body.rule) { + throw 'You must enter a filter rule' + } + + if (!$Request.Body.platform) { + throw 'You must select a platform' + } + + # Normalize field names to handle different casing from various forms + $displayName = $Request.Body.displayName ?? $Request.Body.Displayname ?? $Request.Body.displayname + $description = $Request.Body.description ?? $Request.Body.Description + $platform = $Request.Body.platform + $rule = $Request.Body.rule + $assignmentFilterManagementType = $Request.Body.assignmentFilterManagementType ?? 'devices' + + $object = [PSCustomObject]@{ + displayName = $displayName + description = $description + platform = $platform + rule = $rule + assignmentFilterManagementType = $assignmentFilterManagementType + GUID = $GUID + } | ConvertTo-Json + $Table = Get-CippTable -tablename 'templates' + $Table.Force = $true + Add-CIPPAzDataTableEntity @Table -Force -Entity @{ + JSON = "$object" + RowKey = "$GUID" + PartitionKey = 'AssignmentFilterTemplate' + } + Write-LogMessage -headers $Request.Headers -API $APINAME -message "Created Assignment Filter template named $displayName with GUID $GUID" -Sev 'Debug' + + $body = [pscustomobject]@{'Results' = 'Successfully added template' } + } catch { + Write-LogMessage -headers $Request.Headers -API $APINAME -message "Assignment Filter Template Creation failed: $($_.Exception.Message)" -Sev 'Error' + $body = [pscustomobject]@{'Results' = "Assignment Filter Template Creation failed: $($_.Exception.Message)" } + } + + + # Associate values to output bindings by calling 'Push-OutputBinding'. + return ([HttpResponseContext]@{ + StatusCode = [HttpStatusCode]::OK + Body = $body + }) + +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddDefenderDeployment.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddDefenderDeployment.ps1 index d120e8c4feee..75f9ae596223 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddDefenderDeployment.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddDefenderDeployment.ps1 @@ -379,7 +379,6 @@ function Invoke-AddDefenderDeployment { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{'Results' = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddIntuneTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddIntuneTemplate.ps1 index 75004b404942..af6b44117f3e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddIntuneTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddIntuneTemplate.ps1 @@ -11,9 +11,6 @@ Function Invoke-AddIntuneTemplate { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $GUID = (New-Guid).GUID try { if ($Request.Body.RawJSON) { @@ -69,7 +66,6 @@ Function Invoke-AddIntuneTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddPolicy.ps1 index 4192c2b7d1a5..babdc14b018a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddPolicy.ps1 @@ -11,9 +11,6 @@ function Invoke-AddPolicy { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Tenants = $Request.Body.tenantFilter.value ? $Request.Body.tenantFilter.value : $Request.Body.tenantFilter if ('AllTenants' -in $Tenants) { $Tetnants = (Get-Tenants).defaultDomainName } $displayname = $Request.Body.displayName @@ -41,7 +38,6 @@ function Invoke-AddPolicy { $body = [pscustomobject]@{'Results' = @($results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditAssignmentFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditAssignmentFilter.ps1 new file mode 100644 index 000000000000..1b97042887f9 --- /dev/null +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditAssignmentFilter.ps1 @@ -0,0 +1,62 @@ +using namespace System.Net + +function Invoke-EditAssignmentFilter { + <# + .FUNCTIONALITY + Entrypoint + .ROLE + Endpoint.MEM.ReadWrite + #> + [CmdletBinding()] + param($Request, $TriggerMetadata) + + $APIName = $Request.Params.CIPPEndpoint + $Headers = $Request.Headers + + Write-LogMessage -headers $Request.Headers -API $APINAME -message 'Accessed this API' -Sev Debug + + $TenantFilter = $Request.Body.tenantFilter + + try { + $FilterId = $Request.Body.filterId + + if (!$FilterId) { + throw 'Filter ID is required' + } + + # Build the update body + # Note: Platform and assignmentFilterManagementType cannot be changed after creation per Graph API restrictions + $UpdateBody = @{} + + if ($Request.Body.displayName) { + $UpdateBody.displayName = $Request.Body.displayName + } + + if ($null -ne $Request.Body.description) { + $UpdateBody.description = $Request.Body.description + } + + if ($Request.Body.rule) { + $UpdateBody.rule = $Request.Body.rule + } + + # Update the assignment filter + $GraphRequest = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/deviceManagement/assignmentFilters/$FilterId" -tenantid $TenantFilter -type PATCH -body ($UpdateBody | ConvertTo-Json -Depth 10) + + Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $TenantFilter -message "Updated assignment filter $($Request.Body.displayName)" -Sev Info + + $Result = "Successfully updated assignment filter $($Request.Body.displayName)" + $StatusCode = [HttpStatusCode]::OK + } catch { + $ErrorMessage = Get-CippException -Exception $_ + Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $TenantFilter -message "Failed to update assignment filter: $($ErrorMessage.NormalizedError)" -Sev Error -LogData $ErrorMessage + $Result = "Failed to update assignment filter: $($ErrorMessage.NormalizedError)" + $StatusCode = [HttpStatusCode]::InternalServerError + } + + # Associate values to output bindings by calling 'Push-OutputBinding'. + return ([HttpResponseContext]@{ + StatusCode = $StatusCode + Body = @{'Results' = $Result } + }) +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditIntunePolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditIntunePolicy.ps1 index d04cc6502e3d..e460b74553a0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditIntunePolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditIntunePolicy.ps1 @@ -43,7 +43,6 @@ Function Invoke-EditIntunePolicy { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditPolicy.ps1 index a38080158b90..5fc0fbe9d508 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-EditPolicy.ps1 @@ -13,9 +13,6 @@ Function Invoke-EditPolicy { # Note, suspect this is deprecated - rvdwegen $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Tenant = $request.body.tenantid $ID = $request.body.groupid $displayname = $request.body.Displayname @@ -41,7 +38,6 @@ Function Invoke-EditPolicy { $body = [pscustomobject]@{'Results' = $results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body 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 1453cb78a59a..229f2a4fa3ce 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 @@ -47,7 +47,6 @@ Function Invoke-ExecAssignPolicy { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecAssignmentFilter.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecAssignmentFilter.ps1 new file mode 100644 index 000000000000..c60d69aa109a --- /dev/null +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecAssignmentFilter.ps1 @@ -0,0 +1,54 @@ +using namespace System.Net + +function Invoke-ExecAssignmentFilter { + <# + .FUNCTIONALITY + Entrypoint + .ROLE + Endpoint.MEM.ReadWrite + #> + [CmdletBinding()] + param($Request, $TriggerMetadata) + + $APIName = $Request.Params.CIPPEndpoint + $Headers = $Request.Headers + + Write-LogMessage -headers $Request.Headers -API $APINAME -message 'Accessed this API' -Sev Debug + + $TenantFilter = $Request.Query.TenantFilter ?? $Request.Body.tenantFilter + + try { + $FilterId = $Request.Body.ID + $Action = $Request.Body.Action + + if (!$FilterId) { + throw 'Filter ID is required' + } + + switch ($Action) { + 'Delete' { + # Delete the assignment filter + $GraphRequest = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/deviceManagement/assignmentFilters/$FilterId" -tenantid $TenantFilter -type DELETE + + Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $TenantFilter -message "Deleted assignment filter with ID $FilterId" -Sev Info + + $Result = "Successfully deleted assignment filter" + $StatusCode = [HttpStatusCode]::OK + } + default { + throw "Unknown action: $Action" + } + } + } catch { + $ErrorMessage = Get-CippException -Exception $_ + Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $TenantFilter -message "Failed to execute assignment filter action: $($ErrorMessage.NormalizedError)" -Sev Error -LogData $ErrorMessage + $Result = "Failed to execute assignment filter action: $($ErrorMessage.NormalizedError)" + $StatusCode = [HttpStatusCode]::InternalServerError + } + + # Associate values to output bindings by calling 'Push-OutputBinding'. + return ([HttpResponseContext]@{ + StatusCode = $StatusCode + Body = @{'Results' = $Result } + }) +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecDeviceAction.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecDeviceAction.ps1 index b37671bbf1fd..d6e67a0080e1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecDeviceAction.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecDeviceAction.ps1 @@ -61,7 +61,6 @@ function Invoke-ExecDeviceAction { $Results = "$($_.Exception.Message)" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecGetLocalAdminPassword.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecGetLocalAdminPassword.ps1 index 0605be939a70..c965305a534b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecGetLocalAdminPassword.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecGetLocalAdminPassword.ps1 @@ -22,7 +22,6 @@ Function Invoke-ExecGetLocalAdminPassword { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecGetRecoveryKey.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecGetRecoveryKey.ps1 index f36c40e8ef1b..0e31ce13865a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecGetRecoveryKey.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecGetRecoveryKey.ps1 @@ -26,7 +26,6 @@ function Invoke-ExecGetRecoveryKey { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListAssignmentFilterTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListAssignmentFilterTemplates.ps1 new file mode 100644 index 000000000000..4f4180dc3ddc --- /dev/null +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListAssignmentFilterTemplates.ps1 @@ -0,0 +1,45 @@ +using namespace System.Net + +function Invoke-ListAssignmentFilterTemplates { + <# + .FUNCTIONALITY + Entrypoint,AnyTenant + .ROLE + Endpoint.MEM.Read + #> + [CmdletBinding()] + param($Request, $TriggerMetadata) + + $APIName = $Request.Params.CIPPEndpoint + $Headers = $Request.Headers + + + + Write-Host $Request.query.id + + #List assignment filter templates + $Table = Get-CippTable -tablename 'templates' + $Filter = "PartitionKey eq 'AssignmentFilterTemplate'" + $Templates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter) | ForEach-Object { + $data = $_.JSON | ConvertFrom-Json + + [PSCustomObject]@{ + displayName = $data.displayName + description = $data.description + platform = $data.platform + rule = $data.rule + assignmentFilterManagementType = $data.assignmentFilterManagementType + GUID = $_.RowKey + } + } | Sort-Object -Property displayName + + if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property GUID -EQ $Request.query.id } + + + # Associate values to output bindings by calling 'Push-OutputBinding'. + return ([HttpResponseContext]@{ + StatusCode = [HttpStatusCode]::OK + Body = @($Templates) + }) + +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListAssignmentFilters.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListAssignmentFilters.ps1 new file mode 100644 index 000000000000..260d72495e2e --- /dev/null +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListAssignmentFilters.ps1 @@ -0,0 +1,43 @@ +using namespace System.Net + +function Invoke-ListAssignmentFilters { + <# + .FUNCTIONALITY + Entrypoint + .ROLE + Endpoint.MEM.Read + #> + [CmdletBinding()] + param($Request, $TriggerMetadata) + + $APIName = $Request.Params.CIPPEndpoint + $Headers = $Request.Headers + + Write-LogMessage -headers $Request.Headers -API $APINAME -message 'Accessed this API' -Sev Debug + + # Get the tenant filter + $TenantFilter = $Request.Query.TenantFilter + + try { + if ($Request.Query.filterId) { + # Get specific filter + $AssignmentFilters = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/deviceManagement/assignmentFilters/$($Request.Query.filterId)" -tenantid $TenantFilter + } else { + # Get all filters + $AssignmentFilters = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/assignmentFilters' -tenantid $TenantFilter + } + + $StatusCode = [HttpStatusCode]::OK + } catch { + $ErrorMessage = Get-CippException -Exception $_ + Write-LogMessage -headers $Request.Headers -API $APINAME -message "Failed to retrieve assignment filters: $($ErrorMessage.NormalizedError)" -Sev Error -LogData $ErrorMessage + $AssignmentFilters = @() + $StatusCode = [HttpStatusCode]::InternalServerError + } + + # Associate values to output bindings by calling 'Push-OutputBinding'. + return ([HttpResponseContext]@{ + StatusCode = $StatusCode + Body = @($AssignmentFilters) + }) +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListDefenderState.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListDefenderState.ps1 index 33815c419b3a..756b19a35bb2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListDefenderState.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListDefenderState.ps1 @@ -9,10 +9,6 @@ Function Invoke-ListDefenderState { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $StatusCode = [HttpStatusCode]::OK @@ -27,7 +23,6 @@ Function Invoke-ListDefenderState { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = "$($ErrorMessage)" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListDefenderTVM.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListDefenderTVM.ps1 index c166986f0423..52b71cca7f25 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListDefenderTVM.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListDefenderTVM.ps1 @@ -9,13 +9,7 @@ Function Invoke-ListDefenderTVM { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $TenantFilter = $Request.Query.tenantFilter - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. try { $GraphRequest = New-GraphGetRequest -tenantid $TenantFilter -uri "https://api.securitycenter.microsoft.com/api/machines/SoftwareVulnerabilitiesByMachine?`$top=999" -scope 'https://api.securitycenter.microsoft.com/.default' | Group-Object cveId @@ -51,7 +45,6 @@ Function Invoke-ListDefenderTVM { $GroupObj = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GroupObj) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntunePolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntunePolicy.ps1 index 6aedc4b42147..9a190fe23747 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntunePolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntunePolicy.ps1 @@ -8,14 +8,6 @@ Function Invoke-ListIntunePolicy { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter $id = $Request.Query.ID @@ -130,7 +122,6 @@ Function Invoke-ListIntunePolicy { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntuneScript.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntuneScript.ps1 index 46ebd8cb52bb..d5b42304a214 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntuneScript.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntuneScript.ps1 @@ -73,7 +73,6 @@ function Invoke-ListIntuneScript { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntuneTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntuneTemplates.ps1 index aec011ece928..a56ba2ecb323 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntuneTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntuneTemplates.ps1 @@ -9,11 +9,6 @@ function Invoke-ListIntuneTemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CippTable -tablename 'templates' $Imported = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'settings'" if ($Imported.IntuneTemplate -ne $true) { @@ -89,7 +84,6 @@ function Invoke-ListIntuneTemplates { # Sort all output regardless of view condition $Templates = $Templates | Sort-Object -Property displayName - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = ($Templates | ConvertTo-Json -Depth 100) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveAssignmentFilterTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveAssignmentFilterTemplate.ps1 new file mode 100644 index 000000000000..791d6b7399fe --- /dev/null +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveAssignmentFilterTemplate.ps1 @@ -0,0 +1,44 @@ +using namespace System.Net + +Function Invoke-RemoveAssignmentFilterTemplate { + <# + .FUNCTIONALITY + Entrypoint,AnyTenant + .ROLE + Endpoint.MEM.ReadWrite + #> + [CmdletBinding()] + param($Request, $TriggerMetadata) + + $APIName = $Request.Params.CIPPEndpoint + $Headers = $Request.Headers + + + $ID = $request.Query.ID ?? $Request.Body.ID + try { + $Table = Get-CippTable -tablename 'templates' + Write-Host $ID + + $Filter = "PartitionKey eq 'AssignmentFilterTemplate' and RowKey eq '$ID'" + Write-Host $Filter + $ClearRow = Get-CIPPAzDataTableEntity @Table -Filter $Filter -Property PartitionKey, RowKey + Remove-AzDataTableEntity -Force @Table -Entity $ClearRow + $Result = "Removed Assignment Filter Template with ID $ID" + Write-LogMessage -Headers $Headers -API $APIName -message $Result -Sev 'Info' + $StatusCode = [HttpStatusCode]::OK + } catch { + $ErrorMessage = Get-CippException -Exception $_ + $Result = "Failed to remove assignment filter template $($ID): $($ErrorMessage.NormalizedError)" + Write-LogMessage -Headers $Headers -API $APIName -message $Result -Sev 'Error' -LogData $ErrorMessage + $StatusCode = [HttpStatusCode]::InternalServerError + } + + + # Associate values to output bindings by calling 'Push-OutputBinding'. + return ([HttpResponseContext]@{ + StatusCode = $StatusCode + Body = @{'Results' = $Result } + }) + + +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveIntuneScript.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveIntuneScript.ps1 index 7df690b009a5..bd53457faeeb 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveIntuneScript.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveIntuneScript.ps1 @@ -49,7 +49,6 @@ function Invoke-RemoveIntuneScript { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = "$Result" } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveIntuneTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveIntuneTemplate.ps1 index 19f5652f09f9..1517adbdd5a0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveIntuneTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemoveIntuneTemplate.ps1 @@ -33,7 +33,6 @@ Function Invoke-RemoveIntuneTemplate { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemovePolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemovePolicy.ps1 index 07e857992b06..9e204e091e5d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemovePolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-RemovePolicy.ps1 @@ -36,7 +36,6 @@ function Invoke-RemovePolicy { } $Body = [pscustomobject]@{'Results' = "$Results" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Reports/Invoke-ListDevices.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Reports/Invoke-ListDevices.ps1 index b5e1817bd347..9b61fd04af75 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Reports/Invoke-ListDevices.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Reports/Invoke-ListDevices.ps1 @@ -9,14 +9,6 @@ Function Invoke-ListDevices { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter try { @@ -28,7 +20,6 @@ Function Invoke-ListDevices { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Devices/Invoke-ExecDeviceDelete.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Devices/Invoke-ExecDeviceDelete.ps1 index f36f0b9ea800..7c744df940e3 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Devices/Invoke-ExecDeviceDelete.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Devices/Invoke-ExecDeviceDelete.ps1 @@ -27,7 +27,6 @@ Function Invoke-ExecDeviceDelete { $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroup.ps1 index edec45ffe400..c8bd3a61a50a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroup.ps1 @@ -36,7 +36,6 @@ function Invoke-AddGroup { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroupTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroupTemplate.ps1 index 2f8a448de8cc..f1a5c5f6412c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroupTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroupTemplate.ps1 @@ -10,9 +10,6 @@ function Invoke-AddGroupTemplate { [CmdletBinding()] param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $GUID = $Request.Body.GUID ?? (New-Guid).GUID try { if (!$Request.Body.displayName) { @@ -68,7 +65,6 @@ function Invoke-AddGroupTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-EditGroup.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-EditGroup.ps1 index e0a371fc9f5f..a98aae5fecd9 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-EditGroup.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-EditGroup.ps1 @@ -440,7 +440,6 @@ function Invoke-EditGroup { } $body = @{'Results' = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupSenderAuthentication.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupSenderAuthentication.ps1 index 9e252c10bf93..6835ab771458 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupSenderAuthentication.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupSenderAuthentication.ps1 @@ -3,11 +3,6 @@ using namespace System.Net Function Invoke-ListGroupSenderAuthentication { [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter $groupid = $Request.query.groupid diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupTemplates.ps1 index 9ca1dc47e0d3..7bddb8c1d6e2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupTemplates.ps1 @@ -9,12 +9,6 @@ function Invoke-ListGroupTemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - Write-Host $Request.query.id #List new policies @@ -52,7 +46,6 @@ function Invoke-ListGroupTemplates { if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property GUID -EQ $Request.query.id } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Templates) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroups.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroups.ps1 index e6642b261e89..e3ad3a907c93 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroups.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroups.ps1 @@ -9,11 +9,6 @@ function Invoke-ListGroups { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $Request.Query.tenantFilter $GroupID = $Request.Query.groupID $GroupType = $Request.Query.groupType @@ -130,7 +125,6 @@ function Invoke-ListGroups { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $GraphRequest diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-RemoveGroupTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-RemoveGroupTemplate.ps1 index 958755356ffc..2da0b351e248 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-RemoveGroupTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-RemoveGroupTemplate.ps1 @@ -34,7 +34,6 @@ Function Invoke-RemoveGroupTemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddGuest.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddGuest.ps1 index 43dabf6ba320..e4facf702520 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddGuest.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddGuest.ps1 @@ -50,7 +50,6 @@ Function Invoke-AddGuest { $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = @($Result) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUser.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUser.ps1 index efcdcf3981df..fa968b80133f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUser.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUser.ps1 @@ -55,7 +55,6 @@ function Invoke-AddUser { 'User' = $CreationResults.User } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUserBulk.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUserBulk.ps1 index 44613145ec92..44b09d871810 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUserBulk.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUserBulk.ps1 @@ -11,9 +11,6 @@ function Invoke-AddUserBulk { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with body parameters or the body of the request. $TenantFilter = $Request.Body.tenantFilter @@ -131,7 +128,7 @@ function Invoke-AddUserBulk { if ($AssignedLicenses) { $GuidPattern = '([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})' $LicenseSkus = $AssignedLicenses.value ?? $AssignedLicenses | Where-Object { $_ -match $GuidPattern } - Set-CIPPUserLicense -UserId $BulkResult.id -AddLicenses $LicenseSkus -TenantFilter $TenantFilter + Set-CIPPUserLicense -UserId $BulkResult.id -AddLicenses $LicenseSkus -TenantFilter $TenantFilter -APIName $APIName -Headers $Headers } $Results.Add(@{ resultText = $Message.resultText @@ -152,7 +149,6 @@ function Invoke-AddUserBulk { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-EditUser.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-EditUser.ps1 index 30f10752ed45..8f643d21ce09 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-EditUser.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-EditUser.ps1 @@ -126,12 +126,12 @@ function Invoke-EditUser { $Results.Add( 'Success. User license is already correct.' ) } else { if ($UserObj.removeLicenses) { - $licResults = Set-CIPPUserLicense -UserId $UserObj.id -TenantFilter $UserObj.tenantFilter -RemoveLicenses $CurrentLicenses.assignedLicenses.skuId -Headers $Headers + $licResults = Set-CIPPUserLicense -UserId $UserObj.id -TenantFilter $UserObj.tenantFilter -RemoveLicenses $CurrentLicenses.assignedLicenses.skuId -Headers $Headers -APIName $APIName $Results.Add($licResults) } else { #Remove all objects from $CurrentLicenses.assignedLicenses.skuId that are in $licenses $RemoveLicenses = $CurrentLicenses.assignedLicenses.skuId | Where-Object { $_ -notin $licenses } - $licResults = Set-CIPPUserLicense -UserId $UserObj.id -TenantFilter $UserObj.tenantFilter -RemoveLicenses $RemoveLicenses -AddLicenses $licenses -Headers $headers + $licResults = Set-CIPPUserLicense -UserId $UserObj.id -TenantFilter $UserObj.tenantFilter -RemoveLicenses $RemoveLicenses -AddLicenses $licenses -Headers $Headers -APIName $APIName $Results.Add($licResults) } @@ -241,7 +241,6 @@ function Invoke-EditUser { $Results.Add($SponsorResult) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{'Results' = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecBulkLicense.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecBulkLicense.ps1 index ce61ab538524..69b8b3f169ff 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecBulkLicense.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecBulkLicense.ps1 @@ -1,4 +1,4 @@ -Function Invoke-ExecBulkLicense { +function Invoke-ExecBulkLicense { <# .FUNCTIONALITY Entrypoint @@ -11,7 +11,8 @@ Function Invoke-ExecBulkLicense { $TriggerMetadata ) - $APIName = $TriggerMetadata.FunctionName + $APIName = $Request.Params.CIPPEndpoint + $Headers = $Request.Headers $Results = [System.Collections.Generic.List[string]]::new() $StatusCode = [HttpStatusCode]::OK @@ -48,12 +49,12 @@ Function Invoke-ExecBulkLicense { $RemoveLicenses = $Licenses } elseif ($LicenseOperation -eq 'Replace') { $RemoveReplace = $User.assignedLicenses.skuId - if ($RemoveReplace) { Set-CIPPUserLicense -UserId $UserId -TenantFilter $TenantFilter -RemoveLicenses $RemoveReplace } + if ($RemoveReplace) { Set-CIPPUserLicense -UserId $UserId -TenantFilter $TenantFilter -RemoveLicenses $RemoveReplace -APIName $APIName -Headers $Headers } } elseif ($RemoveAllLicenses) { $RemoveLicenses = $User.assignedLicenses.skuId } #todo: Actually build bulk support into set-cippuserlicense. - $TaskResults = Set-CIPPUserLicense -UserId $UserId -TenantFilter $TenantFilter -AddLicenses $AddLicenses -RemoveLicenses $RemoveLicenses + $TaskResults = Set-CIPPUserLicense -UserId $UserId -TenantFilter $TenantFilter -AddLicenses $AddLicenses -RemoveLicenses $RemoveLicenses -APIName $APIName -Headers $Headers $Results.Add($TaskResults) Write-LogMessage -API $APIName -tenant $TenantFilter -message "Successfully processed licenses for user $UserPrincipalName" -Sev 'Info' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecClrImmId.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecClrImmId.ps1 index f1553913d80b..67f512a58ad0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecClrImmId.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecClrImmId.ps1 @@ -26,7 +26,6 @@ Function Invoke-ExecClrImmId { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecCreateTAP.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecCreateTAP.ps1 index 9a14b6fca6a4..89f5934d5dd2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecCreateTAP.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecCreateTAP.ps1 @@ -51,7 +51,6 @@ Function Invoke-ExecCreateTAP { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecDisableUser.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecDisableUser.ps1 index 62cf6f49210a..d61c4e80b67f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecDisableUser.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecDisableUser.ps1 @@ -28,7 +28,6 @@ Function Invoke-ExecDisableUser { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = "$Result" } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecDismissRiskyUser.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecDismissRiskyUser.ps1 index b0c4bd06057b..2dee3de81801 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecDismissRiskyUser.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecDismissRiskyUser.ps1 @@ -9,9 +9,6 @@ function Invoke-ExecDismissRiskyUser { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with the query or body of the request $TenantFilter = $Request.Query.tenantFilter ?? $Request.Body.tenantFilter $SuspectUser = $Request.Query.userId ?? $Request.Body.userId @@ -39,7 +36,6 @@ function Invoke-ExecDismissRiskyUser { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecJITAdmin.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecJITAdmin.ps1 index 6fdcecefbe70..41b9d253bfae 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecJITAdmin.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecJITAdmin.ps1 @@ -280,7 +280,6 @@ function Invoke-ExecJITAdmin { } # TODO - We should find a way to have this return a HTTP status code based on the success or failure of the operation. This also doesn't return the results of the operation in a Results hash table, like most of the rest of the API. - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOneDriveShortCut.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOneDriveShortCut.ps1 index e025ccb9fa8d..a9b718452cdf 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOneDriveShortCut.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOneDriveShortCut.ps1 @@ -9,8 +9,6 @@ Function Invoke-ExecOneDriveShortCut { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -28,7 +26,6 @@ Function Invoke-ExecOneDriveShortCut { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOnedriveProvision.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOnedriveProvision.ps1 index f6362c766626..c04fa01a4d95 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOnedriveProvision.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOnedriveProvision.ps1 @@ -25,7 +25,6 @@ Function Invoke-ExecOneDriveProvision { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecPasswordNeverExpires.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecPasswordNeverExpires.ps1 index d512887580b8..fce05e622468 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecPasswordNeverExpires.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecPasswordNeverExpires.ps1 @@ -33,7 +33,6 @@ function Invoke-ExecPasswordNeverExpires { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = @($Result) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecPerUserMFA.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecPerUserMFA.ps1 index d1432f992323..bc78468b45a8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecPerUserMFA.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecPerUserMFA.ps1 @@ -32,7 +32,6 @@ function Invoke-ExecPerUserMFA { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = @($Result) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetMFA.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetMFA.ps1 index ba10eefcf4c2..64dd37f0ae7c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetMFA.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetMFA.ps1 @@ -9,8 +9,6 @@ Function Invoke-ExecResetMFA { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -25,7 +23,6 @@ Function Invoke-ExecResetMFA { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetPass.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetPass.ps1 index f2227053ffff..7b7466bba9fc 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetPass.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetPass.ps1 @@ -30,7 +30,6 @@ Function Invoke-ExecResetPass { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecRestoreDeleted.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecRestoreDeleted.ps1 index 9ad29fc93d25..40ebd01c6df9 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecRestoreDeleted.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecRestoreDeleted.ps1 @@ -39,7 +39,6 @@ Function Invoke-ExecRestoreDeleted { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecRevokeSessions.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecRevokeSessions.ps1 index e15ae768989a..6e3c75e95cce 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecRevokeSessions.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecRevokeSessions.ps1 @@ -27,7 +27,6 @@ Function Invoke-ExecRevokeSessions { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecSendPush.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecSendPush.ps1 index eda7af064781..d89d05ef71dd 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecSendPush.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecSendPush.ps1 @@ -11,9 +11,6 @@ function Invoke-ExecSendPush { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $Request.body.TenantFilter $UserEmail = $Request.body.UserEmail $MFAAppID = '981f26a1-7f43-403b-a875-f8b09b8cd720' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListDeletedItems.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListDeletedItems.ps1 index 62bac5513718..61b02b98548d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListDeletedItems.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListDeletedItems.ps1 @@ -9,12 +9,7 @@ Function Invoke-ListDeletedItems { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $TenantFilter = $Request.Query.tenantFilter - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $Types = 'Application', 'User', 'Group' $GraphRequest = foreach ($Type in $Types) { @@ -23,7 +18,6 @@ Function Invoke-ListDeletedItems { Select-Object *, @{ Name = 'TargetType'; Expression = { $Type } } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListPerUserMFA.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListPerUserMFA.ps1 index 05890e5d591e..2607666def6c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListPerUserMFA.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListPerUserMFA.ps1 @@ -37,7 +37,6 @@ function Invoke-ListPerUserMFA { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserConditionalAccessPolicies.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserConditionalAccessPolicies.ps1 index 9e34767159ed..449e041c8b95 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserConditionalAccessPolicies.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserConditionalAccessPolicies.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListUserConditionalAccessPolicies { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # XXX - Unused endpoint? # Interact with query parameters or the body of the request. @@ -43,7 +38,6 @@ Function Invoke-ListUserConditionalAccessPolicies { Write-Host $GraphRequest - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserCounts.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserCounts.ps1 index bbc0b9d1b225..08a3189d34fa 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserCounts.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserCounts.ps1 @@ -9,11 +9,7 @@ Function Invoke-ListUserCounts { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - + # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter if ($Request.Query.TenantFilter -eq 'AllTenants') { @@ -22,12 +18,69 @@ Function Invoke-ListUserCounts { $GAs = 'Not Supported' $Guests = 'Not Supported' } else { - try { $Users = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$count=true&`$top=1" -CountOnly -ComplexFilter -tenantid $TenantFilter } catch { $Users = 'Not available' } - try { $LicUsers = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$count=true&`$top=1&`$filter=assignedLicenses/`$count ne 0" -CountOnly -ComplexFilter -tenantid $TenantFilter } catch { $LicUsers = 'Not available' } - try { $GAs = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/directoryRoles/roleTemplateId=62e90394-69f5-4237-9190-012177145e10/members?`$count=true" -CountOnly -ComplexFilter -tenantid $TenantFilter } catch { $GAs = 'Not available' } - try { $Guests = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$count=true&`$top=1&`$filter=userType eq 'Guest'" -CountOnly -ComplexFilter -tenantid $TenantFilter } catch { $Guests = 'Not available' } + try { + # Build bulk requests array + [System.Collections.Generic.List[PSCustomObject]]$BulkRequests = @( + @{ + id = 'Users' + method = 'GET' + url = "/users?`$count=true&`$top=1" + headers = @{ + 'ConsistencyLevel' = 'eventual' + } + } + @{ + id = 'LicUsers' + method = 'GET' + url = "/users?`$count=true&`$top=1&`$filter=assignedLicenses/`$count ne 0" + headers = @{ + 'ConsistencyLevel' = 'eventual' + } + } + @{ + id = 'GAs' + method = 'GET' + url = "/directoryRoles/roleTemplateId=62e90394-69f5-4237-9190-012177145e10/members?`$count=true" + headers = @{ + 'ConsistencyLevel' = 'eventual' + } + } + @{ + id = 'Guests' + method = 'GET' + url = "/users?`$count=true&`$top=1&`$filter=userType eq 'Guest'" + headers = @{ + 'ConsistencyLevel' = 'eventual' + } + } + ) + + # Execute bulk request + $BulkResults = New-GraphBulkRequest -Requests @($BulkRequests) -tenantid $TenantFilter @('Users', 'LicUsers', 'GAs', 'Guests') + + $BulkResults | ForEach-Object { + $Count = if ($_.status -eq 200) { + $_.body.'@odata.count' + } else { + 'Not available' + } + + switch ($_.id) { + 'Users' { $Users = $Count } + 'LicUsers' { $LicUsers = $Count } + 'GAs' { $GAs = $Count } + 'Guests' { $Guests = $Count } + } + } + + } catch { + $Users = 'Not available' + $LicUsers = 'Not available' + $GAs = 'Not available' + $Guests = 'Not available' + } } - $StatusCode = [HttpStatusCode]::OK + $Counts = @{ Users = $Users LicUsers = $LicUsers @@ -35,9 +88,8 @@ Function Invoke-ListUserCounts { Guests = $Guests } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ - StatusCode = $StatusCode + StatusCode = [HttpStatusCode]::OK Body = $Counts }) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserDevices.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserDevices.ps1 index be6ea0807d35..2121432b4831 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserDevices.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserDevices.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListUserDevices { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $UserID = $Request.Query.UserID @@ -51,7 +46,6 @@ Function Invoke-ListUserDevices { $GraphRequest = @() } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserGroups.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserGroups.ps1 index f013b9ff144d..ad4de77f5ec9 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserGroups.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserGroups.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListUserGroups { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $UserID = $Request.Query.userId @@ -37,7 +32,6 @@ Function Invoke-ListUserGroups { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxDetails.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxDetails.ps1 index 54150ebaa710..978f617bdd02 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxDetails.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxDetails.ps1 @@ -9,12 +9,6 @@ function Invoke-ListUserMailboxDetails { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $UserID = $Request.Query.UserID diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxRules.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxRules.ps1 index 22ca9eaebd7b..c28a40be59d8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxRules.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxRules.ps1 @@ -29,7 +29,6 @@ Function Invoke-ListUserMailboxRules { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Result) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserPhoto.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserPhoto.ps1 index ba1e333435be..5adf10f959e0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserPhoto.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserPhoto.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListUserPhoto { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $tenantFilter = $Request.Query.tenantFilter $userId = $Request.Query.UserID @@ -32,7 +27,6 @@ Function Invoke-ListUserPhoto { #convert body from base64 to byte array $Body = [Convert]::FromBase64String($ImageData.body) - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK ContentType = $ImageData.headers.'Content-Type' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSettings.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSettings.ps1 index f4feff14d946..fab509c7f7e0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSettings.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSettings.ps1 @@ -8,8 +8,6 @@ function Invoke-ListUserSettings { Identity.User.Read #> param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -64,7 +62,6 @@ function Invoke-ListUserSettings { $Results = "Function Error: $($_.Exception.Message)" $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSigninLogs.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSigninLogs.ps1 index 5fc9b93fc27b..70f6807e7cba 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSigninLogs.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSigninLogs.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListUserSigninLogs { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $top = $Request.Query.top ? $Request.Query.top : 50 @@ -31,7 +26,6 @@ Function Invoke-ListUserSigninLogs { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Result) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUsers.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUsers.ps1 index 0d0563050eac..d0add133da4e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUsers.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUsers.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListUsers { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $ConvertTable = Import-Csv ConversionTable.csv | Sort-Object -Property 'guid' -Unique # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -78,7 +73,6 @@ Function Invoke-ListUsers { @{ Name = 'LastSigninResult'; Expression = { $LastSignIn.status } }, @{ Name = 'LastSigninFailureReason'; Expression = { if ($LastSignIn.Id -eq 0) { 'Successfully signed in' } else { $LastSignIn.Id } } } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-RemoveDeletedObject.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-RemoveDeletedObject.ps1 index 02ed3b16802e..57adec88a881 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-RemoveDeletedObject.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-RemoveDeletedObject.ps1 @@ -39,7 +39,6 @@ Function Invoke-RemoveDeletedObject { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-RemoveUser.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-RemoveUser.ps1 index b4565a8c8d04..067f6b44e7db 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-RemoveUser.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-RemoveUser.ps1 @@ -29,7 +29,6 @@ Function Invoke-RemoveUser { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListAzureADConnectStatus.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListAzureADConnectStatus.ps1 index 85ec2040afd3..e22cc0514a3d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListAzureADConnectStatus.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListAzureADConnectStatus.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListAzureADConnectStatus { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $Request.Query.TenantFilter $DataToReturn = $Request.Query.DataToReturn Write-Host "DataToReturn: $DataToReturn" diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListBasicAuth.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListBasicAuth.ps1 index 0c1aaf5a04b4..87a19e9ab5d4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListBasicAuth.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListBasicAuth.ps1 @@ -31,14 +31,12 @@ Function Invoke-ListBasicAuth { $response = $GraphRequest Write-LogMessage -headers $Headers -API $APIName -message 'Retrieved basic authentication report' -Sev 'Debug' -tenant $TenantFilter - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($response) }) } catch { Write-LogMessage -headers $Headers -API $APIName -message "Failed to retrieve basic authentication report: $($_.Exception.message) " -Sev 'Error' -tenant $TenantFilter - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = '500' Body = $(Get-NormalizedError -message $_.Exception.message) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListInactiveAccounts.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListInactiveAccounts.ps1 index b3994683b0c1..2f873ff9bbda 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListInactiveAccounts.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListInactiveAccounts.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListInactiveAccounts { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Convert the TenantFilter parameter to a list of tenant IDs for AllTenants or a single tenant ID $TenantFilter = $Request.Query.tenantFilter if ($TenantFilter -eq 'AllTenants') { @@ -31,7 +26,6 @@ Function Invoke-ListInactiveAccounts { $GraphRequest = "Could not connect to Azure Lighthouse API: $($ErrorMessage)" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListMFAUsers.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListMFAUsers.ps1 index 695794a70fcb..a5bd538e046a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListMFAUsers.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListMFAUsers.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListMFAUsers { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -58,7 +53,6 @@ Function Invoke-ListMFAUsers { $GraphRequest = $Rows } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListSignIns.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListSignIns.ps1 index e074b7767189..4afeb72089ef 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListSignIns.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Reports/Invoke-ListSignIns.ps1 @@ -46,14 +46,12 @@ Function Invoke-ListSignIns { $response = $response | Group-Object -Property userPrincipalName | Where-Object { $_.Count -ge $FailureThreshold } | Select-Object -ExpandProperty Group } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($response) }) } catch { Write-LogMessage -headers $Request.Headers -API $APINAME -message "Failed to retrieve Sign In report: $($_.Exception.message) " -Sev 'Error' -tenant $TenantFilter - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = '500' Body = $(Get-NormalizedError -message $_.Exception.message) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecAlertsList.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecAlertsList.ps1 index 7aa831c0cb00..412b5ab13a06 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecAlertsList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecAlertsList.ps1 @@ -9,12 +9,6 @@ function Invoke-ExecAlertsList { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - function New-FlatArray ([Array]$arr) { $arr | ForEach-Object { if ($_ -is 'Array') { diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecIncidentsList.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecIncidentsList.ps1 index c32c2f97b8b6..13c82e4e211d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecIncidentsList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecIncidentsList.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecIncidentsList { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecMdoAlertsList.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecMdoAlertsList.ps1 index f1bcffe4645f..db9261933014 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecMdoAlertsList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecMdoAlertsList.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecMDOAlertsList { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetMdoAlert.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetMdoAlert.ps1 index 99b9da22a063..d3dc0c4cdcf1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetMdoAlert.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetMdoAlert.ps1 @@ -65,7 +65,6 @@ function Invoke-ExecSetMdoAlert { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetSecurityAlert.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetSecurityAlert.ps1 index e3d850f4ad89..73d73300f8e6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetSecurityAlert.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetSecurityAlert.ps1 @@ -34,7 +34,6 @@ Function Invoke-ExecSetSecurityAlert { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetSecurityIncident.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetSecurityIncident.ps1 index 5bddc776e373..aefc8f315871 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetSecurityIncident.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecSetSecurityIncident.ps1 @@ -78,7 +78,6 @@ Function Invoke-ExecSetSecurityIncident { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-AddSafeLinksPolicyTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-AddSafeLinksPolicyTemplate.ps1 index 1245a517dca9..739588390923 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-AddSafeLinksPolicyTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-AddSafeLinksPolicyTemplate.ps1 @@ -88,7 +88,6 @@ Function Invoke-AddSafeLinksPolicyTemplate { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-CreateSafeLinksPolicyTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-CreateSafeLinksPolicyTemplate.ps1 index 5a8996456bf2..7bf08f2b034a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-CreateSafeLinksPolicyTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-CreateSafeLinksPolicyTemplate.ps1 @@ -69,7 +69,6 @@ Function Invoke-CreateSafeLinksPolicyTemplate { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-EditSafeLinksPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-EditSafeLinksPolicy.ps1 index cabcfa50989f..8cb3372a4e62 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-EditSafeLinksPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-EditSafeLinksPolicy.ps1 @@ -209,7 +209,6 @@ function Invoke-EditSafeLinksPolicy { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-EditSafeLinksPolicyTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-EditSafeLinksPolicyTemplate.ps1 index cc1ef5750d85..66d60a1ef8cd 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-EditSafeLinksPolicyTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-EditSafeLinksPolicyTemplate.ps1 @@ -81,7 +81,6 @@ Function Invoke-EditSafeLinksPolicyTemplate { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ExecDeleteSafeLinksPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ExecDeleteSafeLinksPolicy.ps1 index 923e20e8a3ae..f957c2e58143 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ExecDeleteSafeLinksPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ExecDeleteSafeLinksPolicy.ps1 @@ -86,7 +86,6 @@ function Invoke-ExecDeleteSafeLinksPolicy { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ExecNewSafeLinksPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ExecNewSafeLinksPolicy.ps1 index 8303a40e266e..7c0542175f3b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ExecNewSafeLinksPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ExecNewSafeLinksPolicy.ps1 @@ -220,7 +220,6 @@ function Invoke-ExecNewSafeLinksPolicy { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicy.ps1 index 3fe6835586fd..1e7f372df9d1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicy.ps1 @@ -193,7 +193,6 @@ Function Invoke-ListSafeLinksPolicy { $FinalOutput = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $FinalOutput diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyDetails.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyDetails.ps1 index e325e01c7b08..a431aa6e5048 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyDetails.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyDetails.ps1 @@ -98,7 +98,6 @@ function Invoke-ListSafeLinksPolicyDetails { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyTemplateDetails.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyTemplateDetails.ps1 index 8f4db83dd5f1..4f82a94ef843 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyTemplateDetails.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyTemplateDetails.ps1 @@ -49,7 +49,6 @@ Function Invoke-ListSafeLinksPolicyTemplateDetails { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyTemplates.ps1 index 0488bb692d2f..36e35c4ea52e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-ListSafeLinksPolicyTemplates.ps1 @@ -8,9 +8,6 @@ Function Invoke-ListSafeLinksPolicyTemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $Table = Get-CippTable -tablename 'templates' $Templates = Get-ChildItem 'Config\*.SafeLinksTemplate.json' | ForEach-Object { $Entity = @{ @@ -31,7 +28,6 @@ Function Invoke-ListSafeLinksPolicyTemplates { $data } if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property RowKey -EQ $Request.query.id } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Templates) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-RemoveSafeLinksPolicyTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-RemoveSafeLinksPolicyTemplate.ps1 index 6de007f8fd87..f880dd39eba6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-RemoveSafeLinksPolicyTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Safe-Links-Policy/Invoke-RemoveSafeLinksPolicyTemplate.ps1 @@ -27,7 +27,6 @@ Function Invoke-RemoveSafeLinksPolicyTemplate { Write-LogMessage -Headers $User -API $APINAME -message $Result -Sev 'Error' -LogData $ErrorMessage $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddSite.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddSite.ps1 index 705c1371d12a..65d5bec39326 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddSite.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddSite.ps1 @@ -9,8 +9,6 @@ function Invoke-AddSite { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -27,7 +25,6 @@ function Invoke-AddSite { $Result = $_.Exception.Message } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddSiteBulk.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddSiteBulk.ps1 index d0690801c2d0..bbfd7dc6e1a4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddSiteBulk.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddSiteBulk.ps1 @@ -9,8 +9,6 @@ Function Invoke-AddSiteBulk { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -25,7 +23,6 @@ Function Invoke-AddSiteBulk { $Results.Add("Failed to create $($sharePointObj.siteName) Error message: $($_.Exception.Message)") } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddTeam.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddTeam.ps1 index 903d6e564096..3684a79f96b4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddTeam.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-AddTeam.ps1 @@ -55,7 +55,6 @@ Function Invoke-AddTeam { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = $Message } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecRemoveTeamsVoicePhoneNumberAssignment.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecRemoveTeamsVoicePhoneNumberAssignment.ps1 index 9e2e3cc50eee..392cf7d476a0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecRemoveTeamsVoicePhoneNumberAssignment.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecRemoveTeamsVoicePhoneNumberAssignment.ps1 @@ -31,7 +31,6 @@ Function Invoke-ExecRemoveTeamsVoicePhoneNumberAssignment { Write-LogMessage -headers $Headers -API $APIName -tenant $TenantFilter -message $Result -Sev Error -LogData $ErrorMessage $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecSetSharePointMember.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecSetSharePointMember.ps1 index 70e814cf8313..b9c8fa405ae1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecSetSharePointMember.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecSetSharePointMember.ps1 @@ -9,9 +9,6 @@ function Invoke-ExecSetSharePointMember { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -43,7 +40,6 @@ function Invoke-ExecSetSharePointMember { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecSharePointPerms.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecSharePointPerms.ps1 index 767c27c1c3e3..441fdc72a3ec 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecSharePointPerms.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecSharePointPerms.ps1 @@ -46,7 +46,6 @@ Function Invoke-ExecSharePointPerms { $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecTeamsVoicePhoneNumberAssignment.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecTeamsVoicePhoneNumberAssignment.ps1 index 0e3d19c980c2..c63135e5cd0f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecTeamsVoicePhoneNumberAssignment.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ExecTeamsVoicePhoneNumberAssignment.ps1 @@ -32,7 +32,6 @@ Function Invoke-ExecTeamsVoicePhoneNumberAssignment { Write-LogMessage -Headers $Headers -API $APINAME -tenant $($TenantFilter) -message $($Results.Results) -Sev Error -LogData $ErrorMessage $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointQuota.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointQuota.ps1 index 3c70078e4230..22bdea951b7b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointQuota.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointQuota.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListSharepointQuota { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -44,7 +39,6 @@ Function Invoke-ListSharepointQuota { $StatusCode = [HttpStatusCode]::OK - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $SharePointQuotaDetails diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointSettings.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointSettings.ps1 index 44226f9f562d..ddf172fcc04b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointSettings.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointSettings.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListSharepointSettings { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # XXX - Seems to be an unused endpoint? -Bobby @@ -21,7 +16,6 @@ Function Invoke-ListSharepointSettings { $Tenant = $Request.Query.tenantFilter $Request = New-GraphGetRequest -tenantid $Tenant -Uri 'https://graph.microsoft.com/beta/admin/sharepoint/settings' - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Request) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSites.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSites.ps1 index ace86380a27b..029bf4cb0a33 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSites.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSites.ps1 @@ -9,8 +9,6 @@ Function Invoke-ListSites { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -116,7 +114,6 @@ Function Invoke-ListSites { $GraphRequest = $GraphRequest | Where-Object { $null -ne $_.webUrl } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest | Sort-Object -Property displayName) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeams.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeams.ps1 index a2956bd57576..5cb4c62cb734 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeams.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeams.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListTeams { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter if ($request.query.type -eq 'List') { @@ -40,7 +35,6 @@ Function Invoke-ListTeams { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsActivity.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsActivity.ps1 index 1ba4401689a1..c47c472847ad 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsActivity.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsActivity.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListTeamsActivity { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $type = $request.Query.Type @@ -24,7 +18,6 @@ Function Invoke-ListTeamsActivity { @{ Name = 'CallCount'; Expression = { $_.'Call Count' } }, @{ Name = 'MeetingCount'; Expression = { $_.'Meeting Count' } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsLisLocation.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsLisLocation.ps1 index 386a2c37d7d0..3beacbef166a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsLisLocation.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsLisLocation.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListTeamsLisLocation { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - $TenantFilter = $Request.Query.TenantFilter try { $EmergencyLocations = New-TeamsRequest -TenantFilter $TenantFilter -Cmdlet 'Get-CsOnlineLisLocation' @@ -24,7 +18,6 @@ Function Invoke-ListTeamsLisLocation { $StatusCode = [HttpStatusCode]::Forbidden $EmergencyLocations = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($EmergencyLocations) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsVoice.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsVoice.ps1 index fe6255fc4fd4..31c4e9d925e6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsVoice.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListTeamsVoice.ps1 @@ -9,11 +9,6 @@ function Invoke-ListTeamsVoice { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $TenantId = (Get-Tenants -TenantFilter $TenantFilter).customerId diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-AddAlert.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-AddAlert.ps1 index eefc22f15941..35d3cf183af3 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-AddAlert.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-AddAlert.ps1 @@ -9,10 +9,6 @@ Function Invoke-AddAlert { #> [CmdletBinding()] param($Request, $TriggerMetadata) - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $Tenants = $Request.Body.tenantFilter $Conditions = $Request.Body.conditions | ConvertTo-Json -Compress -Depth 10 | Out-String @@ -33,7 +29,6 @@ Function Invoke-AddAlert { Add-CIPPAzDataTableEntity @WebhookTable -Entity $CompleteObject -Force $Results = "Added Audit Log Alert for $($Tenants.count) tenants. It may take up to four hours before Microsoft starts delivering these alerts." - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{ 'Results' = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAlertsQueue.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAlertsQueue.ps1 index e7b84a7f30cc..b95e7bf1914d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAlertsQueue.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAlertsQueue.ps1 @@ -9,12 +9,6 @@ function Invoke-ListAlertsQueue { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - $WebhookTable = Get-CIPPTable -TableName 'WebhookRules' $WebhookRules = Get-CIPPAzDataTableEntity @WebhookTable @@ -158,7 +152,6 @@ function Invoke-ListAlertsQueue { } $finalList = ConvertTo-Json -InputObject @($AllTasksArrayList) -Depth 10 - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $finalList diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogSearches.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogSearches.ps1 index 1a1d3058a370..ef5a2ff069d6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogSearches.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogSearches.ps1 @@ -6,12 +6,6 @@ function Invoke-ListAuditLogSearches { Tenant.Alert.Read #> Param($Request, $TriggerMetadata) - - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with the query parameters $TenantFilter = $Request.Query.tenantFilter $SearchId = $Request.Query.SearchId diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogTest.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogTest.ps1 index 7a2863b97225..0f0efa9cbeff 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogTest.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogTest.ps1 @@ -7,11 +7,6 @@ function Invoke-ListAuditLogTest { Tenant.Alert.Read #> Param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $AuditLogQuery = @{ TenantFilter = $Request.Query.TenantFilter SearchId = $Request.Query.SearchId diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogs.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogs.ps1 index 8f4592d152d2..39094c47afe0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogs.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogs.ps1 @@ -7,11 +7,6 @@ function Invoke-ListAuditLogs { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $LogID = $Request.Query.LogId diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListWebhookAlert.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListWebhookAlert.ps1 index eda834a77367..056af13d5681 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListWebhookAlert.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListWebhookAlert.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListWebhookAlert { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $Table = Get-CippTable -TableName 'SchedulerConfig' $WebhookRow = foreach ($Webhook in (Get-CIPPAzDataTableEntity @Table | Where-Object -Property PartitionKey -EQ 'WebhookAlert')) { diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-PublicWebhooks.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-PublicWebhooks.ps1 index 29cbc52ff0c3..1c0056d7bcb0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-PublicWebhooks.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-PublicWebhooks.ps1 @@ -7,8 +7,6 @@ function Invoke-PublicWebhooks { Public #> param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -82,7 +80,6 @@ function Invoke-PublicWebhooks { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-RemoveQueuedAlert.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-RemoveQueuedAlert.ps1 index 241654fc3501..74911c552c76 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-RemoveQueuedAlert.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-RemoveQueuedAlert.ps1 @@ -39,7 +39,6 @@ Function Invoke-RemoveQueuedAlert { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAddMultiTenantApp.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAddMultiTenantApp.ps1 index be88599827d0..737b3b3988c9 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAddMultiTenantApp.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAddMultiTenantApp.ps1 @@ -8,11 +8,6 @@ function Invoke-ExecAddMultiTenantApp { Tenant.Application.ReadWrite #> param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - if ($Request.Body.configMode -eq 'manual') { $DelegateResources = $request.body.permissions | Where-Object -Property origin -EQ 'Delegated' | ForEach-Object { @{ id = $_.id; type = 'Scope' } } $DelegateResourceAccess = @{ ResourceAppId = '00000003-0000-0000-c000-000000000000'; resourceAccess = $DelegateResources } @@ -96,7 +91,6 @@ function Invoke-ExecAddMultiTenantApp { $StatusCode = [HttpStatusCode]::OK } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ Results = @($Results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppApproval.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppApproval.ps1 index b9b7668f6790..5c6684b10154 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppApproval.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppApproval.ps1 @@ -9,12 +9,6 @@ function Invoke-ExecAppApproval { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Seems to be an unused endpoint? -Bobby $ApplicationId = if ($Request.Query.ApplicationId) { $Request.Query.ApplicationId } else { $env:ApplicationID } @@ -25,7 +19,6 @@ function Invoke-ExecAppApproval { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppPermissionTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppPermissionTemplate.ps1 index 04136ffa030f..ed347dc8dc35 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppPermissionTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppPermissionTemplate.ps1 @@ -7,8 +7,6 @@ function Invoke-ExecAppPermissionTemplate { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecApplication.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecApplication.ps1 index 472e3badc4c8..64de2982c341 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecApplication.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecApplication.ps1 @@ -7,11 +7,6 @@ function Invoke-ExecApplication { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $ValidTypes = @('applications', 'servicePrincipals') $ValidActions = @('Update', 'Upsert', 'Delete', 'RemoveKey', 'RemovePassword') diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecAddSPN.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecAddSPN.ps1 index 6d16db86a5cf..2a9c34cb908d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecAddSPN.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecAddSPN.ps1 @@ -26,7 +26,6 @@ Function Invoke-ExecAddSPN { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecOnboardTenant.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecOnboardTenant.ps1 index 3f0e25b42729..9c45644738bd 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecOnboardTenant.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecOnboardTenant.ps1 @@ -109,7 +109,6 @@ function Invoke-ExecOnboardTenant { $StatusCode = [HttpStatusCode]::NotFound $Results = 'Relationship not found' } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecUpdateSecureScore.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecUpdateSecureScore.ps1 index b0733ffb4f92..b1f2ea58adca 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecUpdateSecureScore.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ExecUpdateSecureScore.ps1 @@ -39,7 +39,6 @@ function Invoke-ExecUpdateSecureScore { $StatusCode = [HttpStatusCode]::InternalServerError } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListAppConsentRequests.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListAppConsentRequests.ps1 index d3263c17ff7f..4ad0e1c59397 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListAppConsentRequests.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListAppConsentRequests.ps1 @@ -8,11 +8,6 @@ function Invoke-ListAppConsentRequests { Tenant.Administration.Read #> param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $RequestStatus = $Request.Query.RequestStatus diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListDomains.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListDomains.ps1 index fca25bb32218..79274ceee784 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListDomains.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListDomains.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListDomains { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -24,7 +19,6 @@ Function Invoke-ListDomains { $Result = Get-NormalizedError -Message $_.Exception.Message $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Result) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListTenantOnboarding.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListTenantOnboarding.ps1 index 6442c6b76189..3fd36731e3f4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListTenantOnboarding.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListTenantOnboarding.ps1 @@ -6,13 +6,6 @@ function Invoke-ListTenantOnboarding { Tenant.Administration.Read #> Param($Request, $TriggerMetadata) - - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - try { $OnboardTable = Get-CIPPTable -TableName 'TenantOnboarding' $TenantOnboardings = Get-CIPPAzDataTableEntity @OnboardTable @@ -33,7 +26,6 @@ function Invoke-ListTenantOnboarding { $Results = "Function Error: $($ErrorMessage.LineNumber) - $($ErrorMessage.NormalizedError)" $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-SetAuthMethod.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-SetAuthMethod.ps1 index 805f932ae9df..8c7ab7fab111 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-SetAuthMethod.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-SetAuthMethod.ps1 @@ -25,7 +25,6 @@ function Invoke-SetAuthMethod { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = [pscustomobject]@{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-AddTenant.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-AddTenant.ps1 index c7b9369b8f6f..3d83a04a2bd6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-AddTenant.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-AddTenant.ps1 @@ -7,8 +7,6 @@ function Invoke-AddTenant { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-EditTenant.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-EditTenant.ps1 index dcc527594eb9..d3c2a3d8839b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-EditTenant.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-EditTenant.ps1 @@ -67,6 +67,24 @@ function Invoke-EditTenant { Remove-AzDataTableEntity @GroupMembersTable -Entity $Group } } + $DomainBasedEntries = Get-CIPPAzDataTableEntity @GroupMembersTable -Filter "customerId eq '$($Tenant.defaultDomainName)'" + if ($DomainBasedEntries) { + foreach ($Entry in $DomainBasedEntries) { + try { + # Add corrected GUID-based entry using the actual GUID + $NewEntry = @{ + PartitionKey = 'Member' + RowKey = '{0}-{1}' -f $Entry.GroupId, $Tenant.customerId + GroupId = $Entry.GroupId + customerId = $Tenant.customerId + } + Add-CIPPAzDataTableEntity @GroupMembersTable -Entity $NewEntry -Force + Remove-AzDataTableEntity @GroupMembersTable -Entity $Entry + } catch { + Write-Host "Error migrating entry: $($_.Exception.Message)" + } + } + } $response = @{ state = 'success' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-ListTenantDetails.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-ListTenantDetails.ps1 index 28dfb0529911..5f012df42471 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-ListTenantDetails.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-ListTenantDetails.ps1 @@ -37,7 +37,6 @@ Function Invoke-ListTenantDetails { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $org diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-RemoveTenantCapabilitiesCache.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-RemoveTenantCapabilitiesCache.ps1 index 9e9362ba4ee0..f5b27c71c5dd 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-RemoveTenantCapabilitiesCache.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-RemoveTenantCapabilitiesCache.ps1 @@ -52,7 +52,6 @@ function Invoke-RemoveTenantCapabilitiesCache { $body = [pscustomobject]@{'Results' = "Failed to remove capabilities cache: $($ErrorMessage.NormalizedError)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCAPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCAPolicy.ps1 index 1b48d110f7ce..88ff3e660363 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCAPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCAPolicy.ps1 @@ -30,7 +30,6 @@ function Invoke-AddCAPolicy { $body = [pscustomobject]@{'Results' = @($results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCATemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCATemplate.ps1 index 28cc6522e652..df622abf040a 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCATemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCATemplate.ps1 @@ -40,7 +40,6 @@ Function Invoke-AddCATemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = "$Result" } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddNamedLocation.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddNamedLocation.ps1 index 1c99da78bb40..6532fccdd147 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddNamedLocation.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddNamedLocation.ps1 @@ -11,10 +11,6 @@ function Invoke-AddNamedLocation { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Input bindings are passed in via param block. $Tenants = $request.body.selectedTenants.value Write-Host ($Request.body | ConvertTo-Json) @@ -53,7 +49,6 @@ function Invoke-AddNamedLocation { $body = [pscustomobject]@{'Results' = @($results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-EditCAPolicy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-EditCAPolicy.ps1 index 491944eb2f4b..e29b22f5ce83 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-EditCAPolicy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-EditCAPolicy.ps1 @@ -47,7 +47,6 @@ Function Invoke-EditCAPolicy { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ 'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCACheck.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCACheck.ps1 index f4581259475e..46b9c114cf7f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCACheck.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCACheck.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecCaCheck { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Tenant = $Request.Body.tenantFilter $UserID = $Request.Body.userID.value if ($Request.Body.IncludeApplications.value) { @@ -52,7 +47,6 @@ function Invoke-ExecCaCheck { $body = [pscustomobject]@{'Results' = $results } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAExclusion.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAExclusion.ps1 index 25fdb9e83668..f3f93952dfa4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAExclusion.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAExclusion.ps1 @@ -9,8 +9,6 @@ function Invoke-ExecCAExclusion { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers try { diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAServiceExclusion.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAServiceExclusion.ps1 index ea3a7aaee4db..caad66025035 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAServiceExclusion.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAServiceExclusion.ps1 @@ -9,8 +9,6 @@ Function Invoke-ExecCAServiceExclusion { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecNamedLocation.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecNamedLocation.ps1 index 5b52a01af173..bc32207a8a7b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecNamedLocation.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecNamedLocation.ps1 @@ -31,7 +31,6 @@ function Invoke-ExecNamedLocation { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = @($results) } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListCAtemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListCAtemplates.ps1 index 80a282dad8ab..a8e41c61e7d5 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListCAtemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListCAtemplates.ps1 @@ -9,12 +9,6 @@ function Invoke-ListCAtemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - Write-Host $Request.query.id #Migrating old policies whenever you do a list $Table = Get-CippTable -tablename 'templates' @@ -52,7 +46,6 @@ function Invoke-ListCAtemplates { if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property GUID -EQ $Request.query.id } $Templates = ConvertTo-Json -InputObject @($Templates) -Depth 100 - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Templates diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListConditionalAccessPolicies.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListConditionalAccessPolicies.ps1 index 836a8de81d21..d0a773cf234e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListConditionalAccessPolicies.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListConditionalAccessPolicies.ps1 @@ -9,12 +9,6 @@ function Invoke-ListConditionalAccessPolicies { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - function Get-LocationNameFromId { [CmdletBinding()] param ( @@ -206,7 +200,6 @@ function Invoke-ListConditionalAccessPolicies { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListConditionalAccessPolicyChanges.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListConditionalAccessPolicyChanges.ps1 index 3bd65d4e3c73..f0faa4e98169 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListConditionalAccessPolicyChanges.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListConditionalAccessPolicyChanges.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListConditionalAccessPolicyChanges { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $PolicyId = $Request.Query.id @@ -38,7 +33,6 @@ Function Invoke-ListConditionalAccessPolicyChanges { $Changes = "Failed to request audit logs for policy $($PolicyDisplayName): $($_.Exception.message)" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Changes) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-RemoveCATemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-RemoveCATemplate.ps1 index 6ef2e9154a60..c6ee4819e14f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-RemoveCATemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-RemoveCATemplate.ps1 @@ -32,7 +32,6 @@ Function Invoke-RemoveCATemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecAddGDAPRole.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecAddGDAPRole.ps1 index 058b0b74cdd2..9a3e740a5517 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecAddGDAPRole.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecAddGDAPRole.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecAddGDAPRole { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Action = $Request.Body.Action ?? $Request.Query.Action ?? 'AddRoleSimple' $GroupBlockList = @('All Users', 'AdminAgents', 'HelpdeskAgents', 'SalesAgents') @@ -174,7 +169,6 @@ function Invoke-ExecAddGDAPRole { } $body = @{Results = @($Results) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecAutoExtendGDAP.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecAutoExtendGDAP.ps1 index 3068af16d2a7..1097b7159b04 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecAutoExtendGDAP.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecAutoExtendGDAP.ps1 @@ -9,15 +9,9 @@ Function Invoke-ExecAutoExtendGDAP { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Id = $Request.query.ID ?? $Request.Body.ID $Results = Set-CIPPGDAPAutoExtend -RelationShipid $Id - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{ Results = $Results } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecDeleteGDAPRelationship.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecDeleteGDAPRelationship.ps1 index 17c4ea8fac95..e2c612cf713d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecDeleteGDAPRelationship.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecDeleteGDAPRelationship.ps1 @@ -25,7 +25,6 @@ Function Invoke-ExecDeleteGDAPRelationship { $Results = [pscustomobject]@{'Results' = "Failed. $($_.Exception.Message)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecDeleteGDAPRoleMapping.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecDeleteGDAPRoleMapping.ps1 index c8378e1482b5..3aa93068bfca 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecDeleteGDAPRoleMapping.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecDeleteGDAPRoleMapping.ps1 @@ -28,7 +28,6 @@ Function Invoke-ExecDeleteGDAPRoleMapping { $Results = [pscustomobject]@{'Results' = "Failed. $($_.Exception.Message)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecGDAPInviteApproved.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecGDAPInviteApproved.ps1 index 3c37dccb3c8c..87674d1c2a75 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecGDAPInviteApproved.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecGDAPInviteApproved.ps1 @@ -9,11 +9,6 @@ Function Invoke-ExecGDAPInviteApproved { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - Set-CIPPGDAPInviteGroups $body = @{Results = @('Processing recently activated GDAP relationships') } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecGDAPRoleTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecGDAPRoleTemplate.ps1 index de35431a643d..b4d831485acb 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecGDAPRoleTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ExecGDAPRoleTemplate.ps1 @@ -96,7 +96,6 @@ Function Invoke-ExecGDAPRoleTemplate { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPAccessAssignments.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPAccessAssignments.ps1 index ab6e3f1ae122..a8312cdc0bcb 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPAccessAssignments.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPAccessAssignments.ps1 @@ -5,11 +5,6 @@ function Invoke-ListGDAPAccessAssignments { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Id = $Request.Query.Id $TenantFilter = $env:TenantID diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPInvite.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPInvite.ps1 index 7ec0dda4179a..f1c7abcf37d7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPInvite.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPInvite.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListGDAPInvite { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $RelationshipId = $Request.Query.RelationshipId @@ -27,7 +21,6 @@ Function Invoke-ListGDAPInvite { $_ } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Invite) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPRoles.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPRoles.ps1 index 5e7ce289ea09..7e2c9d07bef1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPRoles.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPRoles.ps1 @@ -9,13 +9,6 @@ Function Invoke-ListGDAPRoles { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - $Table = Get-CIPPTable -TableName 'GDAPRoles' $Groups = Get-CIPPAzDataTableEntity @Table @@ -28,7 +21,6 @@ Function Invoke-ListGDAPRoles { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($MappedGroups) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListLicenses.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListLicenses.ps1 index 411922a3ddc2..01033ca6b57e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListLicenses.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListLicenses.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListLicenses { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $RawGraphRequest = if ($TenantFilter -ne 'AllTenants') { diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListOAuthApps.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListOAuthApps.ps1 index 5851b40e61cf..2e427b7bf68b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListOAuthApps.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListOAuthApps.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListOAuthApps { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter if ($TenantFilter -eq 'AllTenants') { $Tenants = (Get-Tenants).defaultDomainName } else { $Tenants = $TenantFilter } @@ -44,7 +39,6 @@ Function Invoke-ListOAuthApps { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListServiceHealth.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListServiceHealth.ps1 index 457f706b76de..1e08cb9aec19 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListServiceHealth.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Reports/Invoke-ListServiceHealth.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListServiceHealth { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -49,7 +44,6 @@ Function Invoke-ListServiceHealth { $StatusCode = [HttpStatusCode]::OK - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsDeploy.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsDeploy.ps1 index 18d5e4167203..5cea870d38b8 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsDeploy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsDeploy.ps1 @@ -9,11 +9,6 @@ Function Invoke-AddStandardsDeploy { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $user = $request.headers.'x-ms-client-principal' $username = ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($user)) | ConvertFrom-Json).userDetails @@ -58,7 +53,6 @@ Function Invoke-AddStandardsDeploy { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1 index bb12d60b323d..a267e6290f99 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1 @@ -42,7 +42,6 @@ function Invoke-AddStandardsTemplate { Write-LogMessage -headers $Request.Headers -API $APINAME -message "Standards Template $($Request.body.templateName) with GUID $GUID added/edited." -Sev 'Info' $body = [pscustomobject]@{'Results' = 'Successfully added template'; Metadata = @{id = $GUID } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-BestPracticeAnalyser_List.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-BestPracticeAnalyser_List.ps1 index 567793894832..76ae034e8130 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-BestPracticeAnalyser_List.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-BestPracticeAnalyser_List.ps1 @@ -9,11 +9,6 @@ Function Invoke-BestPracticeAnalyser_List { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Tenants = Get-Tenants $Table = get-cipptable 'cachebpa' $Results = (Get-CIPPAzDataTableEntity @Table) | ForEach-Object { @@ -27,7 +22,6 @@ Function Invoke-BestPracticeAnalyser_List { } } Write-Host ($Tenants | ConvertTo-Json) - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @(($Results | Where-Object -Property RowKey -In $Tenants.customerId)) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardConvert.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardConvert.ps1 index 3b562e2872df..05e6b89ccb54 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardConvert.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardConvert.ps1 @@ -231,7 +231,6 @@ function Invoke-ExecStandardConvert { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = 'Successfully converted legacy standards to new format' diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardsRun.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardsRun.ps1 index cf77a523380a..4f36fc2e96e4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardsRun.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardsRun.ps1 @@ -65,7 +65,6 @@ function Invoke-ExecStandardsRun { $Results = [pscustomobject]@{'Results' = "$Results" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPA.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPA.ps1 index 3842f33051c1..b99e8d7dfae9 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPA.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListBPA.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListBPA { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $Table = Get-CippTable 'cachebpav2' @@ -100,7 +95,6 @@ Function Invoke-ListBPA { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = (ConvertTo-Json -Depth 15 -InputObject $Results) 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 726c674ca118..dc087f52e560 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 @@ -9,11 +9,6 @@ Function Invoke-ListBPATemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CippTable -tablename 'templates' $Templates = Get-ChildItem 'Config\*.BPATemplate.json' | ForEach-Object { @@ -47,7 +42,6 @@ Function Invoke-ListBPATemplates { } } | Sort-Object Name } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = ($Templates | ConvertTo-Json -Depth 10) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListDomainAnalyser.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListDomainAnalyser.ps1 index ddc35353bc28..4f0be1a432e6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListDomainAnalyser.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListDomainAnalyser.ps1 @@ -10,17 +10,11 @@ Function Invoke-ListDomainAnalyser { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $Results = Get-CIPPDomainAnalyser -TenantFilter $TenantFilter - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListDomainHealth.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListDomainHealth.ps1 index 4a6f5bad88ee..3d087144633b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListDomainHealth.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListDomainHealth.ps1 @@ -11,9 +11,6 @@ function Invoke-ListDomainHealth { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - Import-Module DNSHealth try { @@ -42,9 +39,6 @@ function Invoke-ListDomainHealth { $UserRoles = Get-CIPPAccessRole -Request $Request $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $StatusCode = [HttpStatusCode]::OK @@ -152,7 +146,6 @@ function Invoke-ListDomainHealth { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListStandards.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListStandards.ps1 index 63652c61a5a5..a0e1307fedcd 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListStandards.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListStandards.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListStandards { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -50,7 +45,6 @@ Function Invoke-ListStandards { $CurrentStandards = ConvertTo-Json -InputObject @($CurrentStandards) -Depth 15 -Compress } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $CurrentStandards diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListTenantAlignment.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListTenantAlignment.ps1 index 3ff0f3b293a3..7555e0dcb3f1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListTenantAlignment.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListTenantAlignment.ps1 @@ -11,8 +11,6 @@ function Invoke-ListTenantAlignment { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - try { # Use the new Get-CIPPTenantAlignment function to get alignment data $AlignmentData = Get-CIPPTenantAlignment diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveBPATemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveBPATemplate.ps1 index 9582ad9b750b..5e8b2e27c3a5 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveBPATemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveBPATemplate.ps1 @@ -32,7 +32,6 @@ Function Invoke-RemoveBPATemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandard.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandard.ps1 index 67b9dd7b6b2f..23d73f083a5f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandard.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandard.ps1 @@ -34,7 +34,6 @@ Function Invoke-RemoveStandard { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandardTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandardTemplate.ps1 index 174780eae9e6..bb4500e7b467 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandardTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandardTemplate.ps1 @@ -32,7 +32,6 @@ function Invoke-RemoveStandardTemplate { $StatusCode = [HttpStatusCode]::InternalServerError } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{'Results' = $Result } diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-listStandardTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-listStandardTemplates.ps1 index d9cbeccdfb2a..720ec42b1e45 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-listStandardTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-listStandardTemplates.ps1 @@ -9,10 +9,6 @@ function Invoke-listStandardTemplates { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - # Interact with query parameters or the body of the request. $ID = $Request.Query.id $Table = Get-CippTable -tablename 'templates' @@ -44,7 +40,6 @@ function Invoke-listStandardTemplates { } | Sort-Object -Property templateName if ($ID) { $Templates = $Templates | Where-Object GUID -EQ $ID } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Templates) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/invoke-DomainAnalyser_List.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/invoke-DomainAnalyser_List.ps1 index 6e78db2c3369..b441f709d7f0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/invoke-DomainAnalyser_List.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/invoke-DomainAnalyser_List.ps1 @@ -33,7 +33,6 @@ Function Invoke-DomainAnalyser_List { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-AddBPATemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-AddBPATemplate.ps1 index b2a60e62d88f..b4cf93e4a6c3 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-AddBPATemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-AddBPATemplate.ps1 @@ -11,9 +11,6 @@ Function Invoke-AddBPATemplate { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $Table = Get-CippTable -tablename 'templates' @@ -33,7 +30,6 @@ Function Invoke-AddBPATemplate { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-ExecGraphExplorerPreset.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-ExecGraphExplorerPreset.ps1 index d52a05d8db95..d789cdf6244b 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-ExecGraphExplorerPreset.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-ExecGraphExplorerPreset.ps1 @@ -9,8 +9,6 @@ function Invoke-ExecGraphExplorerPreset { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers $Username = ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Headers.'x-ms-client-principal')) | ConvertFrom-Json).userDetails @@ -110,7 +108,6 @@ function Invoke-ExecGraphExplorerPreset { $Message = $_.Exception.Message $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecBreachSearch.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecBreachSearch.ps1 index b50f261e5c22..ca96a29cfab1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecBreachSearch.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecBreachSearch.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecBreachSearch { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.body.tenantFilter diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1 index 62a74a9920b8..370cb17d27a1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1 @@ -9,8 +9,6 @@ function Invoke-ExecCSPLicense { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecExtensionNinjaOneQueue.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecExtensionNinjaOneQueue.ps1 index 1b14f232f0b9..3ae4826f5c1e 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecExtensionNinjaOneQueue.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecExtensionNinjaOneQueue.ps1 @@ -9,11 +9,6 @@ function Invoke-ExecExtensionNinjaOneQueue { #> [CmdletBinding()] param($Request, $TriggerMetadata) - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - switch ($QueueItem.NinjaAction) { 'StartAutoMapping' { Invoke-NinjaOneOrgMapping } 'AutoMapTenant' { Invoke-NinjaOneOrgMappingTenant -QueueItem $QueueItem } diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecListAppId.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecListAppId.ps1 index a6f062bcafff..9a47e8181996 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecListAppId.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecListAppId.ps1 @@ -10,9 +10,6 @@ Function Invoke-ExecListAppId { [CmdletBinding()] param($Request, $TriggerMetadata) Get-CIPPAuthentication - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - $ResponseURL = "$(($Request.headers.'x-ms-original-url').replace('/api/ExecListAppId','/api/ExecSAMSetup'))" #make sure we get the very latest version of the appid from kv: if ($env:AzureWebJobsStorage -eq 'UseDevelopmentStorage=true' -or $env:NonLocalHostAzurite -eq 'true') { @@ -54,7 +51,6 @@ Function Invoke-ExecListAppId { tenantId = $env:TenantID refreshUrl = "https://login.microsoftonline.com/$env:TenantID/oauth2/v2.0/authorize?client_id=$env:ApplicationID&response_type=code&redirect_uri=$ResponseURL&response_mode=query&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access+profile+openid&state=1&prompt=select_account" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSchedulerBillingRun.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSchedulerBillingRun.ps1 index e90e843739b7..6326ffadc30d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSchedulerBillingRun.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSchedulerBillingRun.ps1 @@ -9,8 +9,6 @@ Function Invoke-ExecSchedulerBillingRun { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSendOrgMessage.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSendOrgMessage.ps1 index bc2b66ce39c8..b8e8821949a2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSendOrgMessage.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecSendOrgMessage.ps1 @@ -9,14 +9,6 @@ Function Invoke-ExecSendOrgMessage { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter $Device = $request.query.ID @@ -115,7 +107,6 @@ Function Invoke-ExecSendOrgMessage { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecUniversalSearch.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecUniversalSearch.ps1 index c169b239bbc5..1c8532c272c7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecUniversalSearch.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecUniversalSearch.ps1 @@ -9,14 +9,6 @@ Function Invoke-ExecUniversalSearch { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - # Interact with query parameters or the body of the request. try { @@ -50,7 +42,6 @@ Function Invoke-ExecUniversalSearch { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = "Could not connect to Azure Lighthouse API: $($ErrorMessage)" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecUserSettings.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecUserSettings.ps1 index 266091ae27aa..6a5418c21d34 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecUserSettings.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecUserSettings.ps1 @@ -8,11 +8,6 @@ function Invoke-ExecUserSettings { CIPP.Core.ReadWrite #> param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $object = $Request.Body.currentSettings | Select-Object * -ExcludeProperty CurrentTenant, pageSizes, sidebarShow, sidebarUnfoldable, _persist | ConvertTo-Json -Compress -Depth 10 $User = $Request.Body.user @@ -30,7 +25,6 @@ function Invoke-ExecUserSettings { $Results = "Function Error: $ErrorMsg" $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAllTenantDeviceCompliance.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAllTenantDeviceCompliance.ps1 index 4387a8db82ca..9edfc9447d56 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAllTenantDeviceCompliance.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAllTenantDeviceCompliance.ps1 @@ -9,14 +9,6 @@ Function Invoke-ListAllTenantDeviceCompliance { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter try { @@ -37,7 +29,6 @@ Function Invoke-ListAllTenantDeviceCompliance { $StatusCode = [HttpStatusCode]::Forbidden $GraphRequest = "Could not connect to Azure Lighthouse API: $($ErrorMessage)" } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAppStatus.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAppStatus.ps1 index 853178d32b1c..cac1e2d79204 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAppStatus.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAppStatus.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListAppStatus { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $appFilter = $Request.Query.AppFilter @@ -31,7 +25,6 @@ Function Invoke-ListAppStatus { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesAccount.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesAccount.ps1 index 5276345c265a..b2738ac953d3 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesAccount.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesAccount.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListBreachesAccount { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $Account = $Request.Query.account @@ -23,7 +18,6 @@ Function Invoke-ListBreachesAccount { $Results = Get-BreachInfo -Domain $Account } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($results) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesTenant.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesTenant.ps1 index 2ceee5165522..1242c1c4f8b2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesTenant.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesTenant.ps1 @@ -9,11 +9,6 @@ function Invoke-ListBreachesTenant { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $TenantFilter = $Request.Query.tenantFilter $Table = Get-CIPPTable -TableName UserBreaches @@ -30,7 +25,6 @@ function Invoke-ListBreachesTenant { if ($null -eq $usersResults) { $usersResults = @() } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($usersResults) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCSPLicenses.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCSPLicenses.ps1 index 687f60f632fe..6b23f637bdf2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCSPLicenses.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCSPLicenses.ps1 @@ -9,11 +9,6 @@ function Invoke-ListCSPLicenses { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -25,7 +20,6 @@ function Invoke-ListCSPLicenses { $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Result) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCSPsku.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCSPsku.ps1 index edc4fdfa40d2..b933d89b4123 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCSPsku.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCSPsku.ps1 @@ -9,11 +9,6 @@ function Invoke-ListCSPsku { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $CurrentSkuOnly = $Request.Query.currentSkuOnly diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCheckExtAlerts.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCheckExtAlerts.ps1 index 214b27a63cd5..4e1f68ed4183 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCheckExtAlerts.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListCheckExtAlerts.ps1 @@ -29,7 +29,6 @@ function Invoke-ListCheckExtAlerts { $Alerts = @() } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($Alerts | Sort-Object -Property Timestamp -Descending) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListDeviceDetails.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListDeviceDetails.ps1 index 34c5583c8366..1e172524084d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListDeviceDetails.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListDeviceDetails.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListDeviceDetails { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # XXX Seems to be an unused endpoint? -Bobby # Interact with query parameters or the body of the request. @@ -92,7 +87,6 @@ Function Invoke-ListDeviceDetails { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = $GraphRequest diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListExtensionsConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListExtensionsConfig.ps1 index ec79da9c11ce..1efadcaeb604 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListExtensionsConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListExtensionsConfig.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListExtensionsConfig { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CIPPTable -TableName Extensionsconfig try { $Body = (Get-CIPPAzDataTableEntity @Table).config | ConvertFrom-Json -Depth 10 -ErrorAction Stop @@ -34,7 +29,6 @@ Function Invoke-ListExtensionsConfig { Write-Information (Get-CippException -Exception $_ | ConvertTo-Json) $Body = @{} } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListExternalTenantInfo.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListExternalTenantInfo.ps1 index 98ea7b76858a..c888ebd21b35 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListExternalTenantInfo.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListExternalTenantInfo.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListExternalTenantInfo { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $HttpResponse = [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = "Default response, you should never see this" diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionParameters.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionParameters.ps1 index 818327c7a7a4..344062635701 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionParameters.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionParameters.ps1 @@ -8,11 +8,6 @@ function Invoke-ListFunctionParameters { CIPP.Core.Read #> param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $Module = $Request.Query.Module $Function = $Request.Query.Function @@ -78,7 +73,6 @@ function Invoke-ListFunctionParameters { $Results = "Function Error: $($_.Exception.Message)" $StatusCode = [HttpStatusCode]::BadRequest } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionStats.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionStats.ps1 index ac8bf318728a..b8dd380be573 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionStats.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionStats.ps1 @@ -9,11 +9,6 @@ function Invoke-ListFunctionStats { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $TenantFilter = $Request.Query.tenantFilter $PartitionKey = $Request.Query.FunctionType diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListGenericTestFunction.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListGenericTestFunction.ps1 index 6d3dcf995bdc..4088ae471611 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListGenericTestFunction.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListGenericTestFunction.ps1 @@ -9,8 +9,6 @@ function Invoke-ListGenericTestFunction { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListGraphExplorerPresets.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListGraphExplorerPresets.ps1 index ed968d711a21..b9b69f30c76c 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListGraphExplorerPresets.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListGraphExplorerPresets.ps1 @@ -9,8 +9,6 @@ function Invoke-ListGraphExplorerPresets { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers @@ -39,7 +37,6 @@ function Invoke-ListGraphExplorerPresets { Write-Information $_.InvocationInfo.PositionMessage $Results = @() } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{ diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListHaloClients.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListHaloClients.ps1 index dad22ab2e0e4..33c7a86a9d3f 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListHaloClients.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListHaloClients.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListHaloClients { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. try { $Table = Get-CIPPTable -TableName Extensionsconfig @@ -41,7 +35,6 @@ Function Invoke-ListHaloClients { $HaloClients = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($HaloClients) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListIPWhitelist.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListIPWhitelist.ps1 index c5e7162ba852..d70658e02748 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListIPWhitelist.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListIPWhitelist.ps1 @@ -9,15 +9,9 @@ Function Invoke-ListIPWhitelist { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CippTable -tablename 'trustedIps' $body = Get-CIPPAzDataTableEntity @Table - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($body) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListIntuneIntents.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListIntuneIntents.ps1 index 57cf736b970a..e5318023dbb4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListIntuneIntents.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListIntuneIntents.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListIntuneIntents { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -26,7 +21,6 @@ Function Invoke-ListIntuneIntents { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListKnownIPDb.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListKnownIPDb.ps1 index cc17377f8acd..a050303715dd 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListKnownIPDb.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListKnownIPDb.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListKnownIPDb { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -22,7 +17,6 @@ Function Invoke-ListKnownIPDb { $Filter = "Tenant eq '$($TenantFilter)'" $KnownIPDb = Get-CIPPAzDataTableEntity @Table -Filter $Filter - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($KnownIPDb) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListLogs.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListLogs.ps1 index 7d77bdaaa504..fe959329e094 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListLogs.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListLogs.ps1 @@ -9,11 +9,6 @@ function Invoke-ListLogs { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CIPPTable $ReturnedLog = if ($Request.Query.ListLogs) { diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNamedLocations.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNamedLocations.ps1 index c0549a5d5b13..72cbd7395bdc 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNamedLocations.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNamedLocations.ps1 @@ -9,14 +9,6 @@ Function Invoke-ListNamedLocations { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.TenantFilter try { @@ -32,7 +24,6 @@ Function Invoke-ListNamedLocations { $GraphRequest = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($GraphRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNotificationConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNotificationConfig.ps1 index e6d2c36140c7..5ff29124f649 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNotificationConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNotificationConfig.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListNotificationConfig { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $Table = Get-CIPPTable -TableName SchedulerConfig $Filter = "RowKey eq 'CippNotifications' and PartitionKey eq 'CippNotifications'" $Config = Get-CIPPAzDataTableEntity @Table -Filter $Filter @@ -34,7 +29,6 @@ Function Invoke-ListNotificationConfig { } $body = [PSCustomObject]$Config - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListOrg.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListOrg.ps1 index 021024ab19d8..2b36051c7f33 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListOrg.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListOrg.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListOrg { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter if ($TenantFilter -eq 'AllTenants') { @@ -23,7 +17,6 @@ Function Invoke-ListOrg { $GraphRequest = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/organization' -tenantid $TenantFilter } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $GraphRequest diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPartnerRelationships.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPartnerRelationships.ps1 index c97bb4cbc082..99918d39d6bc 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPartnerRelationships.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPartnerRelationships.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListPartnerRelationships { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter @@ -35,7 +30,6 @@ Function Invoke-ListPartnerRelationships { $Results = [PSCustomObject]@{ Results = @($GraphRequest) } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = $Results diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPendingWebhooks.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPendingWebhooks.ps1 index 452922bdf874..ca43313e64c7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPendingWebhooks.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPendingWebhooks.ps1 @@ -9,11 +9,6 @@ function Invoke-ListPendingWebhooks { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $Table = Get-CIPPTable -TableName 'WebhookIncoming' $Webhooks = Get-CIPPAzDataTableEntity @Table @@ -29,7 +24,6 @@ function Invoke-ListPendingWebhooks { } catch { $PendingWebhooks = @() } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @{ diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPotentialApps.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPotentialApps.ps1 index d10e59fac14c..55dc058db6a2 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPotentialApps.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListPotentialApps.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListPotentialApps { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - if ($request.body.type -eq 'WinGet') { $body = @" {"MaximumResults":50,"Filters":[{"PackageMatchField":"Market","RequestMatch":{"KeyWord":"US","MatchType":"CaseInsensitive"}}],"Query":{"KeyWord":"$($Request.Body.SearchString)","MatchType":"Substring"}} @@ -26,7 +21,6 @@ Function Invoke-ListPotentialApps { } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = @($DataRequest) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListRoles.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListRoles.ps1 index af82ab3ca246..8e149a820fbe 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListRoles.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListRoles.ps1 @@ -9,12 +9,6 @@ Function Invoke-ListRoles { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $SelectList = 'id', 'displayName', 'userPrincipalName' @@ -31,7 +25,6 @@ Function Invoke-ListRoles { } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $GraphRequest diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListTenantAllowBlockList.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListTenantAllowBlockList.ps1 index e028a25cb92a..8ddf7b00b0af 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListTenantAllowBlockList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListTenantAllowBlockList.ps1 @@ -9,11 +9,6 @@ Function Invoke-ListTenantAllowBlockList { #> [CmdletBinding()] param($Request, $TriggerMetadata) - - $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - # Interact with query parameters or the body of the request. $TenantFilter = $Request.Query.tenantFilter $ListTypes = 'Sender', 'Url', 'FileHash', 'IP' @@ -31,7 +26,6 @@ Function Invoke-ListTenantAllowBlockList { $StatusCode = [HttpStatusCode]::Forbidden $Results = $ErrorMessage } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = @($Results) diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-PublicPhishingCheck.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-PublicPhishingCheck.ps1 index e7efda5cf1f8..86f1095a43f6 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-PublicPhishingCheck.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-PublicPhishingCheck.ps1 @@ -40,7 +40,6 @@ function Invoke-PublicPhishingCheck { #Write-AlertMessage -message $Message -sev 'Alert' -tenant $Tenant.customerId -LogData $Request.body } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = 'OK' diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-RemoveTenantAllowBlockList.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-RemoveTenantAllowBlockList.ps1 index 2e6ceb7574a1..42bb5bb86914 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-RemoveTenantAllowBlockList.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-RemoveTenantAllowBlockList.ps1 @@ -44,7 +44,6 @@ function Invoke-RemoveTenantAllowBlockList { $StatusCode = [HttpStatusCode]::Forbidden } - # Associate values to output bindings by calling 'Push-OutputBinding'. return ([HttpResponseContext]@{ StatusCode = $StatusCode Body = @{ diff --git a/Modules/CIPPCore/Public/Invoke-RemoveQueuedApp.ps1 b/Modules/CIPPCore/Public/Invoke-RemoveQueuedApp.ps1 index 9422d735b134..f54ceb7c2cac 100644 --- a/Modules/CIPPCore/Public/Invoke-RemoveQueuedApp.ps1 +++ b/Modules/CIPPCore/Public/Invoke-RemoveQueuedApp.ps1 @@ -11,9 +11,6 @@ function Invoke-RemoveQueuedApp { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - $ID = $request.body.ID try { $Table = Get-CippTable -tablename 'apps' @@ -31,7 +28,6 @@ function Invoke-RemoveQueuedApp { } $body = [pscustomobject]@{'Results' = $Message } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = $StatusCode Body = $body diff --git a/Modules/CIPPCore/Public/New-CIPPAssignmentFilter.ps1 b/Modules/CIPPCore/Public/New-CIPPAssignmentFilter.ps1 new file mode 100644 index 000000000000..ce7e8824fd3f --- /dev/null +++ b/Modules/CIPPCore/Public/New-CIPPAssignmentFilter.ps1 @@ -0,0 +1,80 @@ +function New-CIPPAssignmentFilter { + <# + .SYNOPSIS + Creates a new assignment filter in Microsoft Intune + + .DESCRIPTION + Unified function for creating assignment filters that handles all platform types consistently. + Used by both direct filter creation and assignment filter template application. + + .PARAMETER FilterObject + Object containing filter properties (displayName, description, platform, rule, etc.) + + .PARAMETER TenantFilter + The tenant domain name where the filter should be created + + .PARAMETER APIName + The API name for logging purposes + + .PARAMETER ExecutingUser + The user executing the request (for logging) + + .EXAMPLE + New-CIPPAssignmentFilter -FilterObject $FilterData -TenantFilter 'contoso.com' -APIName 'AddAssignmentFilter' + + .NOTES + Supports all platform types: Windows10AndLater, iOS, Android, macOS, etc. + #> + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [PSCustomObject]$FilterObject, + + [Parameter(Mandatory = $true)] + [string]$TenantFilter, + + [Parameter(Mandatory = $false)] + [string]$APIName = 'New-CIPPAssignmentFilter', + + [Parameter(Mandatory = $false)] + [string]$ExecutingUser = 'CIPP' + ) + + try { + Write-LogMessage -API $APIName -tenant $TenantFilter -message "Creating assignment filter $($FilterObject.displayName) for platform $($FilterObject.platform)" -Sev Info + + # Build the request body for Graph API + $BodyParams = [PSCustomObject]@{ + '@odata.type' = '#microsoft.graph.deviceAndAppManagementAssignmentFilter' + 'displayName' = $FilterObject.displayName + 'description' = $FilterObject.description ?? '' + 'platform' = $FilterObject.platform + 'rule' = $FilterObject.rule + 'assignmentFilterManagementType' = $FilterObject.assignmentFilterManagementType ?? 'devices' + } + + # Create the assignment filter via Graph API + $GraphRequest = New-GraphPostRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/assignmentFilters' -tenantid $TenantFilter -type POST -body (ConvertTo-Json -InputObject $BodyParams -Depth 10) + + $Result = [PSCustomObject]@{ + Success = $true + Message = "Successfully created assignment filter $($FilterObject.displayName)" + FilterId = $GraphRequest.id + Platform = $FilterObject.platform + } + + Write-LogMessage -API $APIName -tenant $TenantFilter -message "Created assignment filter $($FilterObject.displayName) with id $($Result.FilterId)" -Sev Info + return $Result + + } catch { + $ErrorMessage = Get-CippException -Exception $_ + Write-LogMessage -API $APIName -tenant $TenantFilter -message "Assignment filter creation failed for $($FilterObject.displayName): $($ErrorMessage.NormalizedError)" -Sev Error -LogData $ErrorMessage + + return [PSCustomObject]@{ + Success = $false + Message = "Failed to create assignment filter $($FilterObject.displayName): $($ErrorMessage.NormalizedError)" + Error = $ErrorMessage.NormalizedError + Platform = $FilterObject.platform + } + } +} diff --git a/Modules/CIPPCore/Public/New-CIPPBackup.ps1 b/Modules/CIPPCore/Public/New-CIPPBackup.ps1 index 024ba4571721..7d64760ad5c4 100644 --- a/Modules/CIPPCore/Public/New-CIPPBackup.ps1 +++ b/Modules/CIPPCore/Public/New-CIPPBackup.ps1 @@ -17,6 +17,7 @@ function New-CIPPBackup { 'AppPermissions' 'AccessRoleGroups' 'ApiClients' + 'CippReplacemap' 'CustomData' 'CustomRoles' 'Config' diff --git a/Modules/CIPPCore/Public/New-CIPPBackupTask.ps1 b/Modules/CIPPCore/Public/New-CIPPBackupTask.ps1 index 1814abc23fe0..1d824262d601 100644 --- a/Modules/CIPPCore/Public/New-CIPPBackupTask.ps1 +++ b/Modules/CIPPCore/Public/New-CIPPBackupTask.ps1 @@ -6,6 +6,25 @@ function New-CIPPBackupTask { ) $BackupData = switch ($Task) { + 'CippCustomVariables' { + Write-Host "Backing up Custom Variables for $TenantFilter" + $ReplaceTable = Get-CIPPTable -tablename 'CippReplacemap' + + # Get tenant-specific variables + $Tenant = Get-Tenants -TenantFilter $TenantFilter + $CustomerId = $Tenant.customerId + + $TenantVariables = Get-CIPPAzDataTableEntity @ReplaceTable -Filter "PartitionKey eq '$CustomerId'" + + # If backing up AllTenants, also get global variables + if ($TenantFilter -eq 'AllTenants') { + $GlobalVariables = Get-CIPPAzDataTableEntity @ReplaceTable -Filter "PartitionKey eq 'AllTenants'" + $AllVariables = @($TenantVariables) + @($GlobalVariables) + $AllVariables + } else { + $TenantVariables + } + } 'users' { Write-Host "Backup users for $TenantFilter" $Users = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/users?$top=999' -tenantid $TenantFilter | Select-Object * -ExcludeProperty mail, provisionedPlans, onPrem*, *passwordProfile*, *serviceProvisioningErrors*, isLicenseReconciliationNeeded, isManagementRestricted, isResourceAccount, *date*, *external*, identities, deletedDateTime, isSipEnabled, assignedPlans, cloudRealtimeCommunicationInfo, deviceKeys, provisionedPlan, securityIdentifier diff --git a/Modules/CIPPCore/Public/New-CIPPRestoreTask.ps1 b/Modules/CIPPCore/Public/New-CIPPRestoreTask.ps1 index a16760daf7ce..2e19b3f3f0a2 100644 --- a/Modules/CIPPCore/Public/New-CIPPRestoreTask.ps1 +++ b/Modules/CIPPCore/Public/New-CIPPRestoreTask.ps1 @@ -11,6 +11,46 @@ function New-CIPPRestoreTask { $Table = Get-CippTable -tablename 'ScheduledBackup' $BackupData = Get-CIPPAzDataTableEntity @Table -Filter "RowKey eq '$backup'" $RestoreData = switch ($Task) { + 'CippCustomVariables' { + Write-Host "Restore Custom Variables for $TenantFilter" + $ReplaceTable = Get-CIPPTable -TableName 'CippReplacemap' + $Backup = $BackupData.CippCustomVariables | ConvertFrom-Json + + $Tenant = Get-Tenants -TenantFilter $TenantFilter + $CustomerId = $Tenant.customerId + + try { + foreach ($variable in $Backup) { + $entity = @{ + PartitionKey = $CustomerId + RowKey = $variable.RowKey + Value = $variable.Value + Description = $variable.Description + } + + if ($overwrite) { + Add-CIPPAzDataTableEntity @ReplaceTable -Entity $entity -Force + Write-LogMessage -message "Restored custom variable $($variable.RowKey) from backup" -Sev 'info' + "Restored custom variable $($variable.RowKey) from backup" + } else { + # Check if variable already exists + $existing = Get-CIPPAzDataTableEntity @ReplaceTable -Filter "PartitionKey eq '$CustomerId' and RowKey eq '$($variable.RowKey)'" + if (!$existing) { + Add-CIPPAzDataTableEntity @ReplaceTable -Entity $entity -Force + Write-LogMessage -message "Restored custom variable $($variable.RowKey) from backup" -Sev 'info' + "Restored custom variable $($variable.RowKey) from backup" + } else { + Write-LogMessage -message "Custom variable $($variable.RowKey) already exists and overwrite is disabled" -Sev 'info' + "Custom variable $($variable.RowKey) already exists and overwrite is disabled" + } + } + } + } catch { + $ErrorMessage = Get-NormalizedError -Message $_.Exception.Message + "Could not restore Custom Variables: $ErrorMessage" + Write-LogMessage -Headers $Headers -API $APINAME -message "Could not restore Custom Variables: $ErrorMessage" -Sev 'Error' + } + } 'users' { $currentUsers = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/users?$top=999&select=id,userPrincipalName' -tenantid $TenantFilter $backupUsers = $BackupData.users | ConvertFrom-Json diff --git a/Modules/CIPPCore/Public/Set-CIPPAssignedPolicy.ps1 b/Modules/CIPPCore/Public/Set-CIPPAssignedPolicy.ps1 index 20097526e01d..afe026749296 100644 --- a/Modules/CIPPCore/Public/Set-CIPPAssignedPolicy.ps1 +++ b/Modules/CIPPCore/Public/Set-CIPPAssignedPolicy.ps1 @@ -8,12 +8,31 @@ function Set-CIPPAssignedPolicy { $TenantFilter, $PlatformType = 'deviceManagement', $APIName = 'Assign Policy', - $Headers + $Headers, + $AssignmentFilterName, + $AssignmentFilterType = 'include' ) Write-Host "Assigning policy $PolicyId ($PlatformType/$Type) to $GroupName" try { + # Resolve assignment filter name to ID if provided + $ResolvedFilterId = $null + if ($AssignmentFilterName) { + Write-Host "Looking up assignment filter by name: $AssignmentFilterName" + $AllFilters = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/assignmentFilters' -tenantid $TenantFilter + $MatchingFilter = $AllFilters | Where-Object { $_.displayName -like $AssignmentFilterName } | Select-Object -First 1 + + if ($MatchingFilter) { + $ResolvedFilterId = $MatchingFilter.id + Write-Host "Found assignment filter: $($MatchingFilter.displayName) with ID: $ResolvedFilterId" + } else { + $ErrorMessage = "No assignment filter found matching the name: $AssignmentFilterName. Policy assigned without filter." + Write-LogMessage -headers $Headers -API $APIName -message $ErrorMessage -Sev 'Warning' -tenant $TenantFilter + Write-Host $ErrorMessage + } + } + $assignmentsList = New-Object System.Collections.Generic.List[System.Object] switch ($GroupName) { 'allLicensedUsers' { @@ -103,6 +122,18 @@ function Set-CIPPAssignedPolicy { } } + # Add assignment filter to each assignment if specified + if ($ResolvedFilterId) { + Write-Host "Adding assignment filter $ResolvedFilterId with type $AssignmentFilterType to assignments" + foreach ($assignment in $assignmentsList) { + # Don't add filters to exclusion targets + if ($assignment.target.'@odata.type' -ne '#microsoft.graph.exclusionGroupAssignmentTarget') { + $assignment.target.deviceAndAppManagementAssignmentFilterId = $ResolvedFilterId + $assignment.target.deviceAndAppManagementAssignmentFilterType = $AssignmentFilterType + } + } + } + $assignmentsObject = [PSCustomObject]@{ assignments = $assignmentsList } diff --git a/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 b/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 index 7b7ee7fe629b..e465e7552887 100644 --- a/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 +++ b/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 @@ -9,7 +9,9 @@ function Set-CIPPIntunePolicy { $ExcludeGroup, $Headers, $APINAME, - $tenantFilter + $tenantFilter, + $AssignmentFilterName, + $AssignmentFilterType = 'include' ) $APINAME = 'Set-CIPPIntunePolicy' @@ -244,7 +246,21 @@ function Set-CIPPIntunePolicy { Write-Host "Assigning policy to $($AssignTo) with ID $($CreateRequest.id) and type $TemplateTypeURL for tenant $tenantFilter" Write-Host "ID is $($CreateRequest.id)" - Set-CIPPAssignedPolicy -GroupName $AssignTo -PolicyId $CreateRequest.id -PlatformType $PlatformType -Type $TemplateTypeURL -TenantFilter $tenantFilter -ExcludeGroup $ExcludeGroup + $AssignParams = @{ + GroupName = $AssignTo + PolicyId = $CreateRequest.id + PlatformType = $PlatformType + Type = $TemplateTypeURL + TenantFilter = $tenantFilter + ExcludeGroup = $ExcludeGroup + } + + if ($AssignmentFilterName) { + $AssignParams.AssignmentFilterName = $AssignmentFilterName + $AssignParams.AssignmentFilterType = $AssignmentFilterType + } + + Set-CIPPAssignedPolicy @AssignParams } return "Successfully $($PostType) policy for $($tenantFilter) with display name $($Displayname)" } catch { diff --git a/Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 b/Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 index 32e907e15669..19b9db51942c 100644 --- a/Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 +++ b/Modules/CIPPCore/Public/Set-CIPPUserLicense.ps1 @@ -5,7 +5,8 @@ function Set-CIPPUserLicense { [Parameter(Mandatory)][string]$TenantFilter, [Parameter()][array]$AddLicenses = @(), [Parameter()][array]$RemoveLicenses = @(), - $Headers + $Headers, + $APIName = 'Set User License' ) # Build the addLicenses array @@ -28,7 +29,25 @@ function Set-CIPPUserLicense { Write-Host "License body JSON: $LicenseBodyJson" try { - $null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$UserId/assignLicense" -tenantid $TenantFilter -type POST -body $LicenseBodyJson -Verbose + try { + $null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$UserId/assignLicense" -tenantid $TenantFilter -type POST -body $LicenseBodyJson -Verbose + } catch { + # Handle if the error is due to missing usage location + if ($_.Exception.Message -like '*invalid usage location*') { + $Table = Get-CippTable -tablename 'UserSettings' + $UserSettings = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'UserSettings' and RowKey eq 'allUsers'" + if ($UserSettings) { $DefaultUsageLocation = (ConvertFrom-Json $UserSettings.JSON -Depth 5 -ErrorAction SilentlyContinue).usageLocation.value } + $DefaultUsageLocation ??= 'US' # Fallback to US if not set + + $UsageLocationJson = ConvertTo-Json -InputObject @{'usageLocation' = $DefaultUsageLocation } -Depth 5 -Compress + $null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$UserId" -tenantid $TenantFilter -type PATCH -body $UsageLocationJson -Verbose + Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message "Set usage location for user $UserId to $DefaultUsageLocation" -Sev 'Info' + # Retry assigning the license + $null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$UserId/assignLicense" -tenantid $TenantFilter -type POST -body $LicenseBodyJson -Verbose + } else { + throw $_ + } + } } catch { $ErrorMessage = Get-CippException -Exception $_ Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message "Failed to assign the license. Error: $($ErrorMessage.NormalizedError)" -Sev Error -LogData $ErrorMessage diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAntiPhishPolicy.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAntiPhishPolicy.ps1 index b878868701ce..2192e715ee90 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAntiPhishPolicy.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAntiPhishPolicy.ps1 @@ -64,18 +64,26 @@ function Invoke-CIPPStandardAntiPhishPolicy { $MDOLicensed = $ServicePlans -contains "ATP_ENTERPRISE" Write-Information "MDOLicensed: $MDOLicensed" - $PolicyList = @('CIPP Default Anti-Phishing Policy','Default Anti-Phishing Policy') - $ExistingPolicy = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AntiPhishPolicy' | Where-Object -Property Name -In $PolicyList + # Use custom name if provided, otherwise use default for backward compatibility + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default Anti-Phishing Policy' } + $PolicyList = @($PolicyName, 'CIPP Default Anti-Phishing Policy','Default Anti-Phishing Policy') + $ExistingPolicy = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AntiPhishPolicy' | Where-Object -Property Name -In $PolicyList | Select-Object -First 1 if ($null -eq $ExistingPolicy.Name) { - $PolicyName = $PolicyList[0] + # No existing policy - use the configured/default name + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default Anti-Phishing Policy' } } else { + # Use existing policy name if found $PolicyName = $ExistingPolicy.Name } - $RuleList = @( 'CIPP Default Anti-Phishing Rule','CIPP Default Anti-Phishing Policy') - $ExistingRule = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AntiPhishRule' | Where-Object -Property Name -In $RuleList + # Derive rule name from policy name, but check for old names for backward compatibility + $DesiredRuleName = "$PolicyName Rule" + $RuleList = @($DesiredRuleName, 'CIPP Default Anti-Phishing Rule','CIPP Default Anti-Phishing Policy') + $ExistingRule = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AntiPhishRule' | Where-Object -Property Name -In $RuleList | Select-Object -First 1 if ($null -eq $ExistingRule.Name) { - $RuleName = $RuleList[0] + # No existing rule - use the derived name + $RuleName = $DesiredRuleName } else { + # Use existing rule name if found $RuleName = $ExistingRule.Name } diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAssignmentFilterTemplate.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAssignmentFilterTemplate.ps1 new file mode 100644 index 000000000000..5cececa9417b --- /dev/null +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAssignmentFilterTemplate.ps1 @@ -0,0 +1,126 @@ +function Invoke-CIPPStandardAssignmentFilterTemplate { + <# + .FUNCTIONALITY + Internal + .COMPONENT + (APIName) AssignmentFilterTemplate + .SYNOPSIS + (Label) Assignment Filter Template + .DESCRIPTION + (Helptext) Deploy and manage assignment filter templates. + (DocsDescription) Deploy and manage assignment filter templates. + .NOTES + MULTI + True + CAT + Templates + DISABLEDFEATURES + {"report":true,"warn":true,"remediate":false} + IMPACT + Medium Impact + ADDEDDATE + 2025-10-04 + EXECUTIVETEXT + Creates standardized assignment filters with predefined settings. These templates ensure consistent assignment filter configurations across the organization, streamlining assignment management. + ADDEDCOMPONENT + {"type":"autoComplete","name":"assignmentFilterTemplate","label":"Select Assignment Filter Template","api":{"url":"/api/ListAssignmentFilterTemplates","labelField":"Displayname","altLabelField":"displayName","valueField":"GUID","queryKey":"ListAssignmentFilterTemplates"}} + UPDATECOMMENTBLOCK + Run the Tools\Update-StandardsComments.ps1 script to update this comment block + .LINK + https://docs.cipp.app/user-documentation/tenant/standards/list-standards + #> + param($Tenant, $Settings) + + ##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'AssignmentFilterTemplate' + $existingFilters = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/assignmentFilters' -tenantid $tenant + + $Settings.assignmentFilterTemplate ? ($Settings | Add-Member -NotePropertyName 'TemplateList' -NotePropertyValue $Settings.assignmentFilterTemplate) : $null + + $Table = Get-CippTable -tablename 'templates' + $Filter = "PartitionKey eq 'AssignmentFilterTemplate' and (RowKey eq '$($Settings.TemplateList.value -join "' or RowKey eq '")')" + $AssignmentFilterTemplates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter).JSON | ConvertFrom-Json + + if ($Settings.remediate -eq $true) { + Write-Host "Settings: $($Settings.TemplateList | ConvertTo-Json)" + foreach ($Template in $AssignmentFilterTemplates) { + Write-Information "Processing template: $($Template.displayName)" + try { + $filterobj = $Template + + # Check if filter already exists + $CheckExisting = $existingFilters | Where-Object -Property displayName -EQ $filterobj.displayName + + if (!$CheckExisting) { + Write-Information 'Creating assignment filter' + $ActionType = 'create' + + # Use the centralized New-CIPPAssignmentFilter function + $Result = New-CIPPAssignmentFilter -FilterObject $filterobj -TenantFilter $tenant -APIName 'Standards' -ExecutingUser 'CIPP-Standards' + + if (!$Result.Success) { + Write-Information "Failed to create assignment filter $($filterobj.displayName): $($Result.Message)" + continue + } + } else { + $ActionType = 'update' + + # Compare existing filter with template to determine what needs updating + $PatchBody = [PSCustomObject]@{} + $ChangesNeeded = [System.Collections.Generic.List[string]]::new() + + # Check description + if ($CheckExisting.description -ne $filterobj.description) { + $PatchBody | Add-Member -NotePropertyName 'description' -NotePropertyValue $filterobj.description + $ChangesNeeded.Add("description: '$($CheckExisting.description)' → '$($filterobj.description)'") + } + + # Check platform + if ($CheckExisting.platform -ne $filterobj.platform) { + $PatchBody | Add-Member -NotePropertyName 'platform' -NotePropertyValue $filterobj.platform + $ChangesNeeded.Add("platform: '$($CheckExisting.platform)' → '$($filterobj.platform)'") + } + + # Check rule + if ($CheckExisting.rule -ne $filterobj.rule) { + $PatchBody | Add-Member -NotePropertyName 'rule' -NotePropertyValue $filterobj.rule + $ChangesNeeded.Add("rule: '$($CheckExisting.rule)' → '$($filterobj.rule)'") + } + + # Check assignmentFilterManagementType + if ($CheckExisting.assignmentFilterManagementType -ne $filterobj.assignmentFilterManagementType) { + $PatchBody | Add-Member -NotePropertyName 'assignmentFilterManagementType' -NotePropertyValue $filterobj.assignmentFilterManagementType + $ChangesNeeded.Add("assignmentFilterManagementType: '$($CheckExisting.assignmentFilterManagementType)' → '$($filterobj.assignmentFilterManagementType)'") + } + + # Only patch if there are actual changes + if ($ChangesNeeded.Count -gt 0) { + $null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/deviceManagement/assignmentFilters/$($CheckExisting.id)" -tenantid $tenant -type PATCH -body (ConvertTo-Json -InputObject $PatchBody -Depth 10) + Write-LogMessage -API 'Standards' -tenant $tenant -message "Updated Assignment Filter '$($filterobj.displayName)' - Changes: $($ChangesNeeded -join ', ')" -Sev Info + } else { + Write-Information "Assignment Filter '$($filterobj.displayName)' already matches template - no update needed" + } + } + } catch { + $ErrorMessage = Get-NormalizedError -Message $_.Exception.Message + Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to $ActionType assignment filter $($filterobj.displayName). Error: $ErrorMessage" -sev 'Error' + } + } + } + if ($Settings.report -eq $true) { + # Check if all filters.displayName are in the existingFilters, if not $fieldvalue should contain all missing filters, else it should be true. + $MissingFilters = foreach ($Filter in $AssignmentFilterTemplates) { + $CheckExisting = $existingFilters | Where-Object { $_.displayName -eq $Filter.displayName } + if (!$CheckExisting) { + $Filter.displayName + } + } + + if ($MissingFilters.Count -eq 0) { + $fieldValue = $true + } else { + $fieldValue = $MissingFilters -join ', ' + } + + Set-CIPPStandardsCompareField -FieldName 'standards.AssignmentFilterTemplate' -FieldValue $fieldValue -Tenant $Tenant + } +} diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardIntuneTemplate.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardIntuneTemplate.ps1 index dd0eddb1a295..9e71c3a79077 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardIntuneTemplate.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardIntuneTemplate.ps1 @@ -92,38 +92,42 @@ function Invoke-CIPPStandardIntuneTemplate { if ($Compare) { Write-Host "IntuneTemplate: $($Template.TemplateList.value) - Compare found differences." [PSCustomObject]@{ - MatchFailed = $true - displayname = $displayname - description = $description - compare = $Compare - rawJSON = $RawJSON - body = $Request.body - assignTo = $Template.AssignTo - excludeGroup = $Template.excludeGroup - remediate = $Template.remediate - alert = $Template.alert - report = $Template.report - existingPolicyId = $ExistingPolicy.id - templateId = $Template.TemplateList.value - customGroup = $Template.customGroup + MatchFailed = $true + displayname = $displayname + description = $description + compare = $Compare + rawJSON = $RawJSON + body = $Request.body + assignTo = $Template.AssignTo + excludeGroup = $Template.excludeGroup + remediate = $Template.remediate + alert = $Template.alert + report = $Template.report + existingPolicyId = $ExistingPolicy.id + templateId = $Template.TemplateList.value + customGroup = $Template.customGroup + assignmentFilter = $Template.assignmentFilter + assignmentFilterType = $Template.assignmentFilterType } } else { Write-Host "IntuneTemplate: $($Template.TemplateList.value) - No differences found." [PSCustomObject]@{ - MatchFailed = $false - displayname = $displayname - description = $description - compare = $false - rawJSON = $RawJSON - body = $Request.body - assignTo = $Template.AssignTo - excludeGroup = $Template.excludeGroup - remediate = $Template.remediate - alert = $Template.alert - report = $Template.report - existingPolicyId = $ExistingPolicy.id - templateId = $Template.TemplateList.value - customGroup = $Template.customGroup + MatchFailed = $false + displayname = $displayname + description = $description + compare = $false + rawJSON = $RawJSON + body = $Request.body + assignTo = $Template.AssignTo + excludeGroup = $Template.excludeGroup + remediate = $Template.remediate + alert = $Template.alert + report = $Template.report + existingPolicyId = $ExistingPolicy.id + templateId = $Template.TemplateList.value + customGroup = $Template.customGroup + assignmentFilter = $Template.assignmentFilter + assignmentFilterType = $Template.assignmentFilterType } } } @@ -134,7 +138,24 @@ function Invoke-CIPPStandardIntuneTemplate { Write-Host "working on template deploy: $($TemplateFile.displayname)" try { $TemplateFile.customGroup ? ($TemplateFile.AssignTo = $TemplateFile.customGroup) : $null - Set-CIPPIntunePolicy -TemplateType $TemplateFile.body.Type -Description $TemplateFile.description -DisplayName $TemplateFile.displayname -RawJSON $templateFile.rawJSON -AssignTo $TemplateFile.AssignTo -ExcludeGroup $TemplateFile.excludeGroup -tenantFilter $Tenant + + $PolicyParams = @{ + TemplateType = $TemplateFile.body.Type + Description = $TemplateFile.description + DisplayName = $TemplateFile.displayname + RawJSON = $templateFile.rawJSON + AssignTo = $TemplateFile.AssignTo + ExcludeGroup = $TemplateFile.excludeGroup + tenantFilter = $Tenant + } + + # Add assignment filter if specified + if ($TemplateFile.assignmentFilter) { + $PolicyParams.AssignmentFilterName = $TemplateFile.assignmentFilter + $PolicyParams.AssignmentFilterType = $TemplateFile.assignmentFilterType ?? 'include' + } + + Set-CIPPIntunePolicy @PolicyParams } catch { $ErrorMessage = Get-NormalizedError -Message $_.Exception.Message Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to create or update Intune Template $($TemplateFile.displayname), Error: $ErrorMessage" -sev 'Error' diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardMalwareFilterPolicy.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardMalwareFilterPolicy.ps1 index bde96b7c1fde..2bae9f7d7439 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardMalwareFilterPolicy.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardMalwareFilterPolicy.ps1 @@ -50,18 +50,26 @@ function Invoke-CIPPStandardMalwareFilterPolicy { } #we're done. ##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'MalwareFilterPolicy' - $PolicyList = @('CIPP Default Malware Policy', 'Default Malware Policy') - $ExistingPolicy = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-MalwareFilterPolicy' | Where-Object -Property Name -In $PolicyList + # Use custom name if provided, otherwise use default for backward compatibility + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default Malware Policy' } + $PolicyList = @($PolicyName, 'CIPP Default Malware Policy', 'Default Malware Policy') + $ExistingPolicy = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-MalwareFilterPolicy' | Where-Object -Property Name -In $PolicyList | Select-Object -First 1 if ($null -eq $ExistingPolicy.Name) { - $PolicyName = $PolicyList[0] + # No existing policy - use the configured/default name + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default Malware Policy' } } else { + # Use existing policy name if found $PolicyName = $ExistingPolicy.Name } - $RuleList = @( 'CIPP Default Malware Rule', 'CIPP Default Malware Policy') - $ExistingRule = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-MalwareFilterRule' | Where-Object -Property Name -In $RuleList + # Derive rule name from policy name, but check for old names for backward compatibility + $DesiredRuleName = "$PolicyName Rule" + $RuleList = @($DesiredRuleName, 'CIPP Default Malware Rule', 'CIPP Default Malware Policy') + $ExistingRule = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-MalwareFilterRule' | Where-Object -Property Name -In $RuleList | Select-Object -First 1 if ($null -eq $ExistingRule.Name) { - $RuleName = $RuleList[0] + # No existing rule - use the derived name + $RuleName = $DesiredRuleName } else { + # Use existing rule name if found $RuleName = $ExistingRule.Name } diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeAttachmentPolicy.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeAttachmentPolicy.ps1 index 93fb399026c3..c2633efe5104 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeAttachmentPolicy.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeAttachmentPolicy.ps1 @@ -50,18 +50,26 @@ function Invoke-CIPPStandardSafeAttachmentPolicy { $MDOLicensed = $ServicePlans -contains 'ATP_ENTERPRISE' if ($MDOLicensed) { - $PolicyList = @('CIPP Default Safe Attachment Policy', 'Default Safe Attachment Policy') - $ExistingPolicy = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeAttachmentPolicy' | Where-Object -Property Name -In $PolicyList + # Use custom name if provided, otherwise use default for backward compatibility + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default Safe Attachment Policy' } + $PolicyList = @($PolicyName, 'CIPP Default Safe Attachment Policy', 'Default Safe Attachment Policy') + $ExistingPolicy = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeAttachmentPolicy' | Where-Object -Property Name -In $PolicyList | Select-Object -First 1 if ($null -eq $ExistingPolicy.Name) { - $PolicyName = $PolicyList[0] + # No existing policy - use the configured/default name + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default Safe Attachment Policy' } } else { + # Use existing policy name if found $PolicyName = $ExistingPolicy.Name } - $RuleList = @( 'CIPP Default Safe Attachment Rule', 'CIPP Default Safe Attachment Policy') - $ExistingRule = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeAttachmentRule' | Where-Object -Property Name -In $RuleList + # Derive rule name from policy name, but check for old names for backward compatibility + $DesiredRuleName = "$PolicyName Rule" + $RuleList = @($DesiredRuleName, 'CIPP Default Safe Attachment Rule', 'CIPP Default Safe Attachment Policy') + $ExistingRule = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeAttachmentRule' | Where-Object -Property Name -In $RuleList | Select-Object -First 1 if ($null -eq $ExistingRule.Name) { - $RuleName = $RuleList[0] + # No existing rule - use the derived name + $RuleName = $DesiredRuleName } else { + # Use existing rule name if found $RuleName = $ExistingRule.Name } diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeLinksPolicy.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeLinksPolicy.ps1 index 2f779112e006..ed5925224aa6 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeLinksPolicy.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeLinksPolicy.ps1 @@ -49,18 +49,26 @@ function Invoke-CIPPStandardSafeLinksPolicy { $MDOLicensed = $ServicePlans -contains 'ATP_ENTERPRISE' if ($MDOLicensed) { - $PolicyList = @('CIPP Default SafeLinks Policy', 'Default SafeLinks Policy') - $ExistingPolicy = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeLinksPolicy' | Where-Object -Property Name -In $PolicyList + # Use custom name if provided, otherwise use default for backward compatibility + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default SafeLinks Policy' } + $PolicyList = @($PolicyName, 'CIPP Default SafeLinks Policy', 'Default SafeLinks Policy') + $ExistingPolicy = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeLinksPolicy' | Where-Object -Property Name -In $PolicyList | Select-Object -First 1 if ($null -eq $ExistingPolicy.Name) { - $PolicyName = $PolicyList[0] + # No existing policy - use the configured/default name + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default SafeLinks Policy' } } else { + # Use existing policy name if found $PolicyName = $ExistingPolicy.Name } - $RuleList = @( 'CIPP Default SafeLinks Rule', 'CIPP Default SafeLinks Policy') - $ExistingRule = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeLinksRule' | Where-Object -Property Name -In $RuleList + # Derive rule name from policy name, but check for old names for backward compatibility + $DesiredRuleName = "$PolicyName Rule" + $RuleList = @($DesiredRuleName, 'CIPP Default SafeLinks Rule', 'CIPP Default SafeLinks Policy') + $ExistingRule = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeLinksRule' | Where-Object -Property Name -In $RuleList | Select-Object -First 1 if ($null -eq $ExistingRule.Name) { - $RuleName = $RuleList[0] + # No existing rule - use the derived name + $RuleName = $DesiredRuleName } else { + # Use existing rule name if found $RuleName = $ExistingRule.Name } diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSpamFilterPolicy.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSpamFilterPolicy.ps1 index 0d614d9338e2..d85d0621f121 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSpamFilterPolicy.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSpamFilterPolicy.ps1 @@ -58,7 +58,8 @@ function Invoke-CIPPStandardSpamFilterPolicy { return $true } #we're done. - $PolicyName = 'CIPP Default Spam Filter Policy' + # Use custom name if provided, otherwise use default for backward compatibility + $PolicyName = if ($Settings.name) { $Settings.name } else { 'CIPP Default Spam Filter Policy' } try { $CurrentState = New-ExoRequest -TenantId $Tenant -cmdlet 'Get-HostedContentFilterPolicy' | diff --git a/Modules/CIPPCore/Public/Webhooks/Invoke-RemoveWebhookAlert.ps1 b/Modules/CIPPCore/Public/Webhooks/Invoke-RemoveWebhookAlert.ps1 index 4b30ff2f34bd..be8e5cdaa639 100644 --- a/Modules/CIPPCore/Public/Webhooks/Invoke-RemoveWebhookAlert.ps1 +++ b/Modules/CIPPCore/Public/Webhooks/Invoke-RemoveWebhookAlert.ps1 @@ -11,9 +11,6 @@ Function Invoke-RemoveWebhookAlert { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $Headers = $Request.Headers - - try { $WebhookTable = Get-CIPPTable -TableName 'SchedulerConfig' $WebhookRow = Get-CIPPAzDataTableEntity @WebhookTable -Filter "PartitionKey eq 'WebhookAlert'" | Where-Object -Property Tenant -EQ $Request.query.TenantFilter @@ -53,7 +50,6 @@ Function Invoke-RemoveWebhookAlert { $body = [pscustomobject]@{'Results' = "Failed to remove webhook alert: $($_.Exception.Message)" } } - # Associate values to output bindings by calling 'Push-OutputBinding'. return [HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = $body