In this Blog we will walk through few PowerShell commands to work with Windows Azure Storage. (Last Update: 04/12/2013)

  •  List of all Windows Azure Subscriptions – Find Default in case Multiple subscription

Code Snippet:
{
Write-Host "Selection: Show Me List of Windows Azure Subscriptions" -ForegroundColor Magenta
sleep -seconds 1
Get-AzureSubscription | select SubscriptionName, IsDefault
Write-Host "Subscrption with Isdefault Value - True will be used for operation" -ForegroundColor Magenta
}

  •  List of all Windows Azure Storage Account

Code Snippet:
{
Write-Host "Selection: List of Windows Azure Storage Services" -ForegroundColor Magenta
sleep -seconds 1
Get-AzureStorageAccount |select label, Location
}

  •  Create New Windows Azure Storage Account in a Specified Location

Code Snippet:
{
Write-Host "Selection: Create New Windows Azure Storage Account in a Specified Location" -ForegroundColor Magenta
sleep -seconds 1
#New-AzureStorageAccount [-StorageAccountName] <String> [-Description <String>] [-Label <String>] -Location <String> [<CommonParameters>]
[string]$tempStorageAccountName = $(Read-Host -prompt "Please specify new Windows Azure Storage Account Name: ")
[string]$tempDescription = $(Read-Host -prompt "Please specify Description for Windows Azure Storage Account: ")
[string]$tempLabel = $(Read-Host -prompt "Please specify Display Name for Windows Azure Storage Account: ")
Get-AzureLocation | select Name
[string]$tempLocation = $(Read-Host -prompt "Please specify Location for Windows Azure Storage Account (from Above List): ")
New-AzureStorageAccount -StorageAccountName $tempStorageAccountName -Description $tempDescription -Label $tempLabel -Location $tempLocation
Write-Host "Storage account $tempLabel has been created in $tempLocation"
}

 

Rest of storage commands will be here shortly.

------------------

Abhishek Anand

Support Escalation Engineer

Windows Azure Technical Support