Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Azure Powershell Cheatsheet
# To log in to Azure Resource Manager
# You can also use a specific Tenant if you would like a faster log in experience
# Login-AzureRmAccount -TenantId xxxx
# To view all subscriptions for your account
# To select a default subscription for your current session.
# This is useful when you have multiple subscriptions.
Get-AzureRmSubscription -SubscriptionName "your sub" | Select-AzureRmSubscription
# View your current Azure PowerShell session context
# This session state is only applicable to the current session and will not affect other sessions
# To select the default storage context for your current session
Set-AzureRmCurrentStorageAccount -ResourceGroupName "your resource group" -StorageAccountName "your storage account name"
# View your current Azure PowerShell session context
# Note: the CurrentStorageAccount is now set in your session context
# To list all of the blobs in all of your containers in all of your accounts
Get-AzureRmStorageAccount | Get-AzureStorageContainer | Get-AzureStorageBlob
# Install the Azure Resource Manager modules from the PowerShell Gallery
Install-Module AzureRM -Scope CurrentUser
# Install the Azure Service Management module from the PowerShell Gallery
Install-Module Azure -Scope CurrentUser
# To make sure the Azure PowerShell module is available after you install
Get-Module -ListAvailable Azure*
# Enable access from Remote
Set-ExecutionPolicy RemoteSigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.