To start using Windows Azure PowerShell, you need to run just a couple of commands.
First import the windows azure powershell module:
Retrieve all your subscriptions (certificate method, you should prefer to use the Azure AD method instead, see below):
A browser window opens at https://windows.azure.com/download/publishprofile.aspx, where you can sign in to Windows Azure and download the publish settings file.
Then import the subscription publish settings file:
You should delete the publishing profile that you downloaded after you import those settings. The downloaded profile contains a management certificate that should not be accessed by unauthorized users.
There’s a new way to login azure on powershell, without using the certificate method:
Use the Azure AD method (newest and preferred way)
- Open the Azure PowerShell console, as instructed in How to: Install Azure PowerShell.
- Type the following command:
- In the window, type the email address and password associated with your account.
- Azure authenticates and saves the credential information, and then closes the window.
Now you can make a lot of operations against the azure fabric (a lot more than you can do from the web portal), like getting the list of containers and the the list of the blobs of a container.
First you select the subscription you want to use:
Select-AzureSubscription -SubscriptionName "My Subscription Name"
Then you set the storage account you want to query on:
Set-AzureSubscription -SubscriptionName "My Subscription Name" -CurrentStorageAccount "mystorageaccount"
(to get the storage account name, you can run Get-AzureStorageAccount)
And now you can get the list of the containers:
and the list of the blobs of a specified container:
Get-AzureStorageBlob -Container "containername"