In order to work in PowerShell with Azure you need to have the modules setup properly, the script below will help get you ready to go then test it.
# Azure PowerShell Get-Module PowerShellGet -list | Select-Object Name,Version,Path # Install the Azure Resource Manager modules from the PowerShell Gallery Install-Module AzureRM -AllowClobber -Force # Install the Azure Service Management module from the PowerShell Gallery Install-Module Azure -AllowClobber -Force
$PSVersionTable $env:PSModulePath # Install the Azure Resource Manager modules from the PowerShell Gallery Install-Module AzureRM # Install the Azure Service Management module from the PowerShell Gallery Install-Module Azure # Import AzureRM modules for the given version manifest in the AzureRM module Import-Module AzureRM # Import Azure Service Management module Import-Module Azure # To make sure the Azure PowerShell module is available after you install Get-Module –ListAvailable # 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 # Add Add-AzureAccount # Show configured Subscriptions Get-AzureSubscription | FT -AutoSize SubscriptionName, SubscriptionID (Get-AzureService).ServiceName get-azurereservedip | Select ReservedIPName, Address, ServiceName
Originally Posted on March 30, 2016
Last Updated on October 16, 2017
Last Updated on October 16, 2017
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.