Generate ssh keys for azure virtual machines


I am new to terraform. I am trying to create azure virtual machine. For it I have seen examples that require us to generate a keypair and provide a public key to the VM. I want to generate a new keypair for my VM using terraform. This can be done on Azure UI but I am not sure how to do it using terraform.
It will be very helpful if someone can help.

Thank you