Created my key vault in Azure and put some secrets in it.
Restrict access to the key vault to know IP addresses, assigned access to my local IP and the IP address of the plesk server
Then created a service principal in AAD and created a key.
Then assigned it permissions on the key vault using the following powershell script:
Login-AzureRmAccount
Set-AzureRmContext -SubscriptionId "<sub id>"
Set-AzureRmKeyVaultAccessPolicy -VaultName '<key vault name>' -ServicePrincipalName '<sp id>' -PermissionsToSecrets all -ResourceGroupName '<resource group>'
Finally access the key vault in your code using your service principal app ID and key.
I would have preferred not to access using the service principal key since this has to be present in the code. I couldn't find any secret storage in plesk for storing the key. I tried to do it using a cert since azure key vault allows access using a cert that's associated with the service principal instead of the key however plesk and azure key vault use certs in different formats, azure key vault uses pfx whereas plesk expects crt. One can be converted to the other using open ssl but you would have to include this in your code as well and I didn't want to go that far. But since we are restricting access to known IPs i think this is secure enough but I am open to other suggestions.