Public/TenantConfiguration/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-Host "Created company branding." -ForegroundColor Green
        }

        elseif ( $Branding.SignInPageText -ne $SignInPageText  ) {
            $Branding = Update-MgOrganizationBrandingLocalization -OrganizationId $TenantId -SignInPageText $SignInPageText -OrganizationalBrandingLocalizationId $Branding.Id  
            Write-Host "Updated company branding to $($SignInPageText)." -ForegroundColor Green
        }

        else {
            Write-Host "Company branding already set..." -ForegroundColor Yellow
        }
    }
    catch {
        throw "Failed to create company branding: $_"
    }
}