If you have an Azure Virtual Machine (VM) that you work with frequently, you would typically try to manage this experience through the Azure Portal. The user experience is pretty intuitive and easy to work with. Simply press the Start button to startup a new instance and Stop button to shutdown the instance.
However, I must admit that this approach still does not satisfy my desire to save time. After all, this is the era of Automation and Microsoft Azure must have a better approach to this problem!
The following are the steps you can take to automate this experience.
I hope this helps you in automating your Azure VM experience.
However, I must admit that this approach still does not satisfy my desire to save time. After all, this is the era of Automation and Microsoft Azure must have a better approach to this problem!
The following are the steps you can take to automate this experience.
- Step 1: It is not a good practice to use our own account to do this work because it is usually a Global Administer role with full rights. Thus, let's create another user account via Azure AD as a Limited Administrator.
- Step 2: Grant the user the Role of Service Administrator.
- Step 3: Create the following powershell file. The bat files are created to start and stop your Azure virtual machine.
- Step 4: The following (one-time) prompt would appear. Type in the username, then the password.
- Step 5: Lastly, you can create a Remote Desktop Connection (RDC) Shortcut with credentials already set. This way, you just need to do 3 things. Run the startvm.bat file to start the Azure VM, then, run the RDC shortcut to remote in. When you are done, just close the RDC session and run the stopvm.bat.
I hope this helps you in automating your Azure VM experience.
Comments
Post a Comment