Skip to content

Commit 7571cfc

Browse files
authored
Merge pull request KelvinTegelaar#1410 from KelvinTegelaar/dev
Dev to hotfix
2 parents bb940ce + cd24286 commit 7571cfc

File tree

44 files changed

+804
-324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+804
-324
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
4+
name: Build and deploy Powershell project to Azure Function App - cippahmcc
5+
6+
on:
7+
push:
8+
branches:
9+
- dev
10+
workflow_dispatch:
11+
12+
env:
13+
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
14+
15+
jobs:
16+
deploy:
17+
runs-on: windows-latest
18+
19+
steps:
20+
- name: 'Checkout GitHub Action'
21+
uses: actions/checkout@v4
22+
23+
- name: 'Run Azure Functions Action'
24+
uses: Azure/functions-action@v1
25+
id: fa
26+
with:
27+
app-name: 'cippahmcc'
28+
slot-name: 'Production'
29+
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
30+
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_D6317AAB492A474D91B7A6CD29E53BA3 }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
4+
name: Build and deploy Powershell project to Azure Function App - cippmpiii
5+
6+
on:
7+
push:
8+
branches:
9+
- dev
10+
workflow_dispatch:
11+
12+
env:
13+
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: 'Checkout GitHub Action'
21+
uses: actions/checkout@v4
22+
23+
- name: 'Run Azure Functions Action'
24+
uses: Azure/functions-action@v1
25+
id: fa
26+
with:
27+
app-name: 'cippmpiii'
28+
slot-name: 'Production'
29+
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
30+
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_BC5F21E993034DF2A3793489CE4705E4 }}

