Every Windows server role and feature ships with necessary PowerShell modules. PowerShell lets you automate manual...
and repeated tasks and serves as a solid scripting platform for administrators, architects and developers to manage Microsoft Azure resources. Nearly everything you can do manually in the Azure management portal can be done using Azure PowerShell in the Microsoft Azure Automation service.
The current version of Microsoft Azure PowerShell, 0.8.3, can be obtained from Microsoft's site. There have been a lot of improvements in the recent version of Azure PowerShell, including the way Azure resources are accessed remotely and interactively. The Azure PowerShell provides approximately 340 PowerShell cmdlets for automating Microsoft Azure resources, including spinning up virtual machines (VMs), setting up virtual networks, backing up and restoring VMs and managing Azure storage and cloud services in Azure.
Microsoft Azure PowerShell includes three important modules: the Azure module, the AzureResourceManager module and the AzureProfile Module. These modules provide the necessary PowerShell cmdlets for working with Microsoft Azure resources directly from the local machine.
Azure service management cmdlets: These cmdlets assist in managing Azure subscriptions and individual resources such as VMs, Azure blobs, tables, queues, storage accounts, Azure websites, databases, service bus and media services.
Azure Resource Manager cmdlets: These cmdlets can be used for creating, managing and deploying Azure resources for a resource group. These cmdlets let you use Azure Resource Manager through PowerShell instead of creating individual Azure resources for a cloud service. With Resource Manager, admins create templates and deploy them as a unit in Microsoft Azure.
AzureProfile cmdlets: These cmdlets are part of AzureProfile module, which can manage your Azure account and subscriptions associated with the Azure account.
Azure Automation cmdlets: These cmdlets help you create runbooks, jobs and assets that can be used with the Microsoft Azure Automation service.
There are other cmdlets available to manage other aspects of Microsoft Azure. For example, you can use Azure ExpressRoute cmdlets to configure express route settings; Azure managed cache cmdlets can manage Azure cache.
PowerShell closely integrates with Microsoft Azure Automation service
The PowerShell platform is closely integrated with the Microsoft Azure Automation service, which provides greater flexibility to manage and automate Azure resources. The Azure Automation service not only allows you to automate manual and long-running tasks but also lets you run repeated tasks with a single click.
With Microsoft Azure Automation service, you can deploy, create and monitor Azure resources using runbooks, which are composed of PowerShell workflows. You can use any common PowerShell cmdlet including Azure PowerShell cmdlets as part of the runbook.
There are number of runbook samples available to get you started with Microsoft Azure Automation -- from basic to advanced automation. All you need to do is to create an Automation account in Microsoft Azure and publish the PowerShell scripts as runbooks in Azure. Once you have created Microsoft Azure Automation account, you can manage and execute runbooks either using Azure Automation cmdlets or Microsoft Azure portal. Sample runbooks can be found on Microsoft's site.
Remotely manage Azure VM OS resources with PowerShell
If you need to configure roles/features or modify operating system settings in an Azure VM, you are required to use remote desktop protocol to access a VM and then configure the settings. For example, you can manage VMs within Azure OS settings or install/remove roles/features. Doing this manually for more than one Azure VM can take a considerable amount of time. Microsoft provides a more powerful automation experience by letting admins manage VMs within Azure's OS resources directly from your local machine. By default, when you create an Azure VM, a PowerShell endpoint on TCP Port 5986 is added to that particular VM, enabling you to connect to the VM’s OS resources over the public Internet.
Calling Microsoft Azure REST API from within PowerShell
The REST API provides programmatic access to Azure resources. All cmdlets are dedicated to a specific job. If you do not have a PowerShell cmdlet to manage a particular aspect of Azure, the Azure PowerShell platform allows you to access Microsoft Azure REST API from within the PowerShell session.
Because PowerShell serves as a solid scripting platform to manage Microsoft Azure resources, Microsoft has a script repository for all Azure PowerShell scripts developed in-house and by third parties. There are about 105 PowerShell scripts available to help manage Azure resources at the Script Center page.
Dig Deeper on Microsoft Windows Azure and cloud computing
Nirmal Sharma asks:
Do you use Microsoft Azure PowerShell?
0 ResponsesJoin the Discussion