Azure VM Control Script

Hi,

i just built a script for controlling a Azure VM through Homeassistent (eg booting when i want to start my homelab).

Homeassistant part:

switch:
  - platform: command_line
    switches:
      azurelab:
        command_on: python3 path/azure_vm_cli.py start
        command_off: python3 path/azure_vm_cli.py stop
        command_state: python3 path/azure_vm_cli.py status
        friendly_name: "Azure Lab VM"
        value_template: "{{ value }}"

Script:

Configure Azure for Script Access:

Have fun!
You have a better idea/solution? Lets discuss it!

2 Likes

Thanks for sharing, works like a charm :+1: