Problem using New-AzureQuickVM

I’ve been trying to create a Virtual Machine in the Azure with the Azure cmdlets.

The error calling New-AzureQuickVM was:

New-AzureQuickVM: CurrentStorageAccount is not set. Use Set-AzureSubscription subname -CurrentStorageAccount storageaccount to set it.

The script which was supposed to create it was:

Import-Module "D:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
Import-AzurePublishSettingsFile –PublishSettingsFile $publishingFileName
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccountName
New-AzureQuickVM -Windows -Location "West Europe" -ServiceName $cloudSvcName -Name $vmName -ImageName "" -Password $adminPassword -InstanceSize ExtraSmall
Start-AzureVM -ServiceName $cloudSvcName -Name $vmName

The point is, that I had multiple subscriptions imported with the same name and there is only ONE default.

Running the Get-AzureSubscription shows us at which subscription the IsDefault:true. And of course I’ve been setting the CurrentCloudStorage always to the wrong subscription.

To overcome the problem I did the following steps:

  1. I’ve opened the publishsettings xml file and renamed my subscription
  2. Imported it again with the
    Import-AzurePublishSettingsFile –PublishSettingsFile $publishingFileName 
  3. Called the
    Set-AzureSubscription -DefaultSubscription subscriptionName
  4. And then I could call the
    Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccountName

About Tamas Nemeth

Husband and proud father of two daughters in Nürnberg. I'm working as a Senior Software Developer and an enthusiastic Clean-Coder. I spend most of my free time with my family (playing, hiking, etc...). I also play table-tennis and badminton sometimes...
This entry was posted in Technical Interest and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s