Skip to content

Commit adee9ac

Browse files
authored
Merge pull request #230 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 20b490f + 62c23b5 commit adee9ac

15 files changed

+204
-178
lines changed

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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Get-CIPPAlertNewAppApproval {
1515
try {
1616
$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 = [System.Collections.Generic.List[string]]::new()
18+
$AlertData = [System.Collections.Generic.List[PSCustomObject]]::new()
1919
foreach ($App in $Approvals) {
2020
$userConsentRequests = New-GraphGetRequest -Uri "https://graph.microsoft.com/v1.0/identityGovernance/appConsent/appConsentRequests/$($App.id)/userConsentRequests" -tenantid $TenantFilter
2121
$userConsentRequests | ForEach-Object {
@@ -28,7 +28,15 @@ function Get-CIPPAlertNewAppApproval {
2828
"https://login.microsoftonline.com/$($TenantFilter)/adminConsent?client_id=$($App.appId)&bf_id=$($App.id)&redirect_uri=https://entra.microsoft.com/TokenAuthorize"
2929
}
3030

31-
$Message = "App name: $($App.appDisplayName) - Request user: $($_.createdBy.user.userPrincipalName) - Reason: $($_.reason)`nApp Id: $($App.appId) - Scopes: $($App.pendingScopes.displayName)`nConsent URL: $consentUrl"
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+
}
3240
$AlertData.Add($Message)
3341
}
3442
}

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/HTTP Functions/Endpoint/Applications/Invoke-AddChocoApp.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Function Invoke-AddChocoApp {
1515
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
1616

1717
$ChocoApp = $Request.Body
18-
$intuneBody = Get-Content 'AddChocoApp\choco.app.json' | ConvertFrom-Json
18+
$intuneBody = Get-Content 'AddChocoApp\Choco.app.json' | ConvertFrom-Json
1919
$AssignTo = $Request.Body.AssignTo
2020
$intuneBody.description = $ChocoApp.description
2121
$intuneBody.displayName = $ChocoApp.ApplicationName

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-EditUser.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ Function Invoke-EditUser {
8888
try {
8989

9090
if ($licenses -or $UserObj.removeLicenses) {
91-
if ($UserObj.sherwebLicense) {
92-
$License = Set-SherwebSubscription -TenantFilter $UserObj.tenantFilter -SKU $UserObj.sherwebLicense -Add 1
91+
if ($UserObj.sherwebLicense.value) {
92+
$License = Set-SherwebSubscription -TenantFilter $UserObj.tenantFilter -SKU $UserObj.sherwebLicense.value -Add 1
9393
$null = $results.Add('Added Sherweb License, scheduling assignment')
9494
$taskObject = [PSCustomObject]@{
9595
TenantFilter = $UserObj.tenantFilter
96-
Name = "Assign License: $Username"
96+
Name = "Assign License: $UserPrincipalName"
9797
Command = @{
9898
value = 'Set-CIPPUserLicense'
9999
}

Modules/CIPPCore/Public/Set-CIPPDefaultAPDeploymentProfile.ps1

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ function Set-CIPPDefaultAPDeploymentProfile {
22
[CmdletBinding(SupportsShouldProcess = $true)]
33
param(
44
$tenantFilter,
5-
$displayname,
5+
$displayName,
66
$description,
77
$devicenameTemplate,
88
$allowWhiteGlove,
99
$CollectHash,
10-
$usertype,
10+
$userType,
1111
$DeploymentMode,
1212
$hideChangeAccount,
1313
$AssignTo,
1414
$hidePrivacy,
1515
$hideTerms,
16-
$Autokeyboard,
16+
$AutoKeyboard,
1717
$Headers,
1818
$Language = 'os-default',
1919
$APIName = 'Add Default Enrollment Status Page'
@@ -24,9 +24,9 @@ function Set-CIPPDefaultAPDeploymentProfile {
2424
try {
2525
$ObjBody = [pscustomobject]@{
2626
'@odata.type' = '#microsoft.graph.azureADWindowsAutopilotDeploymentProfile'
27-
'displayName' = "$($displayname)"
27+
'displayName' = "$($displayName)"
2828
'description' = "$($description)"
29-
'deviceNameTemplate' = "$($DeviceNameTemplate)"
29+
'deviceNameTemplate' = "$($devicenameTemplate)"
3030
'language' = "$($Language)"
3131
'enableWhiteGlove' = $([bool]($allowWhiteGlove))
3232
'deviceType' = 'windowsPc'
@@ -38,19 +38,19 @@ function Set-CIPPDefaultAPDeploymentProfile {
3838
'escapeLinkHidden' = $([bool]($hideChangeAccount))
3939
'privacySettingsHidden' = $([bool]($hidePrivacy))
4040
'eulaHidden' = $([bool]($hideTerms))
41-
'userType' = "$usertype"
42-
'keyboardSelectionPageSkipped' = $([bool]($Autokeyboard))
41+
'userType' = "$userType"
42+
'keyboardSelectionPageSkipped' = $([bool]($AutoKeyboard))
4343
}
4444
}
4545
$Body = ConvertTo-Json -InputObject $ObjBody
4646

47-
$Profiles = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles' -tenantid $tenantfilter | Where-Object -Property displayName -EQ $displayname
47+
$Profiles = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles' -tenantid $tenantFilter | Where-Object -Property displayName -EQ $displayName
4848
if ($Profiles.count -gt 1) {
4949
$Profiles | ForEach-Object {
5050
if ($_.id -ne $Profiles[0].id) {
5151
if ($PSCmdlet.ShouldProcess($_.displayName, 'Delete duplicate Autopilot profile')) {
52-
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/$($_.id)" -tenantid $tenantfilter -type DELETE
53-
Write-LogMessage -Headers $User -API $APIName -tenant $($tenantfilter) -message "Deleted duplicate Autopilot profile $($displayname)" -Sev 'Info'
52+
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/$($_.id)" -tenantid $tenantFilter -type DELETE
53+
Write-LogMessage -Headers $User -API $APIName -tenant $($tenantFilter) -message "Deleted duplicate Autopilot profile $($displayName)" -Sev 'Info'
5454
}
5555
}
5656
}
@@ -59,30 +59,30 @@ function Set-CIPPDefaultAPDeploymentProfile {
5959
if (!$Profiles) {
6060
if ($PSCmdlet.ShouldProcess($displayName, 'Add Autopilot profile')) {
6161
$Type = 'Add'
62-
$GraphRequest = New-GraphPostRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles' -body $body -tenantid $tenantfilter
63-
Write-LogMessage -Headers $User -API $APIName -tenant $($tenantfilter) -message "Added Autopilot profile $($displayname)" -Sev 'Info'
62+
$GraphRequest = New-GraphPostRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles' -body $body -tenantid $tenantFilter
63+
Write-LogMessage -Headers $User -API $APIName -tenant $($tenantFilter) -message "Added Autopilot profile $($displayName)" -Sev 'Info'
6464
}
6565
} else {
6666
$Type = 'Edit'
67-
$null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/$($Profiles.id)" -tenantid $tenantfilter -body $body -type PATCH
67+
$null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/$($Profiles.id)" -tenantid $tenantFilter -body $body -type PATCH
6868
$GraphRequest = $Profiles | Select-Object -Last 1
6969
}
7070

7171
if ($AssignTo -eq $true) {
7272
$AssignBody = '{"target":{"@odata.type":"#microsoft.graph.allDevicesAssignmentTarget"}}'
73-
if ($PSCmdlet.ShouldProcess($AssignTo, "Assign Autopilot profile $displayname")) {
73+
if ($PSCmdlet.ShouldProcess($AssignTo, "Assign Autopilot profile $displayName")) {
7474
#Get assignments
75-
$Assignments = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/$($GraphRequest.id)/assignments" -tenantid $tenantfilter
75+
$Assignments = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/$($GraphRequest.id)/assignments" -tenantid $tenantFilter
7676
if (!$Assignments) {
77-
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/$($GraphRequest.id)/assignments" -tenantid $tenantfilter -type POST -body $AssignBody
77+
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/$($GraphRequest.id)/assignments" -tenantid $tenantFilter -type POST -body $AssignBody
7878
}
79-
Write-LogMessage -Headers $User -API $APIName -tenant $($tenantfilter) -message "Assigned autopilot profile $($Displayname) to $AssignTo" -Sev 'Info'
79+
Write-LogMessage -Headers $User -API $APIName -tenant $tenantFilter -message "Assigned autopilot profile $($displayName) to $AssignTo" -Sev 'Info'
8080
}
8181
}
82-
"Successfully $($Type)ed profile for $($tenantfilter)"
82+
"Successfully $($Type)ed profile for $tenantFilter"
8383
} catch {
8484
$ErrorMessage = Get-CippException -Exception $_
85-
Write-LogMessage -Headers $User -API $APIName -tenant $($tenantfilter) -message "Failed $($Type)ing Autopilot Profile $($Displayname). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage
86-
throw "Failed to add profile for $($tenantfilter): $($ErrorMessage.NormalizedError)"
85+
Write-LogMessage -Headers $User -API $APIName -tenant $tenantFilter -message "Failed $($Type)ing Autopilot Profile $($displayName). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage
86+
throw "Failed to add profile for $($tenantFilter): $($ErrorMessage.NormalizedError)"
8787
}
8888
}

Modules/CIPPCore/Public/Set-CIPPDefaultAPEnrollment.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function Set-CIPPDefaultAPEnrollment {
2323
'displayName' = 'All users and all devices'
2424
'description' = 'This is the default enrollment status screen configuration applied with the lowest priority to all users and all devices regardless of group membership.'
2525
'showInstallationProgress' = [bool]$ShowProgress
26-
'blockDeviceSetupRetryByUser' = ![bool]$blockDevice
26+
'blockDeviceSetupRetryByUser' = ![bool]$BlockDevice
2727
'allowDeviceResetOnInstallFailure' = [bool]$AllowReset
2828
'allowLogCollectionOnInstallFailure' = [bool]$EnableLog
2929
'customErrorMessage' = "$ErrorMessage"
@@ -35,16 +35,16 @@ function Set-CIPPDefaultAPEnrollment {
3535
'roleScopeTagIds' = @()
3636
}
3737
$Body = ConvertTo-Json -InputObject $ObjBody
38-
$ExistingStatusPage = (New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations' -tenantid $($TenantFilter)) | Where-Object { $_.id -like '*DefaultWindows10EnrollmentCompletionPageConfiguration' }
38+
$ExistingStatusPage = (New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations' -tenantid $TenantFilter) | Where-Object { $_.id -like '*DefaultWindows10EnrollmentCompletionPageConfiguration' }
3939

4040
if ($PSCmdlet.ShouldProcess($ExistingStatusPage.ID, 'Set Default Enrollment Status Page')) {
41-
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations/$($ExistingStatusPage.ID)" -body $body -Type PATCH -tenantid $($TenantFilter)
42-
"Successfully changed default enrollment status page for $($($TenantFilter))"
43-
Write-LogMessage -Headers $User -API $APINAME -tenant $($TenantFilter) -message "Added Autopilot Enrollment Status Page $($Displayname)" -Sev 'Info'
41+
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations/$($ExistingStatusPage.ID)" -body $Body -Type PATCH -tenantid $TenantFilter
42+
"Successfully changed default enrollment status page for $TenantFilter"
43+
Write-LogMessage -Headers $User -API $APIName -tenant $TenantFilter -message "Added Autopilot Enrollment Status Page $($ExistingStatusPage.displayName)" -Sev 'Info'
4444
}
4545
} catch {
4646
$ErrorMessage = Get-CippException -Exception $_
47-
Write-LogMessage -Headers $User -API $APINAME -tenant $($TenantFilter) -message "Failed adding Autopilot Enrollment Status Page $($Displayname). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage
48-
throw "Failed to change default enrollment status page for $($($TenantFilter)): $($ErrorMessage.NormalizedError)"
47+
Write-LogMessage -Headers $User -API $APIName -tenant $TenantFilter -message "Failed adding Autopilot Enrollment Status Page $($ExistingStatusPage.displayName). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage
48+
throw "Failed to change default enrollment status page for $($TenantFilter): $($ErrorMessage.NormalizedError)"
4949
}
5050
}

0 commit comments

Comments
 (0)