Skip to content

This PowerShell Runbook (compatible with PowerShell Core) connects to Azure using an Automation Run As account, retrieves the power status of VMs and turns off / on in sequence those that are turned on / off. You can attach a recurring schedule to this runbook to run it at a spec

License

Notifications You must be signed in to change notification settings

krmanupa/stop-start-all-or-only-tagged-azure-vms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Stop / Start all or only tagged Azure VMs

DESCRIPTION

This PowerShell Runbook (compatible with PowerShell Core) connects to Azure using an Automation Run As account, retrieves the power status of VMs and turns off / on in sequence those that are turned on / off. You can attach a recurring schedule to this runbook to run it at a specific time.

REQUIRED

  1. An Automation connection asset called AzureRunAsConnection that contains the information for connecting with Azure using a service principal. To use an asset with a different name you can pass the asset name as a input parameter to this runbook.

  2. An Action input parameter value that allows runbook to handle VMs power state. The parameter must be set to 'Stop' or 'Start'.

  3. All the following PowerShell modules are required to run the cmdlets : Az.Accounts, Az.Resources, Az.Compute and Az.Automation.

OPTIONAL

  1. A TagName input parameter value that allows scoping the VMs to only tagged VMs.

  2. A TagValue input parameter value that allows scoping the VMs to a particular tag value.

AUTHOR

Farouk FRIHA

LAST EDIT

2019-19-05

RELEASE NOTES

2019-19-05 First release

2019-19-05 Handle changes to parameters

RUNBOOK CONTENT

** **

** **

** **

 

Note: TechNet gallery is retiring! This script was migrated from TechNet script center to GitHub by Microsoft Azure Automation product group.

About

This PowerShell Runbook (compatible with PowerShell Core) connects to Azure using an Automation Run As account, retrieves the power status of VMs and turns off / on in sequence those that are turned on / off. You can attach a recurring schedule to this runbook to run it at a spec

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published