Create Azure Storage Account

Step 2 in a series documenting how to copy an entire virtual network to a secondary environment using powershell

Create Azure Storage Account

This scrip allows you to create a new storage account or use an existing one based on the new environment name


#Get Affinity Group

$AffinityGroup = "<Affinity Group Name>"

#Set new Parameters 

$EnvironmentSAPrefix = "<Variable Data>"

$SAName = "$EnvironmentSAPrefix$DestinationEnvironmentName"


#Find Account

Write-Output ("Finding Storage account " + $SAName)

$storageAccount = $null



$storageAccount  = Get-AzureStorageAccount -StorageAccountName $SAName



if($storageAccount -eq $null)


    Write-Output ("Creating storage account " + $SAName)

   $storageAccount=  New-AzureStorageAccount -StorageAccountName $SAName -AffinityGroup $AffinityGroup


Write-Output ("Working with storage account " + $SAName)


Last Updated: 1/27/2015 3:57:00 AM