imageWelcome to my personal favorite part of the series, part 28!  Really the series would have been incomplete without a part of the series focused on PowerShell!  As many of you may know PowerShell is one the great tools we can use as administrators for automation of repetitive tasks.  IT Administrators have been saving time for years with PowerShell and on premise servers.  Well you can continue to leverage your PowerShell skills as there is support for the worlds greatest shell in Office 365 and Windows Azure.  In today’s post we will take a look at both ways to leverage the PowerShell in both technologies.

Windows Azure and PowerShell

The cmdlets are based on the the Windows Azure Management and Diagnostics APIs and the full source code is available through this CodePlex project so you can better understand the underlying APIs. Finally, the documentation included with the download package also shows how to use the cmdlets to perform a new Windows Azure deployment and retrieve information about a hosted service. You can download the cmdlets here: Windows Azure Platform PowerShell Cmdlets    The Windows Azure Platform PowerShell Cmdlets enable you to browse, configure, and manage Windows Azure Compute and Storage services directly from PowerShell. These tools can be helpful when developing and testing applications that use Windows Azure Services. For instance, using these tools you can easily script the deployment and upgrade of Windows Azure applications, change the configuration for a role, and set and manage your diagnostic configuration. There is also some great documentation for the cmdlets here: To Learn more about the Azure cmdlets   You can view a full list of the PowerShell Cmdlets here.   Cerebrata also makes a 3rd part toolset for Windows Azure, you can learn more here: http://www.cerebrata.com/Products/AzureManagementCmdlets/ 

Office 365 and PowerShell

With Office 365 you can leverage PowerShell for Exchange Online as well as a couple of ways to work with the Office 365 service.  Before you can begin to work with Office 365 in a PowerShell session you need to download the Microsoft Online Services Module for Windows PowerShell.    This module for installs a set of Office 365 cmdlets that you can use to accomplish many administrative tasks, such as user management, domain management, and configuration of some of the service-level settings discussed on this page.   You can learn more about the Microsoft Online Services Module for Windows PowerShell here: Use Windows PowerShell to manage Office 365 .  After you have installed the PowerShell module you can import the module with the following PowerShell command or load the Microsoft Online Services Module for Windows PowerShell shortcut :

Import-Module MSonline

You can use these PowerShell cmdlets to change users passwords,  add users, set user properties…etc.  To see all the cmdlets for the module you can run the following:

Get-Command -module MSonline

imageOne of the fantastic capabilities for is the ability is to manage Exchange Online with PowerShell.   This is actually pretty easy to do after you have loaded the MSOnline module.  The following PowerShell commands will allow you to manage your Exchange online environment:

#Get your Credentials (you will use your administrator account for your Office 365 account (i.e. admin@domain.onmicrosoft.com)
$LiveCred = Get-Credential

#Create a new Remote Powershell Session to Office 365 (the credential you stored in $LiveCred is used here to take you the specific Exchange online environment)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection

#Start the the Exchange Online session
Import-PSSession $Session

#Find the commands (when you start the session you will get a script with a tmp and long identifier)
Get-Module
Get-command -module #name of the tmp*

If you want to learn more about PowerShell here are two great resources for you:

As I mentioned in part 1 we are going to be posting the series across 4 blogs: Brian Lewis, John Weston, Kevin Remde and myself. Let us know what you think of the posts and if you think of topic let us know!

If you happen to miss a part and want to get caught up. You can find all the parts of the series here: The Cloud on Your Terms: 30 Days about the Cloud