PowerTip: Set Default Storage Account for PowerShell Cmdlets in Azure

Doctor Scripto

Summary: Learn how to define the default storage account to be used with the Azure PowerShell cmdlets.

Hey, Scripting Guy! Question How do I tell Azure which media or storage account I'd like to use when I create a virtual machine?

Hey, Scripting Guy! Answer Use Get-AzureStorageAccount to access the names of your storage accounts, and
           then use Set-AzureSubscription to define your current default for the cmdlets.

The following example sets the first account as the default in the subscription called 'HSG Azure Subscription':

$StorageAccount=(Get-AzureStorageAccount)[0].label

Set-AzureSubscription –SubscriptionName 'HSG Azure Subscription'
–CurrentStorageAccountName $StorageAccount 


0 comments

Discussion is closed.

Feedback usabilla icon