@@ -9,7 +9,7 @@ function Invoke-CippPartnerWebhookProcessing {
99 $AuditLog = New-GraphGetRequest - uri $Data.AuditUri - tenantid $env: TenantID - NoAuthCheck $true - scope ' https://api.partnercenter.microsoft.com/.default'
1010 }
1111
12- Switch ($Data.EventName ) {
12+ switch ($Data.EventName ) {
1313 ' test-created' {
1414 Write-LogMessage - API ' Webhooks' - message ' Partner Center webhook test received' - Sev ' Info'
1515 }
@@ -62,16 +62,23 @@ function Invoke-CippPartnerWebhookProcessing {
6262 # Check for partner webhook onboarding settings
6363 $ConfigTable = Get-CIPPTable - TableName Config
6464 $WebhookConfig = Get-CIPPAzDataTableEntity @ConfigTable - Filter " RowKey eq 'PartnerWebhookOnboarding'"
65- if ($WebhookConfig.StandardsExcludeAllTenants -eq $true ) {
66- $OnboardItem.StandardsExcludeAllTenants = $true
67- }
6865
69- # Add onboarding entry to the table
70- $OnboardTable = Get-CIPPTable - TableName ' TenantOnboarding'
71- Add-CIPPAzDataTableEntity @OnboardTable - Entity $TenantOnboarding - Force - ErrorAction Stop
66+ # Only proceed if automated onboarding is enabled
67+ if ($WebhookConfig.Enabled -eq $true ) {
68+ if ($WebhookConfig.StandardsExcludeAllTenants -eq $true ) {
69+ $OnboardItem.StandardsExcludeAllTenants = $true
70+ }
71+
72+ # Add onboarding entry to the table
73+ $OnboardTable = Get-CIPPTable - TableName ' TenantOnboarding'
74+ Add-CIPPAzDataTableEntity @OnboardTable - Entity $TenantOnboarding - Force - ErrorAction Stop
7275
73- # Start onboarding
74- Push-ExecOnboardTenantQueue - Item $OnboardItem
76+ # Start onboarding
77+ Push-ExecOnboardTenantQueue - Item $OnboardItem
78+ Write-LogMessage - API ' Webhooks' - message " Automated onboarding started for relationship $Id " - Sev ' Info'
79+ } else {
80+ Write-LogMessage - API ' Webhooks' - message " Automated onboarding is disabled. GDAP relationship $Id approved but not onboarded automatically." - Sev ' Info'
81+ }
7582 } else {
7683 if ($AuditLog ) {
7784 Write-LogMessage - API ' Webhooks' - message " Partner Center $ ( $Data.EventName ) audit log webhook received" - LogData $AuditObj - Sev ' Alert'
0 commit comments