Skip to content

Commit

Permalink
improve error message for gdap invites
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Feb 25, 2025
1 parent 1c63f4f commit e509cb1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ Function Invoke-ExecGDAPInvite {
} catch {
$Message = 'Error creating GDAP relationship, failed at step: ' + $Step
Write-Host "GDAP ERROR: $($_.InvocationInfo.PositionMessage)"
Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $env:TenantID -message "$($Message): $($_.Exception.Message)" -Sev 'Error' -LogData (Get-CippException -Exception $_)

if ($Step -eq 'Creating GDAP relationship' -and $_.Exception.Message -match 'The user (principal) does not have the required permissions to perform the specified action on the resource.') {
$Message = 'Error creating GDAP relationship, ensure that all users have MFA enabled and enforced without exception. Please see the Microsoft Partner Security Requirements documentation for more information. https://learn.microsoft.com/en-us/partner-center/security/partner-security-requirements'
} else {
$Message = "$($Message): $($_.Exception.Message)"
}

Write-LogMessage -headers $Request.Headers -API $APINAME -tenant $env:TenantID -message $Message -Sev 'Error' -LogData (Get-CippException -Exception $_)
}

$body = @{
Expand Down

0 comments on commit e509cb1

Please sign in to comment.