Bobcares

Azure Automation Deallocate VM: Configuration

by | Feb 22, 2023

Let us learn more on how to set up azure automation deallocate vm. With the support of our Server management support services, we can give you a detailed overview of the whole process.

Stopped vs Deallocated azure automation vm

We are already aware that Azure Virtual Machines are just in halt and will continue to Deallocate to cost more money. Virtual Machines with the status “VM Stopped” will charge for CPU and Memory allocation.

This post will assist us in implementing a PS Script that will run on a schedule in a Runbook and will go through all of the virtual machines in the subscriptions that are Stopped but not Deallocated and deallocate them for us. This poses no risk because the Virtual Machine has already been stopped.

Creating a Runbook for azure automation deallocate vm

Select Azure Automation Accounts. Use the Search function to locate it faster.

Access the automation account that we set up. The Az. Compute and Az. Account modules must first be added to the account’s blade.

To do so, go to the Modules gallery and look for Az. Accounts and Az. Compute. Click on it, then select Import. It may take some time to complete the importing.

After that, choose Runbooks and then Make a playbook. Give it a name, choose PowerShell as the type, and add a description if desired.

Copy and paste the script below into the Edit PowerShell Runbook.

azure automation deallocate vm

To validate the script, click Test Pane and then Start. Keep in mind that if the script detects Stopped VMs during the validation, it will deallocate them.

The output should look like this, and any Stopped machines should now be Deallocated.

Now that we’ve tested the script, return to the Script Editor and press the Publish button. To run it on a schedule, we must either connect it to an existing one or establish a new one.

This is the final step in the process azure automation deallocate vm.

[Need assistance with similar queries? We are here to help]

Conclusion

To sum up, we have now learned more about the azure automation deallocate vm. With the support of our Server management support services, we have seen a complete overview of the process.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.