Skip to content

Commit 56654ae

Browse files
Merge pull request #1578 from KelvinTegelaar/dev
Dev to release
2 parents 9acc3a2 + 4c393ba commit 56654ae

File tree

195 files changed

+3856
-537
lines changed

Some content is hidden

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

195 files changed

+3856
-537
lines changed

AddMSPApp/datto.app.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<ApplicationInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ToolVersion="1.8.3.0">
2-
<Name>install.ps1</Name>
3-
<UnencryptedContentSize>705</UnencryptedContentSize>
4-
<FileName>datto.intunewin</FileName>
5-
<SetupFile>install.ps1</SetupFile>
6-
<EncryptionInfo>
7-
<EncryptionKey>sL/LP/JZ4F4cBSykm6usgJoV1PMoqd62C6JUwuo2z24=</EncryptionKey>
8-
<MacKey>PEpeqeoX7jAWxb0xHGfCkKFxh4/YRfoMTVXrP+uZWzM=</MacKey>
9-
<InitializationVector>ulFPA+vYjaxX0pvq0BMAKQ==</InitializationVector>
10-
<Mac>28ZFU4AT1OznwF8pfqO8i+WFUNSf9024H4Jw2H7UJWs=</Mac>
11-
<ProfileIdentifier>ProfileVersion1</ProfileIdentifier>
12-
<FileDigest>YEb+QNQCko/uZyedA+JfcP/RDm+nZOIjFN04CfhwN4c=</FileDigest>
13-
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
14-
</EncryptionInfo>
1+
<ApplicationInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ToolVersion="1.8.3.0">
2+
<Name>install.ps1</Name>
3+
<UnencryptedContentSize>693</UnencryptedContentSize>
4+
<FileName>datto.intunewin</FileName>
5+
<SetupFile>install.ps1</SetupFile>
6+
<EncryptionInfo>
7+
<EncryptionKey>jobB9Ga7J3CbO6acWJyvBRE56nFXwqGfcnGfZRMsJC4=</EncryptionKey>
8+
<MacKey>53SOzs0l6Po2btsGFSMZgkV8vwhH+PxTN8BZDUcfWfg=</MacKey>
9+
<InitializationVector>VjM/osrvPElbu79J+mdXuw==</InitializationVector>
10+
<Mac>UZZXO53Np/tG6Ms+qvwLcNOeD1GRH6NRPFg/TuMz39M=</Mac>
11+
<ProfileIdentifier>ProfileVersion1</ProfileIdentifier>
12+
<FileDigest>KtAWAl29064LG0eyDinbDs0JUbK+EK7GsJovu8obBM4=</FileDigest>
13+
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
14+
</EncryptionInfo>
1515
</ApplicationInfo>

AddMSPApp/datto.intunewin

-16 Bytes
Binary file not shown.

CIPPTimers.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@
8080
"RunOnProcessor": true,
8181
"PreferredProcessor": "standards"
8282
},
83+
{
84+
"Id": "4d80205c-674d-4fc1-abeb-a1ec37e0d796",
85+
"Command": "Start-DriftStandardsOrchestrator",
86+
"Description": "Orchestrator to process drift standards",
87+
"Cron": "0 0 */1 * * *",
88+
"Priority": 5,
89+
"RunOnProcessor": true,
90+
"PreferredProcessor": "standards"
91+
},
8392
{
8493
"Id": "97145a1d-28f0-4bb2-b929-5a43517d23cc",
8594
"Command": "Start-SchedulerOrchestrator",
@@ -197,4 +206,4 @@
197206
"RunOnProcessor": true,
198207
"IsSystem": true
199208
}
200-
]
209+
]

ConversionTable.csv

