'How do I Authenticate to AAD using Invoke-RestMethod with ClientCredential flow using certfiicate and get the token?

How do I Authenticate to AAD using Invoke-RestMethod with ClientCredential flow using certificate and get the token?

I tried to search for it but no success. I can authenticate with client Secret but I want to use cert for security purposes.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source