Skip to content

Commit

Permalink
GDAP Invite durable
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Mar 14, 2024
1 parent 78ae1c8 commit dbc431a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
7 changes: 3 additions & 4 deletions ExecGDAPInviteApproved_Timer/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"schedule": "0 0 */3 * * *"
},
{
"type": "queue",
"direction": "out",
"name": "gdapinvitequeue",
"queueName": "gdapinvitequeue"
"name": "starter",
"type": "durableClient",
"direction": "in"
}
]
}
10 changes: 0 additions & 10 deletions ExecGDAPInviteQueue/function.json

This file was deleted.

7 changes: 0 additions & 7 deletions ExecGDAPInviteQueue/run.ps1

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function Push-ExecGDAPInviteQueue {
# Input bindings are passed in via param block.
param($Item)

# Write out the queue message and metadata to the information log.
Write-Host "PowerShell queue trigger function processed work item: $($Item.customer.displayName)"

Set-CIPPGDAPInviteGroups -Relationship $Item
}
15 changes: 13 additions & 2 deletions Modules/CIPPCore/Public/Set-CIPPGDAPInviteGroups.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,23 @@ function Set-CIPPGDAPInviteGroups {
if (($InviteList | Measure-Object).Count -gt 0) {
$Activations = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/tenantRelationships/delegatedAdminRelationships?`$filter=status eq 'active'"

foreach ($Activation in $Activations) {
$Batch = foreach ($Activation in $Activations) {
if ($InviteList.RowKey -contains $Activation.id) {
Write-Host "Mapping groups for GDAP relationship: $($Activation.customer.displayName) - $($Activation.id)"
Push-OutputBinding -Name gdapinvitequeue -Value $Activation
$Activation | Add-Member -NotePropertyName FunctionName -NotePropertyValue 'ExecGDAPInviteQueue'
$Activation
}
}
if (($Batch | Measure-Object).Count -gt 0) {
$InputObject = [PSCustomObject]@{
OrchestratorName = 'GDAPInviteOrchestrator'
Batch = @($Batch)
SkipLog = $true
}
#Write-Host ($InputObject | ConvertTo-Json)
$InstanceId = Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Depth 5)
Write-Host "Started GDAP Invite orchestration with ID = '$InstanceId'"
}
}
}
}

0 comments on commit dbc431a

Please sign in to comment.