Last active
August 29, 2015 13:56
-
-
Save MCKLMT/9259994 to your computer and use it in GitHub Desktop.
Gists for a blog post about Windows Azure Powershell command-line tool
This file contains 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
# This command retreive the list of all available locations for a website | |
# Get-AzureWebsiteLocation | |
# Instanciate a new Website in the choosen Location | |
$website = New-AzureWebsite -Location "West Europe" -Name "MyNewShinyWebsite" |
This file contains 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
$serverLogin = "MCKLMT" | |
$serverPassword = "" | |
# Create a new server | |
$server = New-AzureSqlDatabaseServer -AdministratorLogin $serverLogin ` | |
-AdministratorLoginPassword $serverPassword ` | |
-Location "North Europe" | |
# Get your public Internet IP Address | |
$externalIP = (New-Object System.Net.WebClient).DownloadString("http://ipinfo.io/ip") | |
# Open the firewall for this specific IP | |
$server | New-AzureSqlDatabaseServerFirewallRule -RuleName "Open Firewall" ` | |
-StartIPAddress $externalIP ` | |
-EndIPAddress $externalIP | |
#Create a new database with Web Edition and 1 GB | |
$server | New-AzureSqlDatabase -DatabaseName "Northwind" -Edition Web -MaxSizeGB 1 |
This file contains 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
Import-Module Azure | |
# Select this subscription as current for the current powershell session | |
Select-AzureSubscription -Current -SubscriptionName "Name of the subscription for this session" | |
# Or Instead | |
# Select this subscription as default for all sessions of this user | |
# Select-AzureSubscription -Default -SubscriptionName "Name of the subscription for this session" |
This file contains 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
# Filter the list by the name of one Cloud Service | |
Get-AzureVM -ServiceName "Name of the Cloud Service" ` | |
| Where-Object {$_.Status -like "Ready*"} ` | |
| ForEach-Object | |
{ | |
# The "Force" switch allows the deallocation of last VM in a deployment. | |
Stop-AzureVM -ServiceName $_.ServiceName -Name $_.Name -Force | |
} |
This file contains 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
Import-Module Azure | |
# Open a popup to login to the account and save subscriptions in one line :) | |
Add-AzureAccount |
This file contains 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
Import-Module Azure | |
# Open a link to download the *.publishsettings | |
Get-AzurePublishSettingsFile | |
# Import the file. Change the path to the file :) | |
Import-AzurePublishSettingsFile -PublishSettingsFile "C:\MySavedPublishSettingsFile.publishsettings" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment