Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4a20f2b
Refactor tenant lookup
Aug 4, 2025
feaf046
fix parameters with scheduled license assignment
JohnDuprey Aug 4, 2025
9137859
Update Get-CIPPTenantAlignment.ps1
JohnDuprey Aug 4, 2025
f4ffad3
fix processing bug for no groups/devices
JohnDuprey Aug 4, 2025
381c406
fix license check for SHAREPOINTENTERPRISE_EDU capability
JohnDuprey Aug 4, 2025
f13462d
add json error handling for invalid reports
JohnDuprey Aug 4, 2025
363dd37
add $top
JohnDuprey Aug 4, 2025
e564438
Add or update the Azure App Service build and deployment workflow config
KelvinTegelaar Aug 5, 2025
e7b6287
Remove the Azure App Service build and deployment workflow config
KelvinTegelaar Aug 5, 2025
b96733a
Add or update the Azure App Service build and deployment workflow config
KelvinTegelaar Aug 5, 2025
24cdc29
Add DesiredStartTime support for scheduled tasks
Zacgoose Aug 5, 2025
1fc6f75
Merge pull request #1582 from Zacgoose/Alert-Run-Desired-Start
KelvinTegelaar Aug 5, 2025
18da4a3
Fix Auto-extend troubleshooting URL
ddunkijaco Aug 5, 2025
887862f
multi row support for restores
JohnDuprey Aug 5, 2025
79b9296
Merge pull request #1583 from ddunkijaco/patch-1
KelvinTegelaar Aug 6, 2025
530e678
fix tenant onboarding permission
JohnDuprey Aug 6, 2025
bbf0953
removing $top since it's not being honored
JohnDuprey Aug 6, 2025
bda4aed
add logging to creating scheduled task
JohnDuprey Aug 6, 2025
bc8d038
fixes for catelog
KelvinTegelaar Aug 7, 2025
663f159
fix error handling for json conversion
JohnDuprey Aug 8, 2025
f59349b
switch to test-json for converting field values
JohnDuprey Aug 8, 2025
3626cba
fix partition key
JohnDuprey Aug 11, 2025
eb4a3d7
Update Invoke-ListCippQueue.ps1
JohnDuprey Aug 11, 2025
d073999
Update Invoke-ListCippQueue.ps1
JohnDuprey Aug 11, 2025
68b9420
alert fix
JohnDuprey Aug 11, 2025
d7c089a
add tenant check to phishing alert
JohnDuprey Aug 11, 2025
5aa0055
Prevent dropping last record when no real nextLink is present
nichxlxs Aug 12, 2025
a0ef206
Merge pull request #1586 from nichxlxs/patch-3
JohnDuprey Aug 12, 2025
6674b8c
fixes issue with duplicate alerts
KelvinTegelaar Aug 14, 2025
495927c
fixes issues with breach lookup repeat alerts
KelvinTegelaar Aug 14, 2025
8a9a6fc
fix get-standards params
JohnDuprey Aug 14, 2025
a2648c2
refactor Get-CIPPAlertNoCAConfig to check for enabled seats in subscr…
MWG-Logan Aug 14, 2025
2e14462
fix nextlink issue
JohnDuprey Aug 14, 2025
515bc4a
improve support for different group id formats
JohnDuprey Aug 14, 2025
a5afdda
Update Invoke-ExecSetSharePointMember.ps1
JohnDuprey Aug 14, 2025
d1d04ff
add 'expand' support
JohnDuprey Aug 15, 2025
4af83a0
rename file
JohnDuprey Aug 15, 2025
b24aa36
fix partition key
JohnDuprey Aug 15, 2025
5d95097
move $state out of remediate block
JohnDuprey Aug 15, 2025
8108373
accept object or string for domain parameter
JohnDuprey Aug 15, 2025
81f1a60
fix allowed permission calculation
JohnDuprey Aug 15, 2025
b10eb7b
fix dep alert
JohnDuprey Aug 15, 2025
9428f92
tweak mapping
JohnDuprey Aug 15, 2025
1a673eb
Update Test-CIPPAuditLogRules.ps1
JohnDuprey Aug 15, 2025
4f9abcf
Update Write-AlertTrace.ps1
JohnDuprey Aug 15, 2025
e9ded06
ca policy tweaks
JohnDuprey Aug 15, 2025
bcf23e1
add license checks for risk based conditions
JohnDuprey Aug 15, 2025
2848860
add toggle for expanding group members
JohnDuprey Aug 15, 2025
6e9434d
Merge pull request #1587 from MWGMorningwood/dev
JohnDuprey Aug 18, 2025
e9fd45d
Update version_latest.txt
JohnDuprey Aug 18, 2025
f45dba0
Merge pull request #1589 from KelvinTegelaar/dev
JohnDuprey Aug 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/dev_clouduptest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 - clouduptest

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: ubuntu-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: 'clouduptest'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_9B9E8B9A9BBE446188BCA9F126A1B646 }}
sku: 'flexconsumption'

