I am trying to create virtual machine scale set via azure python sdk and I am using the following JSON patter object argument
{
"name":"TEST_CLUSTER",
"location":"westeurope",
"sku":{
"tier":"Standard",
"capacity":1,
"name":"Standard_B1s"
},
"virtual_machine_profile":{
"storage_profile":{
"image_reference":{
"id":"some_id",
"offer":null,
"sku":null,
"version":null
},
"os_disk":{
"caching":"ReadWrite",
"create_option":"FromImage",
"disk_size_gb":30,
"managed_disk":{
"storage_account_type":"Premium_LRS"
}
}
},
"os_profile":{
"computer_name_prefix":"TESTAMSETUP",
"admin_username":"testuser",
"admin_password":null,
"linux_profile":{
"disable_password_authentication":true,
"provision_vm_agent":true,
"ssh":{
"public_keys":[
{
"path":"/some/key/path",
"key_daya":"some-key-data"
}
]
},
"patch_settings":{
"patch_mode":"ImageDefault",
"assessment_mode":"ImageDefault"
}
}
},
"network_profile":{
"network_interface_configurations":[
{
"name":"testnetworkinterface",
"primary":null,
"ip_configurations":[
{
"name":"testnetworkinterface",
"properties":{
"subnet":{
"id":"some_id"
}
}
}
]
}
]
}
},
"upgrade_mode":"Manual",
"upgrade_policy":{
"mode":"Manual"
}
}
I would expect the vmss to be created with ssh key authentication, as far as I have specified disable_password_authentication
as true
, but after running my script I get the following error message.
Error azure_create_scale_set.py: (InvalidParameter) Required parameter 'adminPassword' is missing (null).
Code: InvalidParameter
Message: Required parameter 'adminPassword' is missing (null).
Target: adminPassword
I found a github issue related to the same problem. However for OP in github the problem was resolved by setting disable_password_authentication
as true
. My question is how to create vmss with azure python sdk with just ssh-key authentication option.
You can use the below code to create a virtual machine scale set with
ssh-key
authentication option bydisable_password_authentication
astrue
using Azure Python SDK.Code:
Output:
Portal:
Reference:
Update:
Without passing
adminPassword
parameters in the code the virtual machine scale set is created successfully with SSH authentication.Portal: