Skip to content

Instantly share code, notes, and snippets.

@kapb14
Created December 23, 2016 18:10
Show Gist options
  • Select an option

  • Save kapb14/3274a1ed178cc2a2a81822f81d4f7599 to your computer and use it in GitHub Desktop.

Select an option

Save kapb14/3274a1ed178cc2a2a81822f81d4f7599 to your computer and use it in GitHub Desktop.
Install Azure powershell module and connect
# check WindowsAzurePowerShell is present
if (-not(Get-Module Azure)){
# find chocolatey executable
$CHOCO = $env:PATH.Split(';') | % {Get-ChildItem -Path $_ -Filter chocolatey.exe}
# install WindowsAzurePowerShell
if ($CHOCO.Exists){Start-Process -FilePath $CHOCO.FullName -ArgumentList "install -y WindowsAzurePowerShell" -Wait}
} else {Write-Warning -Verbose "WindowsAzurePowerShell Exists."}
# connect to Azure
Add-AzureAccount
# lookup all VMs
Get-AzureVM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment