Skip to content

Instantly share code, notes, and snippets.

View ejdyksen's full-sized avatar
😎

E.J. Dyksen ejdyksen

😎
View GitHub Profile
@ejdyksen
ejdyksen / start-vm.ps1
Created May 13, 2021 22:18
Start a VM from Azure Automation
## Get the Azure Automation Acount Information
$azConn = Get-AutomationConnection -Name 'AzureRunAsConnection'
## Add the automation account context to the session
Add-AzureRMAccount -ServicePrincipal -Tenant $azConn.TenantID -ApplicationId $azConn.ApplicationId -CertificateThumbprint $azConn.CertificateThumbprint
## Get the Azure VMs with tags matching the value '6am'
$azVMs = Get-AzureRMVM | Where-Object {$_.Name -eq 'VM_NAME_HERE'}
## Start VMs