28 changes: 26 additions & 2 deletions Modules/CIPPCore/Public/Add-CIPPScheduledTask.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ function Add-CIPPScheduledTask {
[Parameter(Mandatory = $true, ParameterSetName = 'RunNow')]
[string]$RowKey,

[Parameter(Mandatory = $false, ParameterSetName = 'Default')]
[string]$DesiredStartTime = $null,

[Parameter(Mandatory = $false, ParameterSetName = 'Default')]
[Parameter(Mandatory = $false, ParameterSetName = 'RunNow')]
$Headers
Expand Down Expand Up @@ -119,8 +122,24 @@ function Add-CIPPScheduledTask {
$task.Recurrence.value
}

if ([int64]$task.ScheduledTime -eq 0 -or [string]::IsNullOrEmpty($task.ScheduledTime)) {
$task.ScheduledTime = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds
if ($DesiredStartTime) {
try {
# Parse the epoch time
$epochSeconds = [int64]$DesiredStartTime
# Set ScheduledTime to the desired time
$task.ScheduledTime = $epochSeconds
} catch {
Write-Warning "Failed to parse DesiredStartTime: $DesiredStartTime. Using provided ScheduledTime."
# Fall back to default
if ([int64]$task.ScheduledTime -eq 0 -or [string]::IsNullOrEmpty($task.ScheduledTime)) {
$task.ScheduledTime = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds
}
}
} else {
# No DesiredStartTime - use current behavior (immediate execution)
if ([int64]$task.ScheduledTime -eq 0 -or [string]::IsNullOrEmpty($task.ScheduledTime)) {
$task.ScheduledTime = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds
}
}
$excludedTenants = if ($task.excludedTenants.value) {
$task.excludedTenants.value -join ','
Expand Down Expand Up @@ -166,6 +185,10 @@ function Add-CIPPScheduledTask {
Hidden = [bool]$Hidden
Results = 'Planned'
}
# Always store DesiredStartTime if provided
if ($DesiredStartTime) {
$entity['DesiredStartTime'] = [string]$DesiredStartTime
}

# Store the original tenant filter for group expansion during execution
if ($originalTenantFilter -is [PSCustomObject] -and $originalTenantFilter.type -eq 'Group') {
Expand All @@ -190,6 +213,7 @@ function Add-CIPPScheduledTask {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
return "Could not add task: $ErrorMessage"
}
Write-LogMessage -headers $Headers -API 'ScheduledTask' -message "Added task $($entity.Name) with ID $($entity.RowKey)" -Sev 'Info' -Tenant $tenantFilter
return "Successfully added task: $($entity.Name)"
}
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Get-CIPPAlertDepTokenExpiry {
Entrypoint
#>
[CmdletBinding()]
Param (
param (
[Parameter(Mandatory = $false)]
[Alias('input')]
$InputValue,
Expand All @@ -13,7 +13,7 @@ function Get-CIPPAlertDepTokenExpiry {

try {
try {
$DepTokens = (New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/depOnboardingSettings' -tenantid $TenantFilter).value
$DepTokens = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/depOnboardingSettings' -tenantid $TenantFilter
$AlertData = foreach ($Dep in $DepTokens) {
if ($Dep.tokenExpirationDateTime -lt (Get-Date).AddDays(30) -and $Dep.tokenExpirationDateTime -gt (Get-Date).AddDays(-7)) {
$Message = 'Apple Device Enrollment Program token expiring on {0}' -f $Dep.tokenExpirationDateTime
Expand Down
9 changes: 7 additions & 2 deletions Modules/CIPPCore/Public/Alerts/Get-CIPPAlertNoCAConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ function Get-CIPPAlertNoCAConfig {
)

try {
$CAAvailable = (New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/subscribedSkus' -tenantid $TenantFilter -ErrorAction Stop).serviceplans
if ('AAD_PREMIUM' -in $CAAvailable.servicePlanName) {
# Only consider CA available when a SKU that grants it has enabled seats (> 0)
$SubscribedSkus = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/subscribedSkus?`$select=prepaidUnits,servicePlans" -tenantid $TenantFilter -ErrorAction Stop
$CAAvailable = foreach ($sku in $SubscribedSkus) {
if ([int]$sku.prepaidUnits.enabled -gt 0) { $sku.servicePlans }
}

if (('AAD_PREMIUM' -in $CAAvailable.servicePlanName) -or ('AAD_PREMIUM_P2' -in $CAAvailable.servicePlanName)) {
$CAPolicies = (New-GraphGetRequest -uri 'https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies' -tenantid $TenantFilter)
if (!$CAPolicies.id) {
$AlertData = 'Conditional Access is available, but no policies could be found.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ function Get-CIPPAlertVppTokenExpiry {
Entrypoint
#>
[CmdletBinding()]
Param (
param (
[Parameter(Mandatory = $false)]
[Alias('input')]
$InputValue,
$TenantFilter
)
try {
try {
$VppTokens = (New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/deviceAppManagement/vppTokens' -tenantid $TenantFilter).value
$VppTokens = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/deviceAppManagement/vppTokens' -tenantid $TenantFilter
$AlertData = foreach ($Vpp in $VppTokens) {
if ($Vpp.state -ne 'valid') {
$Message = 'Apple Volume Purchase Program Token is not valid, new token required'
$Vpp | Select-Object -Property organizationName, appleId, vppTokenAccountType, @{Name = 'Message'; Expression = { $Message } }
}
if ($Vpp.expirationDateTime -lt (Get-Date).AddDays(30) -and $Vpp.expirationDateTime -gt (Get-Date).AddDays(-7)) {
} elseif ($Vpp.expirationDateTime -lt (Get-Date).AddDays(30).ToUniversalTime() -and $Vpp.expirationDateTime -gt (Get-Date).AddDays(-7).ToUniversalTime()) {
$Message = 'Apple Volume Purchase Program token expiring on {0}' -f $Vpp.expirationDateTime
$Vpp | Select-Object -Property organizationName, appleId, vppTokenAccountType, @{Name = 'Message'; Expression = { $Message } }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function Get-CippAllowedPermissions {

# For admin and superadmin: Compute permissions from base role include/exclude rules
if ($PrimaryRole -in @('admin', 'superadmin')) {
Write-Information "Computing permissions for $PrimaryRole using base role rules"

if ($BaseRole) {
# Start with all permissions and apply include/exclude rules
Expand Down Expand Up @@ -143,7 +142,19 @@ function Get-CippAllowedPermissions {
}

# Restrict base permissions to only those allowed by custom roles
$RestrictedPermissions = $BasePermissions | Where-Object { $CustomRolePermissions -contains $_ }
# Include Read permissions when ReadWrite permissions are present
$RestrictedPermissions = $BasePermissions | Where-Object {
$Permission = $_
if ($CustomRolePermissions -contains $Permission) {
$true
} elseif ($Permission -match 'Read$') {
# Check if there's a corresponding ReadWrite permission
$ReadWritePermission = $Permission -replace 'Read', 'ReadWrite'
$CustomRolePermissions -contains $ReadWritePermission
} else {
$false
}
}
foreach ($Permission in $RestrictedPermissions) {
if ($null -ne $Permission -and $Permission -is [string]) {
$AllowedPermissions.Add($Permission)
Expand All @@ -161,8 +172,6 @@ function Get-CippAllowedPermissions {
}
# Handle users with only custom roles (no base role)
elseif ($CustomRoles.Count -gt 0) {
Write-Information 'Computing permissions for custom roles only'

foreach ($CustomRole in $CustomRoles) {
try {
$RolePermissions = Get-CIPPRolePermissions -RoleName $CustomRole
Expand Down
4 changes: 2 additions & 2 deletions Modules/CIPPCore/Public/CippQueue/Invoke-ListCippQueue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ function Invoke-ListCippQueue {
$CippQueue = Get-CippTable -TableName 'CippQueue'
$CippQueueTasks = Get-CippTable -TableName 'CippQueueTasks'
$3HoursAgo = (Get-Date).ToUniversalTime().AddHours(-3).ToString('yyyy-MM-ddTHH:mm:ssZ')
$CippQueueData = Get-CIPPAzDataTableEntity @CippQueue -Filter "Timestamp ge datetime'$3HoursAgo'" | Sort-Object -Property Timestamp -Descending
$CippQueueData = Get-CIPPAzDataTableEntity @CippQueue -Filter "PartitionKey eq 'CippQueue' and Timestamp ge datetime'$3HoursAgo'" | Sort-Object -Property Timestamp -Descending

$QueueData = foreach ($Queue in $CippQueueData) {
$Tasks = Get-CIPPAzDataTableEntity @CippQueueTasks -Filter "QueueId eq '$($Queue.RowKey)'" | Where-Object { $_.Name } | Select-Object @{n = 'Timestamp'; exp = { $_.Timestamp.DateTime.ToUniversalTime() } }, Name, Status
$Tasks = Get-CIPPAzDataTableEntity @CippQueueTasks -Filter "PartitionKey eq 'Task' and QueueId eq '$($Queue.RowKey)'" | Where-Object { $_.Name } | Select-Object @{n = 'Timestamp'; exp = { $_.Timestamp.DateTime.ToUniversalTime() } }, Name, Status
$TaskStatus = @{}
$Tasks | Group-Object -Property Status | ForEach-Object {
$TaskStatus.$($_.Name) = $_.Count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function Invoke-ListGraphRequest {
$Parameters.'$expand' = $Request.Query.'$expand'
}

if ($Request.Query.expand) {
$Parameters.'expand' = $Request.Query.expand
}

if ($Request.Query.'$top') {
$Parameters.'$top' = $Request.Query.'$top'
}
Expand Down Expand Up @@ -120,13 +124,13 @@ function Invoke-ListGraphRequest {

try {
$Results = Get-GraphRequestList @GraphRequestParams
if ($Results.nextLink) {
Write-Host "NextLink: $($Results.nextLink | Select-Object -Last 1)"
if ($Request.Query.TenantFilter -ne 'AllTenants') {
$Metadata['nextLink'] = $Results.nextLink | Select-Object -Last 1
if ($Results | Where-Object { $_.PSObject.Properties.Name -contains 'nextLink' }) {
if (![string]::IsNullOrEmpty($Results.nextLink) -and $Request.Query.TenantFilter -ne 'AllTenants') {
Write-Host "NextLink: $($Results.nextLink | Where-Object { $_ } | Select-Object -Last 1)"
$Metadata['nextLink'] = $Results.nextLink | Where-Object { $_ } | Select-Object -Last 1
}
#Results is an array of objects, so we need to remove the last object before returning
$Results = $Results | Select-Object -First ($Results.Count - 1)
# Remove nextLink trailing object only if it’s the last item
$Results = $Results | Where-Object { $_.PSObject.Properties.Name -notcontains 'nextLink' }
}
if ($Request.Query.ListProperties) {
$Columns = ($Results | Select-Object -First 1).PSObject.Properties.Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Invoke-AddScheduledItem {
$Result = "Error scheduling task: $($_.Exception.Message)"
}
} else {
$Result = Add-CIPPScheduledTask -Task $Request.Body -Headers $Request.Headers -hidden $hidden -DisallowDuplicateName $Request.Query.DisallowDuplicateName
$Result = Add-CIPPScheduledTask -Task $Request.Body -Headers $Request.Headers -hidden $hidden -DisallowDuplicateName $Request.Query.DisallowDuplicateName -DesiredStartTime $Request.Body.DesiredStartTime
Write-LogMessage -headers $Request.Headers -API $APINAME -message $Result -Sev 'Info'
}
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Invoke-ExecRestoreBackup {

if ($Request.Body.BackupName -like 'CippBackup_*') {
$Table = Get-CippTable -tablename 'CIPPBackup'
$Backup = Get-CippAzDataTableEntity @Table -Filter "RowKey eq '$($Request.Body.BackupName)'"
$Backup = Get-CippAzDataTableEntity @Table -Filter "RowKey eq '$($Request.Body.BackupName)' or OriginalEntityId eq '$($Request.Body.BackupName)'"
if ($Backup) {
$BackupData = $Backup.Backup | ConvertFrom-Json -ErrorAction SilentlyContinue | Select-Object * -ExcludeProperty ETag, Timestamp
$BackupData | ForEach-Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Invoke-ExecTenantGroup {
Add-CIPPAzDataTableEntity @Table -Entity $GroupEntity -Force
}

$CurrentMembers = Get-CIPPAzDataTableEntity @MembersTable -Filter "GroupId eq '$groupId'"
$CurrentMembers = Get-CIPPAzDataTableEntity @MembersTable -Filter "PartitionKey eq 'Member' and GroupId eq '$groupId'"

$Adds = [System.Collections.Generic.List[string]]::new()
$Removes = [System.Collections.Generic.List[string]]::new()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using namespace System.Net

Function Invoke-AddPolicy {
function Invoke-AddPolicy {
<#
.FUNCTIONALITY
Entrypoint
Expand All @@ -14,8 +14,8 @@ Function Invoke-AddPolicy {
$Headers = $Request.Headers
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'

$Tenants = ($Request.Body.tenantFilter.value)
if ('AllTenants' -in $Tenants) { $Tenants = (Get-Tenants).defaultDomainName }
$Tenants = $Request.Body.tenantFilter.value ? $Request.Body.tenantFilter.value : $Request.Body.tenantFilter
if ('AllTenants' -in $Tenants) { $Tetnants = (Get-Tenants).defaultDomainName }
$displayname = $Request.Body.displayName
$description = $Request.Body.Description
$AssignTo = if ($Request.Body.AssignTo -ne 'on') { $Request.Body.AssignTo }
Expand All @@ -25,7 +25,7 @@ Function Invoke-AddPolicy {

$results = foreach ($Tenant in $tenants) {
if ($Request.Body.replacemap.$tenant) {
([pscustomobject]$Request.Body.replacemap.$tenant).psobject.properties | ForEach-Object { $RawJson = $RawJson -replace $_.name, $_.value }
([pscustomobject]$Request.Body.replacemap.$tenant).psobject.properties | ForEach-Object { $RawJson = $RawJson -replace $_.name, $_.value }
}
try {
Write-Host 'Calling Adding policy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ function Invoke-ListGroups {
$GroupType = $Request.Query.groupType
$Members = $Request.Query.members
$Owners = $Request.Query.owners
$SelectString = 'id,createdDateTime,displayName,description,mail,mailEnabled,mailNickname,resourceProvisioningOptions,securityEnabled,visibility,organizationId,onPremisesSamAccountName,membershipRule,groupTypes,onPremisesSyncEnabled,resourceProvisioningOptions,userPrincipalName&$expand=members($select=userPrincipalName)'

$ExpandMembers = $Request.Query.expandMembers ?? $false

$SelectString = 'id,createdDateTime,displayName,description,mail,mailEnabled,mailNickname,resourceProvisioningOptions,securityEnabled,visibility,organizationId,onPremisesSamAccountName,membershipRule,groupTypes,onPremisesSyncEnabled,resourceProvisioningOptions,userPrincipalName'
if ($ExpandMembers -ne $false) {
$SelectString = '{0}&$expand=members($select=userPrincipalName)' -f $SelectString
}


$BulkRequestArrayList = [System.Collections.Generic.List[object]]::new()

Expand Down Expand Up @@ -86,7 +93,7 @@ function Invoke-ListGroups {
$RawGraphRequest = New-GraphBulkRequest -tenantid $TenantFilter -scope 'https://graph.microsoft.com/.default' -Requests @($BulkRequestArrayList) -asapp $true
$GraphRequest = [PSCustomObject]@{
groupInfo = ($RawGraphRequest | Where-Object { $_.id -eq 1 }).body | Select-Object *, @{ Name = 'primDomain'; Expression = { $_.mail -split '@' | Select-Object -Last 1 } },
@{Name = 'teamsEnabled'; Expression = { if ($_.resourceProvisioningOptions -Like '*Team*') { $true } else { $false } } },
@{Name = 'teamsEnabled'; Expression = { if ($_.resourceProvisioningOptions -like '*Team*') { $true } else { $false } } },
@{Name = 'calculatedGroupType'; Expression = {
if ($_.mailEnabled -and $_.securityEnabled) { 'Mail-Enabled Security' }
if (!$_.mailEnabled -and $_.securityEnabled) { 'Security' }
Expand Down Expand Up @@ -129,4 +136,4 @@ function Invoke-ListGroups {
Body = $GraphRequest
})

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,21 @@ function Invoke-ExecJITAdmin {
if ($Request.Body.useraction -eq 'Create') {
Write-LogMessage -Headers $User -API $APIName -tenant $TenantFilter -message "Creating JIT Admin user $($Request.Body.Username)" -Sev 'Info'
Write-Information "Creating JIT Admin user $($Request.Body.username)"
$Domain = $Request.Body.Domain.value ? $Request.Body.Domain.value : $Request.Body.Domain

$JITAdmin = @{
User = @{
'FirstName' = $Request.Body.FirstName
'LastName' = $Request.Body.LastName
'UserPrincipalName' = "$($Request.Body.Username)@$($Request.Body.Domain.value)"
'UserPrincipalName' = "$($Request.Body.Username)@$($Domain)"
}
Expiration = $Expiration
Action = 'Create'
TenantFilter = $TenantFilter
}
$CreateResult = Set-CIPPUserJITAdmin @JITAdmin
$Username = "$($Request.Body.Username)@$($Request.Body.Domain.value)"
$Results.Add("Created User: $($Request.Body.Username)@$($Request.Body.Domain.value)")
$Username = "$($Request.Body.Username)@$($Domain)"
$Results.Add("Created User: $Username")
if (!$Request.Body.UseTAP) {
$Results.Add("Password: $($CreateResult.password)")
}
Expand Down
Loading