Lines changed: 95 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
function Add-CIPPAlias {
22
[CmdletBinding()]
33
param (
4-
$user,
4+
$User,
55
$Aliases,
6-
$UserprincipalName,
6+
$UserPrincipalName,
77
$TenantFilter,
88
$APIName = 'Add Alias',
99
$Headers
1010
)
1111

1212
try {
1313
foreach ($Alias in $Aliases) {
14-
Write-Host "Adding alias $Alias to $user"
15-
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$user" -tenantid $TenantFilter -type 'patch' -body "{`"mail`": `"$Alias`"}" -verbose
14+
Write-Host "Adding alias $Alias to $User"
15+
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$User" -tenantid $TenantFilter -type 'patch' -body "{`"mail`": `"$Alias`"}" -verbose
1616
}
1717
Write-Host "Resetting primary alias to $User"
18-
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$($user)" -tenantid $TenantFilter -type 'patch' -body "{`"mail`": `"$User`"}" -verbose
19-
Write-LogMessage -headers $Headers -API $APINAME -tenant $($TenantFilter) -message "Added alias $($Alias) to $($UserprincipalName)" -Sev 'Info'
18+
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$User" -tenantid $TenantFilter -type 'patch' -body "{`"mail`": `"$User`"}" -verbose
19+
Write-LogMessage -headers $Headers -API $APIName -tenant $($TenantFilter) -message "Added alias $($Alias) to $($UserPrincipalName)" -Sev 'Info'
2020
return ("Added Aliases: $($Aliases -join ',')")
2121
} catch {
22-
Write-LogMessage -headers $Headers -API $APINAME -tenant $($TenantFilter) -message "Failed to set alias. Error:$($_.Exception.Message)" -Sev 'Error'
23-
throw "Failed to set alias: $($_.Exception.Message)"
22+
$ErrorMessage = Get-CippException -Exception $_
23+
Write-LogMessage -headers $Headers -API $APIName -tenant $($TenantFilter) -message "Failed to set alias. Error:$($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage
24+
throw "Failed to set alias: $($ErrorMessage.NormalizedError)"
2425
}
2526
}
2627

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
function Get-CIPPAlertLicenseAssignmentErrors {
2+
<#
3+
.FUNCTIONALITY
4+
Entrypoint
5+
#>
6+
[CmdletBinding()]
7+
Param (
8+
[Parameter(Mandatory)]
9+
$TenantFilter,
10+
[Alias('input')]
11+
$InputValue
12+
)
13+
14+
# Define error code translations for human-readable messages
15+
$ErrorTranslations = @(
16+
@{
17+
ErrorCode = "CountViolation"
18+
Description = "Not enough licenses available - the organization has exceeded the number of available licenses for this SKU"
19+
},
20+
@{
21+
ErrorCode = "MutuallyExclusiveViolation"
22+
Description = "Conflicting licenses assigned - this license cannot be assigned alongside another license the user already has"
23+
},
24+
@{
25+
ErrorCode = "ProhibitedInUsageLocationViolation"
26+
Description = "License not available in user's location - this license cannot be assigned to users in the user's current usage location"
27+
},
28+
@{
29+
ErrorCode = "UniquenessViolation"
30+
Description = "Duplicate license assignment - this license can only be assigned once per user"
31+
},
32+
@{
33+
ErrorCode = "Unknown"
34+
Description = "Unknown license assignment error - an unspecified error occurred during license assignment"
35+
}
36+
)
37+
38+
try {
39+
# Get all users with license assignment states from Graph API
40+
$Users = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$select=id,userPrincipalName,displayName,licenseAssignmentStates&`$top=999" -tenantid $TenantFilter
41+
42+
# Filter users who have license assignment violations
43+
$UsersWithViolations = $Users | Where-Object {
44+
$_.licenseAssignmentStates -and
45+
($_.licenseAssignmentStates | Where-Object {
46+
$_.error -and (
47+
$_.error -like "*CountViolation*" -or
48+
$_.error -like "*MutuallyExclusiveViolation*" -or
49+
$_.error -like "*ProhibitedInUsageLocationViolation*" -or
50+
$_.error -like "*UniquenessViolation*" -or
51+
$_.error -like "*Unknown*"
52+
)
53+
})
54+
}
55+
56+
# Build alert messages for users with violations
57+
$LicenseAssignmentErrors = foreach ($User in $UsersWithViolations) {
58+
$ViolationErrors = $User.licenseAssignmentStates | Where-Object {
59+
$_.error -and (
60+
$_.error -like "*CountViolation*" -or
61+
$_.error -like "*MutuallyExclusiveViolation*" -or
62+
$_.error -like "*ProhibitedInUsageLocationViolation*" -or
63+
$_.error -like "*UniquenessViolation*" -or
64+
$_.error -like "*Unknown*"
65+
)
66+
}
67+
68+
foreach ($Violation in $ViolationErrors) {
69+
# Find matching error translation
70+
$ErrorTranslation = $ErrorTranslations | Where-Object { $Violation.error -like "*$($_.ErrorCode)*" } | Select-Object -First 1
71+
$HumanReadableError = if ($ErrorTranslation) {
72+
$ErrorTranslation.Description
73+
} else {
74+
"Unknown license assignment error: $($Violation.error)"
75+
}
76+
77+
$PrettyName = Convert-SKUname -skuID $Violation.skuId
78+
79+
"$($User.userPrincipalName): $HumanReadableError (License: $PrettyName)"
80+
}
81+
}
82+
83+
# If errors are found, write alert
84+
if ($LicenseAssignmentErrors) {
85+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $LicenseAssignmentErrors
86+
}
87+
88+
} catch {
89+
Write-LogMessage -message "Failed to check license assignment errors: $($_.exception.message)" -API 'License Assignment Alerts' -tenant $TenantFilter -sev Error
90+
}
91+
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +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+
$TenantGUID = (Get-Tenants -TenantFilter $TenantFilter -SkipDomains).customerId
1819
$AlertData = [System.Collections.Generic.List[PSCustomObject]]::new()
1920
foreach ($App in $Approvals) {
2021
$userConsentRequests = New-GraphGetRequest -Uri "https://graph.microsoft.com/v1.0/identityGovernance/appConsent/appConsentRequests/$($App.id)/userConsentRequests" -tenantid $TenantFilter
@@ -29,13 +30,17 @@ function Get-CIPPAlertNewAppApproval {
2930
}
3031

3132
$Message = [PSCustomObject]@{
33+
RequestId = $_.id
3234
AppName = $App.appDisplayName
3335
RequestUser = $_.createdBy.user.userPrincipalName
3436
Reason = $_.reason
37+
RequestDate = $_.createdDateTime
38+
Status = $_.status # Will allways be InProgress as we filter to only get these but this will reduce confusion when an alert is generated
3539
AppId = $App.appId
3640
Scopes = ($App.pendingScopes.displayName -join ', ')
3741
ConsentURL = $consentUrl
3842
Tenant = $TenantFilter
43+
TenantId = $TenantGUID
3944
}
4045
$AlertData.Add($Message)
4146
}

Modules/CIPPCore/Public/AuditLogs/Get-CippAuditLogSearchResults.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ function Get-CippAuditLogSearchResults {
2828
$GraphRequest.CountOnly = $true
2929
}
3030

31-
New-GraphGetRequest @GraphRequest -ErrorAction Stop
31+
New-GraphGetRequest @GraphRequest -ErrorAction Stop | Sort-Object -Property createdDateTime -Descending
3232
}
3333
}

Modules/CIPPCore/Public/AuditLogs/New-CippAuditLogSearch.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function New-CippAuditLogSearch {
125125
)
126126

127127
$SearchParams = @{
128-
displayName = 'CIPP Audit Search - ' + (Get-Date).ToString('yyyy-MM-dd HH:mm:ss')
128+
displayName = $DisplayName
129129
filterStartDateTime = $StartTime.ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ss')
130130
filterEndDateTime = $EndTime.AddHours(1).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ss')
131131
}

0 commit comments

Comments
 (0)