Automatically pause/resume and scale up/down Azure Analysis Services using AzureRM.AnalysisServices

One of the big advantages of Azure Analysis Services is the ability to pause/resume and scale up/down as needed, this will allow you to pay only for what you use and greatly reduce costs.

Azure Analysis Services team released a PowerShell module “AzureRM.AnalysisServices” with cmdlets to manage your Azure Analysis Services resources and they could be more easy to use:

  • Get-AzureRmAnalysisServicesServer – To get your server metadata and current status
  • Suspend-AzureRmAnalysisServicesServer – To suspend a server
  • Resume-AzureRmAnalysisServicesServer – To Resume a server
  • Set-AzureRmAnalysisServicesServer – To update a server, ex: change the SKU

More details here.

But this is only effective if we somehow automate this operation, it’s not feasible if someone on the team or customer is actively pausing/resuming or scaling up/down the instance

With that in mind we build a very simple PowerShell script where you configure in which time and days the Azure AS should be on and on which SKU.

Download the full script here.

The script is configured by a JSON metadata:


The above metadata will configure Azure AS to:





8 AM to 18 PM (peak hours)



18 PM to 00 AM (off peak)



8 AM to 00 AM





The powershell script has the following parameters:


The name of the Azure Resource Group your Azure AS server is deployed:



The name of the Azure AS Server:



The JSON metadata config string



The path to an Azure profile stored locally using the “Save-AzureRmContext” cmdlet.

This is useful to test the script locally.



The name of Azure Connection if you want to run this script in a Azure Automation RunBook:


Probably most of you will want to run this script on an PowerShell Runbook in Azure Automation, learn how to setup the Azure Automation here.

Next you will need to register the module “AzureRM.AnalysServices” as an Asset of your automation account:


After that just create a new PowerShell runbook:


Paste the script and remember to set the parameter -azureRunAsConnectionName:


Publish the script and create a schedule:



That’s it! You know have your Azure AS automatically pausing/resuming and scalling up/down using a configuration file you defined.

Now just lay back and measure the savings at the end of the month!


8 thoughts on “Automatically pause/resume and scale up/down Azure Analysis Services using AzureRM.AnalysisServices

      • JosVermeire says:

        Hi Rui,
        Thank you for the swift reply. I checked the documentation for getting the parameters for the Basic & development tier the ” The supported values are ‘S0’, ‘S1’, ‘S2’, ‘S4’ for the Standard tier; ‘B1’, ‘B2’ for the Basic tier and ‘D1’ for Development tier.” However when adjusting the sku parameter in the script I receive following error (same for B1 and D1).

        Logging in to Azure…
        Current Azure AS status: Succeeded
        Is in active hours
        Updating AAS server from S0 to B2
        Performing the operation “Update Analysis Services Server” on target “aasbmap”.
        Set-AzureRmAnalysisServicesServer : The new size is not available

        Don’t quite understand what goes wrong here…


  1. JosVermeire says:

    Ok, found it. Apparantly not an option to scale down service tiers:

    “Customers can change performance levels within a tier. For example, customers can move from an S2 to S4 seamlessly or vice-versa. Customers can also move from a lower tier to a higher tier but NOT vice-versa. For example, you can move from Basic to Standard tier or Developer to Basic tier, but you can’t move from a Standard to Basic tier or Basic to Developer tier.”


  2. Naveen says:

    Above code is working perfectly when I execute it through runbook. But while executing created runbook (with above code) in Logicapp, I am getting error: Invalid JSON primitive: 1,2,3,4,5]”……
    kindly help


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s