diff --git a/builder/azure/arm/config.go b/builder/azure/arm/config.go index 8b025ff3..758f852a 100644 --- a/builder/azure/arm/config.go +++ b/builder/azure/arm/config.go @@ -861,6 +861,9 @@ func setUserNamePassword(c *Config) error { } if c.Comm.Type == "ssh" { + if c.Comm.SSHPassword == "" { + c.Comm.SSHPassword = c.Password + } return nil } diff --git a/builder/azure/arm/config_test.go b/builder/azure/arm/config_test.go index 15a68b80..a260371c 100644 --- a/builder/azure/arm/config_test.go +++ b/builder/azure/arm/config_test.go @@ -72,8 +72,8 @@ func TestConfigUserNameOverride(t *testing.T) { if c.Password != c.tmpAdminPassword { t.Errorf("Expected 'Password' to be set to generated password, but found %q!", c.Password) } - if c.Comm.SSHPassword != "" { - t.Errorf("Expected 'c.Comm.SSHPassword' to be empty, but found %q!", c.Comm.SSHPassword) + if c.Comm.SSHPassword != c.tmpAdminPassword { + t.Errorf("Expected 'c.Comm.SSHPassword' to set to generated password, but found %q!", c.Comm.SSHPassword) } if c.UserName != "override_username" { t.Errorf("Expected 'UserName' to be set to 'override_username', but found %q!", c.UserName)