Last active
October 18, 2019 18:38
-
-
Save tiny-dancer/2d2bcbd103220dee2a09c0d213195682 to your computer and use it in GitHub Desktop.
Revisions
-
tiny-dancer revised this gist
Oct 18, 2019 . 1 changed file with 1 addition and 33 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,39 +1,7 @@ <# #> workflow lp-cl { } -
tiny-dancer created this gist
Oct 18, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ <# .DESCRIPTION An example runbook which prints out the first 10 Azure VMs in your subscription (ordered alphabetically). For more information about how this runbook authenticates to your Azure subscription, see our documentation here: http://aka.ms/fxu3mn .NOTES AUTHOR: Azure Automation Team LASTEDIT: Mar 27, 2015 #> workflow Get-AzureVMTutorial { #The name of the Automation Credential Asset this runbook will use to authenticate to Azure. $CredentialAssetName = 'DefaultAzureCredential' #Get the credential with the above name from the Automation Asset store $Cred = Get-AutomationPSCredential -Name $CredentialAssetName if(!$Cred) { Throw "Could not find an Automation Credential Asset named '${CredentialAssetName}'. Make sure you have created one in this Automation Account." } #Connect to your Azure Account $Account = Add-AzureAccount -Credential $Cred if(!$Account) { Throw "Could not authenticate to Azure using the credential asset '${CredentialAssetName}'. Make sure the user name and password are correct." } #TODO (optional): pick the right subscription to use. Without this line, the default subscription for your Azure Account will be used. #Select-AzureSubscription -SubscriptionName "TODO: your Azure subscription name here" #Get all the VMs you have in your Azure subscription $VMs = Get-AzureVM #Print out up to 10 of those VMs if(!$VMs) { Write-Output "No VMs were found in your subscription." } else { Write-Output $VMs[0..9] } }