Advertisement
meggenberger

Untitled

Mar 28th, 2023
642
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. virtual_machine = compute.VirtualMachine('my-vm',
  2.     resource_group_name=resource_group.name,
  3.     network_interface_ids=[network_interface.id],
  4.     vm_size='Standard_B2s',
  5.     storage_image_reference={
  6.         'publisher': 'Canonical',
  7.         'offer': 'UbuntuServer',
  8.         'sku': '20.04-LTS',
  9.         'version': 'latest',
  10.     },
  11.     storage_os_disk={
  12.         'name': 'myosdisk',
  13.         'caching': 'ReadWrite',
  14.         'create_option': 'FromImage',
  15.         'managed_disk_type': 'Standard_LRS',
  16.     },
  17.     os_profile={
  18.         'computer_name': 'myvm',
  19.         'admin_username': 'azuser',
  20.         'linux_configuration': {
  21.             'disable_password_authentication': True,
  22.             'ssh': {
  23.                 'public_keys': [{
  24.                     'path': '/home/azuser/.ssh/authorized_keys',
  25.                     'key_data': open('/path/to/.ssh/id_rsa.pub').read()
  26.                 }]
  27.             }
  28.         }
  29.     }
  30. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement