Last active
March 22, 2021 15:04
-
-
Save rizky/09dd04f967a32118dc2be1a427770856 to your computer and use it in GitHub Desktop.
Azure Powershell Cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To log in to Azure Resource Manager | |
Login-AzureRmAccount | |
# 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 | |
Get-AzureRmSubscription | |
# 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 | |
Get-AzureRmContext | |
# 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 | |
Get-AzureRmContext | |
# 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