Hi,
I may be missing something but cannot understand how to use the private key stored in my Keyvault to access the desired SFTP server, via an azure function.
Using the code examples here - https://www.alessandromoura.com.br/2022/02/14/connecting-an-azure-function-to-a-sftp-server-using-ssh-keys-stored-in-azure-key-vault/ - I have tried to connect. I appear to acquire the key no problem but Im assuming its the public version as the only thing that works on it is:
var Kclient = new KeyClient(new Uri(KVault), new DefaultAzureCredential());
KeyVaultKey key = Kclient.GetKey("mykey");
MemoryStream ms = new MemoryStream(key.Key.ToRSA().ExportRSAPublicKey());
After this when I try to connect it just gives me "Invalid private key file". What am I doing wrong?
Have i configured this correctly? When using keys to access SFTP, is it correct to store them in the Keyvault this way?
Thanks for your time.