Skip to content

Commit ceab374

Browse files
authored
AKS - create .ssh folder before creating ssh public key (#20054)
1 parent bd229af commit ceab374

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Aks/Aks/Commands/NewAzureRmAks.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,11 @@ private void PreValidate()
266266

267267
private string GenerateSshKeyValue()
268268
{
269-
String generateSshKeyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".ssh", "id_rsa"); ;
269+
String generateSshKeyFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".ssh");
270+
if (!Directory.Exists(generateSshKeyFolder)) {
271+
Directory.CreateDirectory(generateSshKeyFolder);
272+
}
273+
String generateSshKeyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".ssh", "id_rsa");
270274
if (File.Exists(generateSshKeyPath))
271275
{
272276
throw new AzPSArgumentException(

0 commit comments

Comments
 (0)