private/review/sharepointonline/policies/Invoke-ReviewSpoEntraIdB2B.ps1
function Invoke-ReviewSpoEntraIdB2B { <# .SYNOPSIS Review if Entra ID B2B is enabled in SharePoint Online. .DESCRIPTION Returns review object. .NOTES Requires the following modules: - Pnp.PowerShell .EXAMPLE Invoke-ReviewSpoEntraIdB2B; #> [cmdletbinding()] param ( ) BEGIN { # Write progress. Write-Progress -Activity $MyInvocation.MyCommand -Status 'Running' -CurrentOperation $MyInvocation.MyCommand.Name -PercentComplete -1 -SecondsRemaining -1; } PROCESS { # Write to log. Write-CustomLog -Category 'SharePoint Online' -Subcategory 'Policies' -Message ('Getting SharePoint tenant configuration') -Level Verbose; # Get tenant settings. $tenantSettings = Get-PnPTenant; # Write to log. Write-CustomLog -Category 'SharePoint Online' -Subcategory 'Policies' -Message ("Enable Entra B2B feature is set to '{0}'" -f $tenantSettings.EnableAzureADB2BIntegration) -Level Verbose; } END { # Bool for review flag. [bool]$reviewFlag = $false; # If review flag should be set. if ($false -eq $tenantSettings.EnableAzureADB2BIntegration) { # Should be reviewed. $reviewFlag = $true; } # Create new review object to return. [Review]$review = [Review]::new(); # Add to object. $review.Id = '68e99561-878a-4bcd-bce1-d69a6c0e2282'; $review.Category = 'Microsoft SharePoint Admin Center'; $review.Subcategory = 'Policies'; $review.Title = 'Ensure SharePoint and OneDrive integration with Azure AD B2B is enabled'; $review.Data = $tenantSettings | Select-Object -Property EnableAzureADB2BIntegration; $review.Review = $reviewFlag; # Print result. $review.PrintResult(); # Return object. return $review; } } |