File tree Expand file tree Collapse file tree 5 files changed +26
-17
lines changed
CIPPCore/Public/Entrypoints/HTTP Functions Expand file tree Collapse file tree 5 files changed +26
-17
lines changed Original file line number Diff line number Diff line change 11using namespace System.Net
22
3- Function Invoke-GetCippAlerts {
3+ function Invoke-GetCippAlerts {
44 <#
55 . FUNCTIONALITY
66 Entrypoint,AnyTenant
@@ -60,7 +60,7 @@ Function Invoke-GetCippAlerts {
6060 type = ' error'
6161 })
6262 }
63- if ($env: WEBSITE_RUN_FROM_PACKAGE -ne ' 1 ' -and $env: AzureWebJobsStorage -ne ' UseDevelopmentStorage=true' ) {
63+ if (( ! $env: WEBSITE_RUN_FROM_PACKAGE -or [ string ]::IsNullOrEmpty( $ env: WEBSITE_RUN_FROM_PACKAGE )) -and $env: AzureWebJobsStorage -ne ' UseDevelopmentStorage=true' ) {
6464 $Alerts.Add (
6565 @ {
6666 title = ' Function App in Write Mode'
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ Function Invoke-ExecAlertsList {
4343 }
4444
4545 $DisplayableAlerts = New-FlatArray $AlertsObj | Where-Object { $null -ne $_.Id } | Sort-Object - Property EventDateTime - Descending
46+ if (! $DisplayableAlerts ) {
47+ $DisplayableAlerts = @ ()
48+ }
49+ $Metadata = [PSCustomObject ]@ {}
4650
4751 [PSCustomObject ]@ {
4852 NewAlertsCount = $DisplayableAlerts | Where-Object { $_.Status -eq ' newAlert' } | Measure-Object | Select-Object - ExpandProperty Count
@@ -51,7 +55,7 @@ Function Invoke-ExecAlertsList {
5155 SeverityMediumAlertsCount = $DisplayableAlerts | Where-Object { ($_.Status -eq ' inProgress' ) -or ($_.Status -eq ' newAlert' ) } | Where-Object { $_.Severity -eq ' medium' } | Measure-Object | Select-Object - ExpandProperty Count
5256 SeverityLowAlertsCount = $DisplayableAlerts | Where-Object { ($_.Status -eq ' inProgress' ) -or ($_.Status -eq ' newAlert' ) } | Where-Object { $_.Severity -eq ' low' } | Measure-Object | Select-Object - ExpandProperty Count
5357 SeverityInformationalCount = $DisplayableAlerts | Where-Object { ($_.Status -eq ' inProgress' ) -or ($_.Status -eq ' newAlert' ) } | Where-Object { $_.Severity -eq ' informational' } | Measure-Object | Select-Object - ExpandProperty Count
54- MSResults = $DisplayableAlerts
58+ MSResults = @ ( $DisplayableAlerts )
5559 }
5660 } else {
5761 $Table = Get-CIPPTable - TableName cachealertsandincidents
Original file line number Diff line number Diff line change @@ -28,7 +28,11 @@ Function Invoke-ListTeamsVoice {
2828 $data = (New-TeamsAPIGetRequest - uri " https://api.interfaces.records.teams.microsoft.com/Skype.TelephoneNumberMgmt/Tenants/$ ( $Tenantid ) /telephone-numbers?skip=$ ( $skip ) &locale=en-US&top=999" - tenantid $TenantFilter ).TelephoneNumbers | ForEach-Object {
2929 Write-Host ' Reached the loop'
3030 $CompleteRequest = $_ | Select-Object * , @ {Name = ' AssignedTo' ; Expression = { $users | Where-Object - Property id -EQ $_.AssignedTo.id } }
31- $CompleteRequest.AcquisitionDate ? ($CompleteRequest.AcquisitionDate = $CompleteRequest.AcquisitionDate -split ' T' | Select-Object - First 1 ) : ($CompleteRequest | Add-Member - NotePropertyName ' AcquisitionDate' - NotePropertyValue ' Unknown' - Force)
31+ if ($CompleteRequest.AcquisitionDate ) {
32+ $CompleteRequest.AcquisitionDate = $_.AcquisitionDate -split ' T' | Select-Object - First 1
33+ } else {
34+ $CompleteRequest | Add-Member - NotePropertyName ' AcquisitionDate' - NotePropertyValue ' Unknown' - Force
35+ }
3236 $CompleteRequest.AssignedTo ? $null : ($CompleteRequest | Add-Member - NotePropertyName ' AssignedTo' - NotePropertyValue ' Unassigned' - Force)
3337 $CompleteRequest
3438 }
Original file line number Diff line number Diff line change @@ -9,15 +9,16 @@ function Set-HaloMapping {
99 Remove-AzDataTableEntity - Force @CIPPMapping - Entity $_
1010 }
1111 foreach ($Mapping in $Request.Body ) {
12- $AddObject = @ {
13- PartitionKey = ' HaloMapping'
14- RowKey = " $ ( $mapping.TenantId ) "
15- IntegrationId = " $ ( $mapping.IntegrationId ) "
16- IntegrationName = " $ ( $mapping.IntegrationName ) "
12+ if ($Mapping.TenantId ) {
13+ $AddObject = @ {
14+ PartitionKey = ' HaloMapping'
15+ RowKey = " $ ( $mapping.TenantId ) "
16+ IntegrationId = " $ ( $mapping.IntegrationId ) "
17+ IntegrationName = " $ ( $mapping.IntegrationName ) "
18+ }
1719 }
1820
1921 Add-CIPPAzDataTableEntity @CIPPMapping - Entity $AddObject - Force
20-
2122 Write-LogMessage - API $APINAME - headers $Request.Headers - message " Added mapping for $ ( $mapping.name ) ." - Sev ' Info'
2223 }
2324 $Result = [pscustomobject ]@ {' Results' = ' Successfully edited mapping table.' }
Original file line number Diff line number Diff line change @@ -10,15 +10,15 @@ function Set-NinjaOneOrgMapping {
1010 Remove-AzDataTableEntity - Force @CIPPMapping - Entity $_
1111 }
1212 foreach ($Mapping in $Request.Body ) {
13- $AddObject = @ {
14- PartitionKey = ' NinjaOneMapping'
15- RowKey = " $ ( $mapping.TenantId ) "
16- IntegrationId = " $ ( $mapping.IntegrationId ) "
17- IntegrationName = " $ ( $mapping.IntegrationName ) "
13+ if ($Mapping.TenantId ) {
14+ $AddObject = @ {
15+ PartitionKey = ' NinjaOneMapping'
16+ RowKey = " $ ( $mapping.TenantId ) "
17+ IntegrationId = " $ ( $mapping.IntegrationId ) "
18+ IntegrationName = " $ ( $mapping.IntegrationName ) "
19+ }
1820 }
19-
2021 Add-CIPPAzDataTableEntity @CIPPMapping - Entity $AddObject - Force
21-
2222 Write-LogMessage - API $APINAME - headers $Request.Headers - message " Added mapping for $ ( $mapping.name ) ." - Sev ' Info'
2323 }
2424 $Result = [pscustomobject ]@ {' Results' = ' Successfully edited mapping table.' }
You can’t perform that action at this time.
0 commit comments