Could not connect to AzureDB with Azure AD Access Token from PHP

Im trying to connect to AzureDB from PHP via Microsoft Entra Auth as described below,using sqlsrv driver:

https://learn.microsoft.com/en-us/sql/connect/php/azure-active-directory?view=sql-server-ver15#example—connect-using-azure-ad-access-token

Used script:

<?php
$azureAdServer = 'xxx.crm4.dynamics.com,5558';
$accToken = 'xxx>';
$azureAdDatabase = 'xxx';

// Using an access token to connect: do not use UID or PWD connection options
// Assume $accToken is the valid byte string extracted from an OAuth JSON response
$connectionInfo = array("Database"=>$azureAdDatabase,"AccessToken"=>$accToken);
$conn = sqlsrv_connect($azureAdServer, $connectionInfo);
if ($conn === false) {
    echo "Could not connect with Azure AD Access Token.n";
   die( print_r( sqlsrv_errors(), true));
} else {
    echo "Connected successfully with Azure AD Access Token.n";
    sqlsrv_close($conn);
}
?>

always get:

Could not connect with Azure AD Access Token

I can confirm that credentials are correct, connection via c# works, see below:

Image of C# code which works

Do you have any clue if that script working? I’ve spent a couple of hours with this connection and donĀ“t have any other idea. AI fails too.

Thank you in advance for any help.

Michal