only set VM passwords on Windows (#620)

This commit is contained in:
bmc-msft
2021-03-03 16:27:56 -05:00
committed by GitHub
parent d2e6c29e6b
commit 92c1d0a7a1
2 changed files with 7 additions and 2 deletions

View File

@ -77,7 +77,6 @@ def create_vm(
"os_profile": { "os_profile": {
"computer_name": "node", "computer_name": "node",
"admin_username": "onefuzz", "admin_username": "onefuzz",
"admin_password": password,
}, },
"hardware_profile": {"vm_size": vm_sku}, "hardware_profile": {"vm_size": vm_sku},
"storage_profile": {"image_reference": image_ref}, "storage_profile": {"image_reference": image_ref},
@ -88,7 +87,11 @@ def create_vm(
if isinstance(image_os, Error): if isinstance(image_os, Error):
return image_os return image_os
if image_os == OS.windows:
params["os_profile"]["admin_password"] = password
if image_os == OS.linux: if image_os == OS.linux:
params["os_profile"]["linux_configuration"] = { params["os_profile"]["linux_configuration"] = {
"disable_password_authentication": True, "disable_password_authentication": True,
"ssh": { "ssh": {

View File

@ -263,7 +263,6 @@ def create_vmss(
"os_profile": { "os_profile": {
"computer_name_prefix": "node", "computer_name_prefix": "node",
"admin_username": "onefuzz", "admin_username": "onefuzz",
"admin_password": password,
}, },
"network_profile": { "network_profile": {
"network_interface_configurations": [ "network_interface_configurations": [
@ -285,6 +284,9 @@ def create_vmss(
if isinstance(image_os, Error): if isinstance(image_os, Error):
return image_os return image_os
if image_os == OS.windows:
params["virtual_machine_profile"]["os_profile"]["admin_password"] = password
if image_os == OS.linux: if image_os == OS.linux:
params["virtual_machine_profile"]["os_profile"]["linux_configuration"] = { params["virtual_machine_profile"]["os_profile"]["linux_configuration"] = {
"disable_password_authentication": True, "disable_password_authentication": True,