November 20th, 2014

PowerTip: Set Default Storage Account for PowerShell Cmdlets in Azure

Doctor Scripto
Scripter

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 


Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.