forked from KelvinTegelaar/CIPP-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request KelvinTegelaar#775 from KelvinTegelaar/dev
Dev to HF
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Modules/CIPPCore/Public/Entrypoints/Invoke-ListTenantAllowBlockList.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using namespace System.Net | ||
|
||
Function Invoke-ListTenantAllowBlockList { | ||
<# | ||
.FUNCTIONALITY | ||
Entrypoint | ||
#> | ||
[CmdletBinding()] | ||
param($Request, $TriggerMetadata) | ||
|
||
$APIName = $TriggerMetadata.FunctionName | ||
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug' | ||
|
||
|
||
# Write to the Azure Functions log stream. | ||
Write-Host 'PowerShell HTTP trigger function processed a request.' | ||
|
||
# Interact with query parameters or the body of the request. | ||
$TenantFilter = $Request.Query.TenantFilter | ||
$ListTypes = 'Sender','Url','FileHash' | ||
try { | ||
$Request = ForEach ($_ in $ListTypes) { | ||
@{ | ||
CmdletInput = @{ | ||
CmdletName = 'Get-TenantAllowBlockListItems' | ||
Parameters = @{ListType = $_ } | ||
} | ||
} | ||
} | ||
$BatchResults = New-ExoBulkRequest -tenantid $TenantFilter -cmdletArray $Request | ||
|
||
$StatusCode = [HttpStatusCode]::OK | ||
} catch { | ||
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message | ||
$StatusCode = [HttpStatusCode]::Forbidden | ||
$BatchResults = $ErrorMessage | ||
} | ||
# Associate values to output bindings by calling 'Push-OutputBinding'. | ||
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ | ||
StatusCode = $StatusCode | ||
Body = @($BatchResults) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.6.0 | ||
5.6.1 |