Managing Your Azure AS Environment with PowerShell – Getting Started
One of the major value propositions of Azure AS (and this is true for many cloud technologies) is flexibility – spinning up more resources when demand spikes and turn things off when they aren’t – so that you’re only paying for what you need.
Consider your own Analysis Services environment. If it’s anything like the ones I’m used to seeing, demand spikes on a regular basis – e.g. beginning of the week or end of the period – and the rest of the time, demand is pretty flat or nonexistent (e.g. after hours). The hard pill to swallow (in most cases) is this: when purchasing server hardware, you have to buy enough resources (i.e. CPU, memory, etc) to handle the spikes – which can be insanely expensive. The very nature of this resource usage pattern will often lead to heated debates between the Analysis Services architect and the IT infrastructure team (especially true for virtual environments).
So, now that Azure AS is here, it’s time to start taking advantage of this new flexibility. Here’s a short list of some of the things we’ll want to be able to do programmatically:
- Pause/Resume an Azure AS instance
- Add/Remove an Azure AS instance
- Resize an existing Azure AS instance
- Measure Load (to detect “when” to scale)
The good news is that most of these items are already possible (or at least on the radar – please vote!) using the PowerShell!
However, before we can start testing this out, we need to get our PowerShell environment setup.
Note: If you’ve already been managing Azure resources via PowerShell, then you can probably skip most of the first section (Installing Azure PowerShell). On the other hand, if this is your first foray into programmatically managing Azure Resources, you’ll probably want a bit more highlevel introduction… in which case, start here before proceeding with the rest of this post.
Installing Azure PowerShell
The preferred way to install Azure PowerShell is to use PowerShell Gallery. You need the PowerShellGet module to use the PowerShell Gallery. This is available here: PowerShellGallery.com.
There are several options for installation, and I chose the MSI-based installer (for PowerShell 3 and 4):
With that out of the way, we’re ready to install the Azure Resource Manager and Azure Service Management modules:
# 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 Install-Module Azure -Force # removes previous version first
Warning: PowerShellGet requires NuGet provider version ‘220.127.116.11’ or newer to interact with NuGet-based repositories.
Once that’s out of the way, the AzureRM package continues to install a bunch of packages:
Next up is the Azure Service Management module… however, as I’d already installed the 3.0 version, I needed to add the –Force parameter to get the 3.1.0:
Just to be sure, we can confirm our new modules have been installed:
# Confirm Azure modules are available Find-Module Azure,AzureRM
Note: for whatever reason, you may need to reboot your computer before the new commands will be available in the PowerShell ISE.
Finally, because this is such new tech, we need to manually install the AzureRM.AnalysisServices module – instructions here.
#Inspect Module before installing Save-Module -Name AzureRM.AnalysisServices -Path "C:\temp\" #Install Module Install-Module -Name AzureRM.AnalysisServices
This gives us several new cmdlets to help manage our Azure AS environment:
# Confirm Module/Commands Get-Module -ListAvailable Azure.AnalysisServices Get-Command -Module AzureRM.AnalysisServices
In the next post I’ll demonstrate how we can start using these new PowerShell cmdlets to manage our Azure AS environment in a way that allows us to flex up and down as needed to meet demand while minimizing cost. Stay tuned!