Virtual machines (VMs), storage, network or others – are you also hyperscaling your resources using cloud solution providers? In the article, we show how ScriptRunner can help you keep an eye on costs at all times. The article is aimed at IT staff who support Azure, and may be of interest to both technical and business administration staff.
For simple scaling of your own IT resources, you can easily purchase resources from hyperscalers, providers such as Microsoft Azure, Google GCP, Amazon AWS or IBM. Thanks to the pay-as-you-grow principle, you pay for what you use. There are various ways to keep an eye on expenses and, if necessary, build in limits so that a certain monthly budget is not exceeded. In the following article, we will explain in a nutshell how this can be easily implemented in Microsoft Azure with ScriptRunner and how there will be no rude awakening when it comes to the monthly statement.
Costs at a Glance
In the Azure portal, various settings can be made in the Cost Management area. This is where you define the budget:
Here, you link your budget to certain actions that you chose. For example, you can set up a hard limit or an e-mail notification at certain thresholds.
There are two different types of budget alerts:
- Forecast Cost: This type is a forecast that shows how costs will develop if the consumption remains as it currently is.
- Actual Cost: This type indicates the actual consumption and thus represents the current accumulated value.
Based on the two types, different rules can be defined. In order to be warned as early as possible in case of exploding costs, the forecast should be used. If the costs should be stopped hard at a certain value, the actual value is used.
Under Cost Analysis, the costs can be viewed in more detail. They are broken down by service name (e.g. virtual machines, security center, storage, virtual network), locally or by resource group name. Left and in full color is the actual cost, the costs that have already been accrued. The forecast is in the lighter shade on the right:
At this point, we can see how costs are evolving and which items – storage, computing or networks – are driving the costs.
Customized Reports with ScriptRunner
ScriptRunner allows you to monitor costs more granularly and generate appropriate reports on demand or when specific events occur.
Before you get started running Azure scripts, make sure the ScriptRunner server is properly set up to perform actions in Azure. The appropriate Azure modules must be present on the server. Our Trial Guide describes how to perform the integration. ("Registering ScriptRunner with Azure AD")
We have prepared several scripts in our GitHub ActionPacks so that you can start with a few clicks, you may use this one for example: Get-AzConsumptionUsageDetails.ps1.
This action allows ScriptRunner to create a detailed report that breaks down the costs to the individual resource, providing more accurate information about usage. Thus, the billing period, other information and the various settings can be retrieved in the parameters.
Depending on the number of resources, we recommend expanding the size of the report in the PowerShell options.
The report can also be created automatically at specific points in time. If you have an e-mail server on your ScriptRunner server, you can also send the report.
ScriptRunner helps to keep the overview by customizing alarms and reports according to the company's requirements. Our ActionPacks contain more than 1,500 predefined scripts, which can be used one-to-one or extended and modified.
Would you like to simplify and speed up the management of your Azure services? PowerShell offers a lot of possibilities to achieve that.
In this webinar, we will show you how you can use the Azure Az PowerShell module and ScriptRunner to easily and securely automate and delegate many recurring tasks (e.g., managing virtual machines and Resource Groups).
The webinar is aimed at all administrators, solution architects and IT team leaders.
Learn how to Simplify Your Azure Administration:
- Use cases for the current Azure Az Modul and the Azure CloudShell
- Azure VM and resource group administration with PowerShell
- Safe and easy delegation of Azure management tasks
- Central administration of Powershell scripts, modules and credentials