Authorization error when using incoming webhook to post a message on Teams shared channel.

Irdi Xhiani 0 Reputation points


I have created an incoming webhook because I want to use it on my powershell automation script to send messages on a specific shared Teams channel every time we update a new version of our web app.

It worked fine until 2 days ago where it failed. We have a CI/CD pipeline that sends messages to a Teams channel via the "Incoming Webhook" connector. The error message is like this: "XXX is unauthorized, the public key XXX is not found for ring WW, cannot validate signature." I have tried creating a new one, and it poses the same issue.

Note: Using the webhook outside my environment with a simple psh script like below will result successful.

But im concerned that the authorization problem popped up 2 days ago when it was working fine before.

$message = "This is a test message. :-)"

# Define your webhook URL
$webhookUrl = "https://fi***********4a-b017-d0a45c6d4d1d/IncomingWebhook/877ab88984904d20b5af4de942734029/91636910-66af-4df5-9a30-236eea258894"

# Create a JSON payload
$payload = @{
    text = $message
} | ConvertTo-Json

# Send the message to the Teams channel
Invoke-RestMethod -Method Post -ContentType 'application/json' -Body $payload -Uri $webhookUrl

Another example of the error is as below:

Microsoft.Exchange.Security.TokenIssuer.Common.SubstrateTokenRequestException: Request 427c2e45-22b1-43a3-94dd-e277dfd221e1;1697517710;1.0;48af08dc-f6d2-435f-b2a7-069abd99c086;;;[],bd581b29e7bf4a48b16e7fc6bca2cb66,48af08dc-f6d2-435f-b2a7-069abd99c086,;GlobalActor;{TokenScopeType,CloudInstance},{AccessType,HpaAsApp},{PopKey,{"kty":"RSA","n":"v95EizVpL385wCMW8sD3n_qACwnPKv2IstraFBLo_RU5bq6Ky8BwSDw_U-SB42qdH-W8X7BKBE2IRdfrT4aJkGgfMqQhPFAmH-xr-hIbBr6b4bcfjaocrGLpGxqS5b60MszTKdooHIy6JQasfsnzDJ367mFvtPj9fwAgAynKr-PTfI3y8Pn2-oZcuaz9jX2aF0qEngWOasr4sLVrq654NxUD7MBf3He-Yd_1-bYAMtVNfsG0Iv8Ih6HJ4EJcJUbSfBvgc1SWqrg0IGGJJZYcsodJkQ36DnQeUk28NGT2KdNawyzKZDAaVpxunH6eFOCE2NguwjN_Y-TrNZSHIHEKaQ","e":"AQAB","alg":"RS256","kid":"749f5a89-100e-44fc-9b8c-5c4a014bb709"}};warqvR45thDtXFmf0RCvmtXXdLU=;lejdjFZ-mokS5YZuZ55T4fppdDY to https://localhost:444/sts/token/1 on server DM8PR01MB6856 failed with status code 401(Unauthorized) and reason {"Message":"STI server DM8PR01MB6856 failed to process request. Error: Request "427c2e45-22b1-43a3-94dd-e277dfd221e1;1697517710;1.0;48af08dc-f6d2-435f-b2a7-069abd99c086;;;[],bd581b29e7bf4a48b16e7fc6bca2cb66,48af08dc-f6d2-435f-b2a7-069abd99c086,;GlobalActor;{TokenScopeType,CloudInstance},{AccessType,HpaAsApp},{PopKey,{"kty":"RSA","n":"v95EizVpL385wCMW8sD3n_qACwnPKv2IstraFBLo_RU5bq6Ky8BwSDw_U-SB42qdH-W8X7BKBE2IRdfrT4aJkGgfMqQhPFAmH-xr-hIbBr6b4bcfjaocrGLpGxqS5b60MszTKdooHIy6JQasfsnzDJ367mFvtPj9fwAgAynKr-PTfI3y8Pn2-oZcuaz9jX2aF0qEngWOasr4sLVrq654NxUD7MBf3He-Yd_1-bYAMtVNfsG0Iv8Ih6HJ4EJcJUbSfBvgc1SWqrg0IGGJJZYcsodJkQ36DnQeUk28NGT2KdNawyzKZDAaVpxunH6eFOCE2NguwjN_Y-TrNZSHIHEKaQ","e":"AQAB","alg":"RS256","kid":"749f5a89-100e-44fc-9b8c-5c4a014bb709"}};warqvR45thDtXFmf0RCvmtXXdLU=;lejdjFZ-mokS5YZuZ55T4fppdDY" is unauthorized, the public key warqvR45thDtXFmf0RCvmtXXdLU= is not found for ring WW, cannot validate signature"}. The response headers are: Date:Tue, 17 Oct 2023 04:41:49 GMT;Server:Microsoft-HTTPAPI/2.0.'on/json' -Body $payload -Uri $webhookUrl

Can you please look into this and see if the problem can be fixed because it's very important and I'm seeing many people have the same issue?

Is there any instructions you can give me to try?

Thanks in advance,


Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,919 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Meghana-MSFT 3,786 Reputation points Microsoft Vendor

    An incident was raised related to this error - Web Hooks erroring randomly, unauthorized, the public key XXXXXXXXXXXXXXXXX = is not found for ring WW, cannot validate signature"}.

    The issue has been mitigated, and many users have confirmed that it is working fine now. Could you please confirm if you still see this issue.

    0 comments No comments