Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. def run_script():
  2. credentials_dict = authenticate( client_id, key, tenant_id )
  3. compute_client = ComputeManagementClient( credentials_dict['credentials'], credentials_dict['subscription_id'] )
  4. GROUP_NAME = 'DEV-Central'
  5. vmname = 'run-script-vm'
  6. ext_type_name = 'CustomScriptForLinux'
  7. ext_name = 'varun-script-test'
  8. params_create = {
  9. 'location':'centralindia',
  10. 'publisher': 'Microsoft.OSTCExtensions',
  11. 'virtual_machine_extension_type': ext_type_name,
  12. 'type_handler_version': '1.5',
  13. 'auto_upgrade_minor_version': True,
  14. 'settings':
  15. {
  16. 'fileUris': ["https://s3.ap-south-1.amazonaws.com/mybucketprog/custom_script.sh"],
  17. 'commandToExecute': "sh custom_script.sh"
  18. }
  19. }
  20. ext_poller = compute_client.virtual_machine_extensions.create_or_update( GROUP_NAME, vmname,ext_name,params_create )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement