Having some trouble creating and sshing into a virtual machine using the Azure nextgen Pulumi API on my Windows 10 machine.
After successfully creating the VM, I export the private key to a file for testing purposes. I then adjust the permissions to prevent the 'permissions too open' error and attempt to run ssh user@ip -i keyfile.rsa
. However, I keep getting the error message: Load key ... invalid format.
Check out the code snippet below:
const rsaKey = new tls.PrivateKey("rsaKey", {
algorithm: "RSA",
});
const vm = new azure_nextgen.compute.latest.VirtualMachine("vm", {
location: resourceGroup.location,
resourceGroupName: resourceGroup.name,
vmName: "linuxvm",
hardwareProfile: {
vmSize: "Standard_B1ms", // maybe change to standard b2ms
},
networkProfile: {
networkInterfaces: [{
id: networkInterface.id,
}]
},
osProfile: {
adminUsername: vmUser,
computerName: "test-vm",
linuxConfiguration: {
disablePasswordAuthentication: true,
ssh: {
publicKeys: [{
keyData: rsaKey.publicKeyOpenssh,
path: "/home/*username*/.ssh/authorized_keys",
}]
}
}
},
storageProfile: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18.04-LTS",
version: "latest",
},
osDisk: {
caching: "ReadWrite",
createOption: "FromImage",
managedDisk: {
storageAccountType: "Standard_LRS",
},
name: "myVMosdisk",
},
}
})
Running into issues with...