First, you should have the latest Azure PowerShell installed and running. For detailed information, see How to install and configure Azure PowerShell.
Note
Many new features of SQL Database are only supported when you are using the Azure Resource Manager deployment model, so examples use the Azure SQL Database PowerShell cmdlets for Resource Manager. The service management (classic) deployment model Azure SQL Database Service Management cmdlets are supported for backward compatibility, but we recommend you use the 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'