Microsoft Azure PowerShell API Commands
Authenticate.
Add-AzureAccount
Websites
List all websites.
Switch-AzureMode AzureServiceManagement Get-AzureWebsite
Create new website.
New-AzureWebsite –Name the-website-name
Create new website, with specified server farm (aka web hosting plan)
Coming soon.
List all websites, sort by compute mode then name, view as table. Use this to determine what sites are running in different compute modes (e.g. Free, Dedicated)
Get-AzureWebsite | Sort-Object { $.ComputeMode, $.Name } | format-table -Property Name, HostNames, ComputeMode –autosize
Set WebSite’s AppSettings (e.g. deployment project)
$settings = New-Object Hashtable;
$settings[“Project”] = “TheProjectName.csproj”;
Set-AzureWebsite the-website-name –AppSettings $settings
View Website’s AppSettings
(Get-AzureWebsite the-website-name).AppSettings
Delete a website, without confirmation.
Remove-AzureWebsite –Name some-name –Force
Resources
List all resources.
Switch-AzureMode AzureResourceManager Get-AzureResource
List all resources, websites only, view as table.
Get-AzureResource | Where-Object { $_.ResourceType -eq 'Microsoft.Web/Sites' } | format-table
List all resource properties.
Get-AzureResource | Get-Member
Get Azure PowerShell API Version
$DebugPreference='Continue' Get-AzureResourceGroup $DebugPreference='SilentlyContinue'
Change the Website Hosting Plan (aka Server Farm) of a Website
Set-AzureResource -Name the-website-name -ResourceGroupName 'Default-Web-WestUS' -ResourceType 'Microsoft.Web/sites' -ApiVersion '2014-04-01-preview' -PropertyObject @{ 'ServerFarm' = 'Default1' }