Modules/CIPPCore/Private/Get-ExoOnlineStringBytes.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function Get-ExoOnlineStringBytes {
44
# This exists because various exo cmdlets like to return a human readable string like "3.322 KB (3,402 bytes)" but not the raw bytes value
55

66
if ($SizeString -match '\(([0-9,]+) bytes\)') {
7-
return [int]($Matches[1] -replace ',','')
7+
return [int64]($Matches[1] -replace ',','')
88
}
99

1010
return 0

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertDefenderIncidents.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ function Get-CIPPAlertDefenderIncidents {
1313
)
1414
try {
1515
$AlertData = New-GraphGetRequest -uri "https://graph.microsoft.com/v1.0/security/incidents?`$top=50&`$filter=status eq 'active'" -tenantid $TenantFilter | ForEach-Object {
16-
"Incident ID $($_.id): Created at $($_.createdDateTime). Severity: $($_.severity). `nIncident name: $($_.displayName). Incident URL: $($_.incidentWebUrl)."
16+
[PSCustomObject]@{
17+
IncidentID = $_.id
18+
CreatedAt = $_.createdDateTime
19+
Severity = $_.severity
20+
IncidentName = $_.displayName
21+
IncidentUrl = $_.incidentWebUrl
22+
Tenant = $TenantFilter
23+
}
1724
}
1825
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
1926

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertNewAppApproval.ps1

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,33 @@ function Get-CIPPAlertNewAppApproval {
1313
$Headers
1414
)
1515
try {
16-
$Approvals = New-GraphGetRequest -Uri "https://graph.microsoft.com/v1.0/identityGovernance/appConsent/appConsentRequests?`$filter=userConsentRequests/any (u:u/status eq 'InProgress')" -tenantid $TenantFilter
16+
$Approvals = New-GraphGetRequest -Uri "https://graph.microsoft.com/beta/identityGovernance/appConsent/appConsentRequests?`$filter=userConsentRequests/any (u:u/status eq 'InProgress')" -tenantid $TenantFilter
1717
if ($Approvals.count -gt 0) {
18-
$AlertData = "There are $($Approvals.count) App Approval(s) pending."
18+
$AlertData = [System.Collections.Generic.List[PSCustomObject]]::new()
19+
foreach ($App in $Approvals) {
20+
$userConsentRequests = New-GraphGetRequest -Uri "https://graph.microsoft.com/v1.0/identityGovernance/appConsent/appConsentRequests/$($App.id)/userConsentRequests" -tenantid $TenantFilter
21+
$userConsentRequests | ForEach-Object {
22+
$consentUrl = if ($App.consentType -eq 'Static') {
23+
# if something is going wrong here you've probably stumbled on a fourth variation - rvdwegen
24+
"https://login.microsoftonline.com/$($TenantFilter)/adminConsent?client_id=$($App.appId)&bf_id=$($App.id)&redirect_uri=https://entra.microsoft.com/TokenAuthorize"
25+
} elseif ($App.pendingScopes.displayName) {
26+
"https://login.microsoftonline.com/$($TenantFilter)/v2.0/adminConsent?client_id=$($App.appId)&scope=$($App.pendingScopes.displayName -Join(' '))&bf_id=$($App.id)&redirect_uri=https://entra.microsoft.com/TokenAuthorize"
27+
} else {
28+
"https://login.microsoftonline.com/$($TenantFilter)/adminConsent?client_id=$($App.appId)&bf_id=$($App.id)&redirect_uri=https://entra.microsoft.com/TokenAuthorize"
29+
}
30+
31+
$Message = [PSCustomObject]@{
32+
AppName = $App.appDisplayName
33+
RequestUser = $_.createdBy.user.userPrincipalName
34+
Reason = $_.reason
35+
AppId = $App.appId
36+
Scopes = ($App.pendingScopes.displayName -join ', ')
37+
ConsentURL = $consentUrl
38+
Tenant = $TenantFilter
39+
}
40+
$AlertData.Add($Message)
41+
}
42+
}
1943
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
2044
}
2145
} catch {

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Applications/Push-UploadApplication.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function Push-UploadApplication {
2626
$intunewinFilesize = (Get-Item "AddMSPApp\$($ChocoApp.MSPAppName).intunewin")
2727
$Infile = "AddMSPApp\$($ChocoApp.MSPAppName).intunewin"
2828
} else {
29-
[xml]$Intunexml = Get-Content 'AddChocoApp\choco.app.xml'
29+
[xml]$Intunexml = Get-Content 'AddChocoApp\Choco.App.xml'
3030
$intunewinFilesize = (Get-Item 'AddChocoApp\IntunePackage.intunewin')
3131
$Infile = "AddChocoApp\$($intunexml.ApplicationInfo.FileName)"
3232
}

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/BPA/Push-BPACollectData.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ function Push-BPACollectData {
1919
}
2020
}
2121
$Table = Get-CippTable -tablename 'cachebpav2'
22-
$Rerun = Test-CIPPRerun -Type 'BPA' -Tenant $TenantName.defaultDomainName -API $Item.Template
22+
23+
$Rerun = Test-CIPPRerun -Type 'BPA' -Tenant $Item.Tenant -API $Item.Template
2324
if ($Rerun) {
2425
Write-Host 'Detected rerun for BPA. Exiting cleanly'
2526
exit 0

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-ExecOnboardTenantQueue.ps1

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Function Push-ExecOnboardTenantQueue {
1+
function Push-ExecOnboardTenantQueue {
22
<#
33
.FUNCTIONALITY
44
Entrypoint
@@ -354,22 +354,29 @@ Function Push-ExecOnboardTenantQueue {
354354
if ($OnboardingSteps.Step4.Status -eq 'succeeded') {
355355
if ($Item.StandardsExcludeAllTenants -eq $true) {
356356
$AddExclusionObj = [PSCustomObject]@{
357-
label = $Tenant.defaultDomainName
357+
label = '{0} ({1})' -f $Tenant.displayName, $Tenant.defaultDomainName
358358
value = $Tenant.defaultDomainName
359-
addedFields = @{}
359+
addedFields = @{
360+
customerId = $Tenant.customerId
361+
defaultDomainName = $Tenant.defaultDomainName
362+
}
360363
}
361364
$Table = Get-CippTable -tablename 'templates'
362365
$ExistingTemplates = Get-CippazDataTableEntity @Table -Filter "PartitionKey eq 'StandardsTemplateV2'" | Where-Object { $_.JSON -match 'AllTenants' }
363-
foreach ($AllTenantesTemplate in $ExistingTemplates) {
366+
foreach ($AllTenantsTemplate in $ExistingTemplates) {
364367
$object = $AllTenantesTemplate.JSON | ConvertFrom-Json
365-
$NewExcludedTenants = $object.excludedTenants + $AddExclusionObj
368+
$NewExcludedTenants = [system.collections.generic.list[object]]::new()
369+
foreach ($Tenant in $object.excludedTenants) {
370+
$NewExcludedTenants.Add($Tenant)
371+
}
372+
$NewExcludedTenants.Add($AddExclusionObj)
366373
$object.excludedTenants = $NewExcludedTenants
367374
$JSON = ConvertTo-Json -InputObject $object -Compress -Depth 10
368375
$Table.Force = $true
369376
Add-CIPPAzDataTableEntity @Table -Entity @{
370377
JSON = "$JSON"
371-
RowKey = $AllTenantesTemplate.RowKey
372-
GUID = $AllTenantesTemplate.GUID
378+
RowKey = $AllTenantsTemplate.RowKey
379+
GUID = $AllTenantsTemplate.GUID
373380
PartitionKey = 'StandardsTemplateV2'
374381
}
375382
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecCippReplacemap.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ function Invoke-ExecCippReplacemap {
33
.FUNCTIONALITY
44
Entrypoint
55
.ROLE
6-
CIPP.Extension.ReadWrite
6+
Tenant.Config.ReadWrite
77
#>
88
[CmdletBinding()]
99
param($Request, $TriggerMetadata)
1010

1111
$Table = Get-CippTable -tablename 'CippReplacemap'
1212
$Action = $Request.Query.Action ?? $Request.Body.Action
13-
$customerId = $Request.Query.customerId ?? $Request.Body.customerId
13+
$customerId = $Request.Query.tenantId ?? $Request.Body.tenantId
1414

1515
if (!$customerId) {
1616
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
function Invoke-ExecSetRecipientLimits {
2+
<#
3+
.FUNCTIONALITY
4+
Entrypoint
5+
.ROLE
6+
Exchange.Mailbox.ReadWrite
7+
#>
8+
[CmdletBinding()]
9+
param($Request, $TriggerMetadata)
10+
11+
$APIName = $Request.Params.CIPPEndpoint
12+
$Headers = $Request.Headers
13+
Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message 'Accessed this API' -Sev 'Debug'
14+
15+
# Interact with the query or body of the request
16+
$TenantFilter = $Request.Body.tenantFilter
17+
$recipientLimit = $Request.Body.recipientLimit
18+
$Identity = $Request.Body.Identity
19+
$UserPrincipalName = $Request.Body.userid
20+
21+
# Set the parameters for the EXO request
22+
$ExoRequest = @{
23+
tenantid = $TenantFilter
24+
cmdlet = 'Set-Mailbox'
25+
cmdParams = @{
26+
Identity = $Identity
27+
RecipientLimits = $recipientLimit
28+
}
29+
}
30+
31+
# Execute the EXO request
32+
try {
33+
$null = New-ExoRequest @ExoRequest
34+
$Results = "Recipient limit for $UserPrincipalName has been set to $recipientLimit"
35+
36+
Write-LogMessage -API $APIName -tenant $TenantFilter -message $Results -sev Info
37+
$StatusCode = [HttpStatusCode]::OK
38+
} catch {
39+
$ErrorMessage = Get-CippException -Exception $_
40+
$Results = "Could not set recipient limit for $UserPrincipalName to $recipientLimit. Error: $($ErrorMessage.NormalizedError)"
41+
Write-LogMessage -API $APIName -tenant $TenantFilter -message $Results -sev Error -LogData $ErrorMessage
42+
$StatusCode = [HttpStatusCode]::InternalServerError
43+
}
44+
45+
# Associate values to output bindings by calling 'Push-OutputBinding'.
46+
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
47+
StatusCode = $StatusCode
48+
Body = @{ Results = $Results }
49+
})
50+
}

0 commit comments

Comments
 (0)