First you need to have the latest Azure PowerShell installed and running. For detailed information, see How to install and configure Azure PowerShell.
Note
The examples in this topic use Azure Resource Manager deployment model, so examples use the Azure Resource Manager cmdlets.
Run the Add-AzureRmAccount cmdlet and you will be presented with a sign in screen to enter your credentials. Use the same credentials that you use to sign in to the Azure portal.
Add-AzureRmAccount
If you have multiple subscriptions use the Set-AzureRmContext cmdlet to select which subscription your PowerShell session should use. To see what subscription the current PowerShell session is using, run Get-AzureRmContext. To see all your subscriptions, run Get-AzureRmSubscription.
Set-AzureRmContext -SubscriptionId '4cac86b0-1e56-bbbb-aaaa-000000000000'