Hello Missaghian, Nevenka,
The error "AADSTS700027: The certificate with identifier used to sign the client assertion is not registered on application. The key was not found" usually occurs if the certificate is not uploaded in the Microsoft Entra ID application.

I generated a certificate by using below commands:
openssl genrsa -out certificateprivate.key 2048
openssl req -new -key certificateprivate.key -out certificate.csr
openssl x509 -req -days 365 -in certificate.csr -signkey certificateprivate.key -out accesstokenwithcertificate.crt
openssl rsa -in certificateprivate.key -pubout -out certificatepublickey.pem
And the certificate is not stored in Windows Certificate Store:
$thumbprint = "Thumbprintofcert"
$cert = Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object { $_.Thumbprint -eq $thumbprint }
if ($null -eq $cert) {
Write-Output "Certificate NOT found in CurrentUser\My store."
} else {
Write-Output "Certificate found."
}

To resolve the error, make sure to upload the certificate in the Microsoft Entra ID application:

Generate Base64 Thumbprint:
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("C:\Users\rukmini\accesstokenwithcertificate.crt")
$thumbprintBytes = $cert.GetCertHash()
# Convert to Base64Url (no padding, no + or /)
$base64UrlThumbprint = [System.Convert]::ToBase64String($thumbprintBytes) -replace '\+', '-' -replace '/', '_' -replace '='
Write-Output "Base64Url Thumbprint: $base64UrlThumbprint"

Now, use https://jwt.io/ to generate the client assertion:
HEADER:
{
"alg": "RS256",
"typ": "JWT",
"x5t": "Passtheabovebase64UrlThumbprint"
}
PAYLOAD:DATA
{
"aud": "https://login.microsoftonline.com/TenantID/oauth2/v2.0/token",
"exp": xxx,
"iss": "ApplicationClientId",
"jti": "RandomUniqueIdentifier",
"nbf": xxx,
"sub": "ApplicationClientId"
}
VERIFY SIGNATURE:
{
public key to a PEM format
Private key to a PEM format
}
I used below commands to get the values:
notepad certificateprivate.key
notepad certificatepublickey.pem

Now copy the token from the left side and pass it as client_assertion:

I am able to generate access token successfully:
https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
client_id: ClientID
scope: https://graph.microsoft.com/.default
client_assertion_type: urn:ietf:params:oauth:client-assertion-type:jwt-bearer
client_assertion: copyfromabove
grant_type: client_credentials

Note: Microsoft Entra ID requires RS256 and it does not support PS256 for client credentials flow (client_assertion JWTs).
Hope this helps!
If this answers your query, do click Accept Answer and Yes for was this answer helpful, which may help members with similar questions.

If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.