Created
December 23, 2016 18:10
-
-
Save kapb14/3274a1ed178cc2a2a81822f81d4f7599 to your computer and use it in GitHub Desktop.
Install Azure powershell module and connect
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 characters
| # 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