We assume that you have already set up your PowerShell for Windows Azure based on our previous Blog Post: Windows Azure PowerShell – Getting Started. In this blog we will be providing a Menu Based PowerShell Script to perform basic Cloud operation on Windows Azure.
Before we dive into the details, stack of possible operation that can be performed on Platform as a Service (PaaS) and Infrastructure as a Service (Iaas) differs based on type of execution Model.
Windows Azure provides Infrastructure as a Service (IaaS), web hosting, and Platform as a Service (PaaS).
Each of these three approaches-Virtual Machines, Web Sites, and Cloud Services-can be used separately. You can also combine them to create an application that uses two or more of these options together.
We have two purpose behind this script as:
Currently Windows Azure PowerShell Provide approximately 137.
This script also provide to use verbose output which allow user to see all Rest API call made to the service.
In February Release of Windows Azure PowerShell, Addition of Debugging Preference option allowing user to see request and response that take place with the execution of any Command.
To enable debugging user need to specify $DebugPreference value.
Stop: Displays the debug message and stops executing. Writes an error to the console.
Inquire: Displays the debug message and asks you whether you want to continue.
Continue: Displays the debug message and continues with execution.
SilentlyContinue (Default): No effect. The debug message is not displayed and execution continues without interruption.
PS C:\> $Debugpreference
PS C:\> Get-AzureVM
ServiceName Name Status
----------- ---- ------
test test StoppedVM
PS C:\> $DebugPreference ='Continue'
DEBUG: ============================ HTTP REQUEST ============================
DEBUG: ============================ HTTP RESPONSE ============================
PS C:\ $debugpreference = "Inquire"
PS C:\ write-debug "Hello, World"
DEBUG: Hello, World
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): A
PS C:\ Get-AzureVm -Debug:$false
# Use the Debug parameter with $false
PS> # The debug message is not displayed and processing continues.
(Download Script - PowershellMenuPub.ps1 - At the bottom of the blog) – Last updated 02/17/2013 (You might need to do minor edits based on your subscription)
Many thanks to Avkash Chauhan for review and valuable inputs.
Keywords: Windows Azure PowerShell, Iaas, PaaS, Operation
Please let us know what you would like to see in future and how we can improve it.
Support Escalation Engineer
Windows Azure Technical Support