- 1 Vapor IO Brings OpenDCRE to General Availability
- 2 VMware Takes the Wraps Off vRealize Automation and vRealize Business
- 3 Microsoft Previews Hyper-V Containers for Windows Server 2016
- 4 Mirantis Led FUEL Project Gets Installed Under OpenStack Big Tent
- 5 Red Hat Enterprise Linux 7.2 Adds Security, DR Features
Managing Windows Azure Resources Using PowerShell
Microsoft has put a great deal of effort into designing a framework for Windows Server that can be utilized by any Windows role as well as features to implement command-line functionality. Most of the roles/features that you enable on a Windows Server can be managed using Windows PowerShell cmdlets, and Microsoft also provides specific PowerShell cmdlets known as "Azure PowerShell" cmdlets for managing resources on Windows Azure public clouds.
You can use Azure PowerShell to perform a variety of tasks in Windows Azure. These tasks can be performed either manually via a command prompt or automatically through PowerShell scripts. In most cases, you'll use scripting to automate a repeative task that requires minimal administrative overhead. You can create and configure cloud services, virtual machines (VMs), virtual networks and web sites using Azure PowerShell.
Today's tutorial details how to prepare your environment so you can use Azure PowerShell for managing different aspects of Windows Azure.
Before you can manage Windows A zure resources using Azure PowerShell cmdlets, the first thing you need to do is to make sure you have a valid Azure Subscription. If you don't have one, you can always get one through Microsoft at http://azure.microsoft.com/en-us/pricing/free-trial/.
As a high-level process, you will be performing the steps below to make sure your environment is ready:
- Download and Install Azure PowerShell
- Open Windows Azure PowerShell Window and Add Windows Azure Account
- Download and Import an Azure Publish Settings File
- Select Your Azure Subscription
- Manage Windows Azure resources
Let's cover each of these steps in greater detail.
Downloading and Installing Azure PowerShell
Once you have a valid Windows Azure Subscription, download and install Azure PowerShell using one of the two recommended methods: by using Microsoft Web Installer or from GitHub. If you are a system administrator, you would likely want to avoid installing extra bits. However, I will provide you download locations for both the Web Installer and Standalone Version of Azure PowerShell — Web Installer fom http://go.microsoft.com/?linkid=9811175&clcid=0x409 and the Standalone version of Azure PowerShell from GitHub at http://az412849.vo.msecnd.net/downloads03/windowsazure-powershell.0.8.3.msi. Once installed, proceed to the next step.
Opening Windows Azure PowerShell Window and Adding Windows Azure Account
Once you have installed it, you can open Azure PowerShell by searching for the "Azure PowerShell" shortcut in the Start Menu. You must click on the Azure PowerShell shortcut &mdah; if you fail to do so or open a normal Windows PowerShell session, you must make sure that you import the Azure PowerShell module manually.
Your Azure Account is an email address to which multiple Azure Subscriptions are associated. Connect to your Azure Account by executing the "Add-UserAccount" PowerShell cmdlet. You will be prompted to enter your credentials in the Internet Explorer window. After you have successfully authenticated, you will be notified of your authentication status in the same PowerShell window session as shown in the below screenshot:
Downloading and Importing an Azure Publish Settings File
The Azure Publishing Settings File is an XML file that has the information about your Azure Windows live account and the subscriptions associated with it. It also has a management certificate that is used to authenticate Windows Azure Service Management API requests from a management computer.
There are two ways to download this file — by executing the "Get-AzurePublishSettingsFile" PowerShell cmdlet or by downloading the file at https://windows.azure.com/download/publishprofile.aspx. Whichever method you choose to download the Publish Settings File, make sure to copy it to the local drive of the management computer.
Next, run the "Import-AzurePublishSettingsFile" PowerShell cmdlet to import settings from this file using the following command:
Import-AzurePublishSettingsFile <path to file>
Selecting Your Azure Subscription
You can have multiple Azure Subscriptions associated with an Azure account. You need to ensure that you are working with the right Azure Subscription by performing the steps below:
To obtain a list of all Azure Subcriptions associated with the Azure account, run this command:
Get-AzureSubscription | FT SubscriptionName, SubscriptionID -Autosize
Next, select an Azure Subscription you want to manage the resources for by executing this command. Since I have only one Azure Subscription associated with my account, I will run this command:
Select-AzureSubcription -SubscriptionName "Free Trial"
Managing Windows Azure resources
Once you have connected to your Azure account and an Azure subscription of your choice, you can browse through Azure PowerShell Cmdlets to see all the PowerShell cmdlets that are available to manage Windows Azure resources.
For example, if you need to see all the locations of Windows Azure, you can run the "Get-AzureLocation" cmdlet. Similarly, run "Get-AzureVM" to list all virtual machines hosted on Windows Azure as shown in the below screenshot:
To see the available Azure PowerShell cmdlets for managing virtual machines on Windows Azure, run the "Get-Help AzureVM" cmdlet in the Windows Azure PowerShell Window session as shown in the below screenshot:
There are more than 280 PowerShell cmdlets available in the latest release of PowerShell for Windows Azure. PowerShell cmdlets for Windows Azure provide power and flexibility, and enable you to perform much more advanced administration for your Windows Azure-hosted resources, including virtual machines.
Nirmal Sharma is a MCSEx3, MCITP and Microsoft MVP in Directory Services. He has specialized in Microsoft Technologies since 1994 and has followed the progression of Microsoft Operating System and software. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites and contributing to Solution IDs for www.Dynamic-SpotAction.com. Nirmal can be reached at email@example.com.
Read more on "Cloud Computing" »