Thanks for reaching out on Microsoft Q&A!
The following code snippet allows you to SHA256 hash a string in the Azure API Management policy, where you can replace <signing-key> with your own signing key, and <string-to-sign> with the value you want to hash:
@{
System.Security.Cryptography.HMACSHA256 hasher = new System.Security.Cryptography.HMACSHA256(<signing-key>);
return Convert.ToBase64String(hasher.ComputeHash(System.Text.Encoding.UTF8.GetBytes(<string-to-sign>)));
}
Please click 'Accept answer' if you find this helpful.
Feel free to drop additional queries in the comments below!
Kind regards,
Sonny