Azure Cmdlet to Add/Change Subscription

Prior to running the Azure cmdlets, you need to set your PS env to use te correct Azure subscription. Follow the steps below to add or change the Azure subscription.

# You will need the publish settings file
Import-AzurePublishSettingsFile “C:\MyPublishSettings\mysubscriptions.publishsettings”

# Enumerates all configured subscriptions on your local machine.
Get-AzureSubscription

# Returns details only on the specified subscription
Get-AzureSubscription -SubscriptionName “mysubscription”

# Select the subscription to use
Select-AzureSubscription -SubscriptionName “mysubscription”

# Sets the mysub subscription to be the default if one is not selected.
Set-AzureSubscription -SubscriptionName “mysubscription”

# You can set a default storage account
# Lists the storage accounts
Get-AzureStorageAccount

# Set storage account, you will have to select the storage account that exists
Set-AzureSubscription -SubscriptionName “mysubscription” -CurrentStorageAccount “storage-account”

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s