Public/Configuration/Add-CompanyBranding.ps1
function Add-CompanyBranding { param( [Parameter(Mandatory)] [string]$TenantId, [Parameter()] [string]$SignInPageText = '**Har du udfordringer med login?** Kontakt [Jysk IT](https://jyskit.dk) på 76 60 22 00' ) try { Connect-CustomerGraph -CustomerTenantId $TenantId $Branding = Get-MgOrganizationBranding -OrganizationId $TenantId -ErrorAction SilentlyContinue if( !$Branding ) { $Branding = New-MgOrganizationBrandingLocalization -OrganizationId $TenantId -SignInPageText $SignInPageText Write-ModuleLog -Message "Created company branding." -Level Info -Component 'CompanyBranding' } elseif ( $Branding.SignInPageText -ne $SignInPageText ) { $Branding = Update-MgOrganizationBrandingLocalization -OrganizationId $TenantId -SignInPageText $SignInPageText -OrganizationalBrandingLocalizationId $Branding.Id Write-ModuleLog -Message "Updated company branding." -Level Info -Component 'CompanyBranding' } else { Write-ModuleLog -Message "Company branding already set..." -Level Info -Component 'CompanyBranding' } } catch { Write-ModuleLog -Message "Failed to create company branding: $_" -Level Error -Component 'CompanyBranding' } } |