Skip to content

Commit

Permalink
Merge pull request #1217 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
Dev to hotfix
  • Loading branch information
KelvinTegelaar authored Jan 13, 2025
2 parents 3bca2ce + 6d7962f commit 99c417b
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 21 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/dev_cipppwrro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Powershell project to Azure Function App - cipppwrro

on:
push:
branches:
- dev
workflow_dispatch:

env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root

jobs:
deploy:
runs-on: windows-latest

steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: 'cipppwrro'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_D5D7DFF930C04B519206F25DDCD88324 }}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

function Get-CippBreachAlert {
function Get-CippAlertBreachAlert {
<#
.FUNCTIONALITY
Entrypoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function Invoke-ExecCippFunction {
if (Get-Command -Module CIPPCore -Name $Function -and $BlockList -notcontains $Function) {
try {
$Results = & $Function @Params
if (!$Results) {
$Results = "Function $Function executed successfully"
}
$StatusCode = [HttpStatusCode]::OK
} catch {
$Results = $_.Exception.Message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ Function Invoke-ExecPartnerMode {
} catch {
}
}
} elseif ($Request.Body.TenantMode -eq 'PartnerTenantAvailable') {
$InputObject = [PSCustomObject]@{
Batch = @(
@{
FunctionName = 'UpdateTenants'
}
)
OrchestratorName = 'UpdateTenants'
SkipLog = $true
}
Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Compress -Depth 5)
}

Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Function Invoke-AddIntuneTemplate {

$body = [pscustomobject]@{'Results' = 'Successfully added template' }
} else {
$TenantFilter = $Request.Query.tenantFilter
$URLName = $Request.Query.URLName
$ID = $Request.Query.id
$TenantFilter = $Request.Body.tenantFilter ?? $Request.Query.tenantFilter
$URLName = $Request.Body.URLName ?? $Request.Query.URLName
$ID = $Request.Body.ID ?? $Request.Query.ID
$Template = New-CIPPIntuneTemplate -TenantFilter $TenantFilter -URLName $URLName -ID $ID
Write-Host "Template: $Template"
$object = [PSCustomObject]@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Function Invoke-AddGuest {
}
}
$bodyToShip = ConvertTo-Json -Depth 10 -InputObject $BodyToship -Compress
$GraphRequest = New-GraphPostRequest -uri 'https://graph.microsoft.com/beta/invitations' -tenantFilter $Userobj.tenantFilter -type POST -body $BodyToship -verbose
$GraphRequest = New-GraphPostRequest -uri 'https://graph.microsoft.com/beta/invitations' -tenantid $Userobj.tenantFilter -type POST -body $BodyToship -verbose
if ($Userobj.sendInvite -eq 'true') {
$results.add('Invited Guest. Invite Email sent')
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($userobj.tenantFilter) -message "Invited Guest $($userobj.displayname) with Email Invite " -Sev 'Info'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function Invoke-ExecStandardConvert {

if ($Tenant -eq 'AllTenants' -and $Excluded) {
$ExcludedArr = $Excluded | ForEach-Object { $_ }
$NewTemplate | Add-Member -NotePropertyName 'excludedTenants' -NotePropertyValue $ExcludedArr -Force
$NewTemplate | Add-Member -NotePropertyName 'excludedTenants' -NotePropertyValue @($ExcludedArr) -Force
}

return $NewTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Function Invoke-ListIntuneTemplates {
$data | Add-Member -NotePropertyName 'displayName' -NotePropertyValue $_.Displayname -Force
$data | Add-Member -NotePropertyName 'description' -NotePropertyValue $_.Description -Force
$data | Add-Member -NotePropertyName 'Type' -NotePropertyValue $_.Type -Force
$data | Add-Member -NotePropertyName 'GUID' -NotePropertyValue $_.GUID -Force
$data | Add-Member -NotePropertyName 'GUID' -NotePropertyValue $_.RowKey -Force
$data
} | Sort-Object -Property displayName
}
Expand Down
3 changes: 2 additions & 1 deletion Modules/CIPPCore/Public/Get-CIPPTimerFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ function Get-CIPPTimerFunctions {
Parameters = $Orchestrator.Parameters ?? @{}
Cron = $CronString
NextOccurrence = $NextOccurrence.ToUniversalTime()
LastOccurrence = $Status.LastOccurrence.DateTime
LastOccurrence = $Status.LastOccurrence
Status = $Status.Status
OrchestratorId = $Status.OrchestratorId
RunOnProcessor = $Orchestrator.RunOnProcessor
IsSystem = $Orchestrator.IsSystem ?? $false
PreferredProcessor = $Orchestrator.PreferredProcessor ?? ''
ErrorMsg = $Status.ErrorMsg ?? ''
}
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions Modules/CIPPCore/Public/GraphHelper/Get-AuthorisedRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ function Get-AuthorisedRequest {
if (!$TenantID) {
$TenantID = $env:TenantID
}

if ($Uri -like 'https://graph.microsoft.com/beta/contracts*' -or $Uri -like '*/customers/*' -or $Uri -eq 'https://graph.microsoft.com/v1.0/me/sendMail' -or $Uri -like '*/tenantRelationships/*' -or $Uri -like '*/security/partner/*') {
return $true
}
$Tenants = Get-Tenants -IncludeErrors
$SkipList = Get-Tenants -SkipList
$Tenant = Get-Tenants -TenantFilter $TenantID | Where-Object { $_.Excluded -eq $false }

if (($SkipList.customerId -notcontains $TenantID -and $SkipList.defaultDomainName -notcontains $TenantID) -or (($Tenants.customerId -contains $TenantID -or $Tenants.defaultDomainName -contains $TenantID) -and $TenantID -ne $env:TenantID)) {
if ($Tenant) {
return $true
} else {
return $false
Expand Down
2 changes: 1 addition & 1 deletion Modules/CIPPCore/Public/GraphHelper/Get-Tenants.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Get-Tenants {

$IncludedTenantsCache = Get-CIPPAzDataTableEntity @TenantsTable -Filter $Filter

if (($IncludedTenantsCache | Measure-Object).Count -eq 0) {
if (($IncludedTenantsCache | Measure-Object).Count -eq 0 -and $TenantFilter -ne $env:TenantID) {
$BuildRequired = $true
}

Expand Down
18 changes: 10 additions & 8 deletions Modules/CIPPCore/Public/GraphHelper/New-GraphGetRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@ function New-GraphGetRequest {
.FUNCTIONALITY
Internal
#>
[CmdletBinding()]
Param(
$uri,
$tenantid,
$scope,
$AsApp,
$noPagination,
$NoAuthCheck,
$skipTokenCache,
[string]$uri,
[string]$tenantid,
[string]$scope,
[bool]$AsApp,
[bool]$noPagination,
[bool]$NoAuthCheck,
[bool]$skipTokenCache,
$Caller,
[switch]$ComplexFilter,
[switch]$CountOnly,
[switch]$IncludeResponseHeaders
)
$IsAuthorised = Get-AuthorisedRequest -Uri $uri -TenantID $tenantid

if ($NoAuthCheck -or (Get-AuthorisedRequest -Uri $uri -TenantID $tenantid)) {
if ($NoAuthCheck -eq $true -or $IsAuthorised) {
if ($scope -eq 'ExchangeOnline') {
$AccessToken = Get-ClassicAPIToken -resource 'https://outlook.office365.com' -Tenantid $tenantid
$headers = @{ Authorization = "Bearer $($AccessToken.access_token)" }
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.1
7.0.2

0 comments on commit 99c417b

Please sign in to comment.