Assumptions: You have an enterprise application created within the Azure portal. If not, follow steps 1-8 on this page.
You will need to assign your application a role within the subscription that contains the Virtual Machines you wish to control. This role will need to have permission to access Virtual Machine resources and resource groups.