First of all you need to have Microsoft Azure PowerShell SDK installed, after this step is done you may type
Add-AzureAccount
and this will authenticate you via web browser in Azure account ( you need to have working Azure account obviously ). Alternatively you may use PublishSettings :
- Open that link to Donwload Azure Publish Settings Profile: https://manage.windowsazure.com/publishsettings , then save you credentials.
- Open Microsoft Azure Powershell and run Import-AzurePublishSettingsFile :
PS C:\> Import-AzurePublishSettingsFile C:\tools\azure\my_settings.publishsettings
Id : c09f1074-6e2e-45be-aeee-935d6642424d
Name : Windows Azure MSDN - Visual Studio Ultimate
Environment : AzureCloud
Account : 24636FAB2C68B96D43777561A3CD728092912C03
Properties : {[SupportedModes, AzureServiceManagement]}
Then you need to keep in mind that Azure PowerShell (from 0.8.0 ) contains many modules, here we will talk about three main modules ( complete list of eveything which is inside SDK is here – see Azure SDK CmdLets reference ):
- AzureProfile : operates with profiles commands like Add-AzureAccount, Get-AzureSubscription, and Switch-AzureMode. Complete list of commands in AzureProfile module is availalbe here – see Azure Profile Cmdlets. Commands from AzureProfile are always available – not like two next modules which are not designed to be used in the same PowerShell session.
- Azure ( or AzureServiceManamagement ): contains commands which operated by core ( or basic :-)) cloud functionality like virtual machines, web sites, storage accounts and so on. Complete list of commands inside this module is here – see Azure Service CmdLets. You can switch to that module using
Switch-AzureMode -Name AzureServiceManagement
- AzureResourceManager : contains commands which operates logical units of Azure. To switch into AzureResourceManager mode you may use command
Switch-AzureMode -Name AzureResourceManager
Below is a list of most important modules inside AzureResourceManager :- Azure Batch: contains commands related to Microsoft Azure Batch services ( Get-AzureBatchAccount, New-AzureBatchTask, Remove-AzureBatchPool and others )
- Azure Data Factory (ADF ): commands managing data factories in Azure – for more information about this service you may refer to What is Azure Data Factory and FAQ and Azure Data Factory (ADF) Documentation
- Azure Compute and Storage: commands managing VMs and storage accounts ( New-AzureVM , Start-AzureVM , Add-AzureVMDataDisk and others ).
- Azure Key Vault : commands which helps safeguard cryptographic keys and secrets used by cloud applications and services you can encrypt keys and secrets ( authentication keys, storage account keys, data encryption keys, .PFX files, and passwords) by using Host Security Modules ( HSM ). For more details please see What is Azure Key Vault
- Azure Networking : commands related to load balancer, NAT, IP-address management and virtual networks ( Set-AzureNetworkInterface , New-AzurePublicIpAddress , Get-AzureLoadBalancerProbeConfig and others ).
- Azure Resource : commands related to resource group templates, Azure tags – using this techniques you may operate groups of different resources by using one template or tag. For more information about Azure Resource groups please refer to Azure Resource Manager Overview
- Azure SQL Database : SQL Azure helpers, contains commands like Get-AzureSqlDatabase , New-AzureSqlDatabase , Set-AzureSqlElasticPool and others.
- DNS : commands to manage your DNS records and resolving ( New-AzureDnsZone , Get-AzureDnsRecordSet , Add-AzureDnsRecordConfig and others ). More detailed information can be found here – Microsoft Azure DNS documentation
- Traffic Manager : cmdlets which allow you to manage TrafficManager, including adding on-premise end-points which is not yet available in web portal – detailed example about how to add on-premise end-points is here – Azure Traffic Manager external endpoints & PowerShell support ( New-AzureTrafficManagerProfile, Get-AzureTrafficManagerProfile and other commands ). Here you may find documentation about Traffic Manager and also I recommend this blog post by Jonathan Tuliani from Azure Product Group : Azure Traffic Manager External Endpoints and Weighted Round Robin via PowerShell
Note: sometimes ( it happened with me as well ) default installation of Azure SDK cmdlets do not include some modules ( in my case it happened with DNS and Azure SQL Database ), then you have choice how to install them – first of all you always may use Azure powershell sources on github to get full and latest one version of cmdlets or you also may check files inside “C:\Program Files (x86)\Microsoft SDKs\Azure” folder and try to import modules from there like this ( it worked for me ):
import-module "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureResourceManager.psd1"