Public/PartnerActions/New-GDAPAccessAssignments.ps1

function New-GDAPAccessAssignments() {
    param(
        [Parameter(Mandatory)]
        [string]$RelationshipId
        )

    Connect-CustomerGraph -CustomerTenantId $PartnerTenantId

    # First access assignment
    try {
        New-MgTenantRelationshipDelegatedAdminRelationshipAccessAssignment -DelegatedAdminRelationshipId $RelationshipId -BodyParameter $FirstAccessAssignmentParams | Out-Null
        Write-Host "Created first access assignment" -ForegroundColor Green
    }
    catch {
        Write-Error "Failed to create first access assignment: $_"
    }
    
    
    # Second access assignment
    try {
        New-MgTenantRelationshipDelegatedAdminRelationshipAccessAssignment -DelegatedAdminRelationshipId $RelationshipId -BodyParameter $SecondAccessAssignmentParams | Out-Null
        Write-Host "Created second access assignment" -ForegroundColor Green
    }
    catch {
        Write-Error "Failed to create second access assignment: $_"
    }
}