In a recent blog post, the author Stefano Demiliani shared his insights into checking the cost details of Azure Subscriptions through the Command Line Interface (CLI). This post provides an inside look into a handy tool that Stefano utilizes to monitor his various Azure subscriptions' costs.
In the Azure Portal, there is a well-equipped Cost Analysis tool that users can use to review their subscription costs. This tool allows users to evaluate cost use by applying filters over designated time periods and identifying maximum costs incurred by a resource group (or) specific resource during any customizable date range.
The default tools in Azure Portal also let users generate Management Groups. These groups assist users in managing access, policy, and compliance across many subscriptions, and cost checking for subscription groups is also possible.
The primary tool discussed in this blog post is the command-line tool known as Azure Cost CLI. This solution is not an official Microsoft product. However, Stefano prefers using this tool due to its several benefits, displayed in different formats, and easily triggered on-demand via Azure CLI.
The Azure Cost CLI utility is simple to install on your Azure CLI, revealing cost detail information. By running a specific command, users can fetch the details of their Azure subscription's accumulated costs for a custom period, starting from the first of the previous month until the present date, with detailed information by resource group.
Clarifying and monitoring cost details by resource is also possible. However, due to the output's verbose nature, using the CLI for this purpose may not be the most convenient. Instead, Stefano suggests redirecting this resource cost detail into a file for a detailed investigation on a local machine.
Furthermore, you can utilize the output of the Azure Cost CLI in a GitHub workflow to obtain your subscription's cost and store the findings in markdown as a Job Summary. All these features make the Azure Cost CLI a valuable tool for quick Azure cost monitoring.
The Azure Cost CLI is an independent tool that users, especially developers, can find useful to gain an instant overview of their Azure subscription costs. Not being a Microsoft official tool, it allows for quick installation on Azure CLI and offers outputs in various formats like JSON, Text, and Markdown. Users who need to have a detailed investigation into their Azure subcription costs could leverage Azure Cost CLI's capabilities to store and critique cost details and resource usage. This tool essentially supports developers in more effective usage and cost management of their Azure resources and subscriptions in customizable date ranges.
Read the full article Instant details of your Azure Subscription costs via CLI
When you work with Azure, understanding subscription costs is crucial, and the Azure Command Line Interface (CLI) provides a powerful tool to help manage these expenses. In this discussion, we unpack a helpful tool used to understand Azure subscription costs via CLI, the way it works, its advantages, and steps to implement it.
The Azure Portal offers an excellent tool for analyzing subscription costs through its Cost Analysis resources. This built-in resource allows users to apply filters, understand cost usage for a specified time, and calculate maximum costs incurred by specific resources or groups. Another feature is the ability to create Management Groups, which grant better control over access and cost management across multiple subscriptions.
However, there's an unofficial tool that can offer certain advantages in managing Azure costs - the Azure Cost CLI. This command-line tool can be deployed precisely when needed, and it provides output in flexible formats, including JSON, Text, and Markdown. Furthermore, it can be integrated into a Github action, making it an even more valuable tool for cost management.
Installing the Azure Cost CLI is simple with Azure CLI and the command 'dotnet tool install --global azure-cost-cli.' With this tool installed, you can retrieve costs using various commands. For instance, the command 'azure-cost accumulatedCost -t Custom --others-cutoff 15 -s YOURSUBSCRIPTIONID' gives you your Azure Subscription's accumulated costs for a given period, providing details by resource group for 15 resources, and groups the rest under a 'Others' category.
One useful feature of this tool is its ability to provide cost details per resource which, although can result in verbose outputs on the CLI, can be very insightful. The output for this can be contained in a local text file with the command 'azure-cost costByResource -o text --timeframe Custom > CostByResource.txt'.
This tool's functionality can also be extended by linking it to a Github workflow. It can retrieve the cost of your subscription and store the results in markdown as a Job Summary. Hence, this tool is extremely useful for quick, on-demand Azure cost monitoring and is worth a try if you frequently work with Azure subscriptions and are keen on efficient cost management.
In terms of expanding your knowledge on this subject, consider participating in Azure training courses. Microsoft offers several courses such as “Managing Azure Subscriptions & Resources,” "Azure CLI basics" and "Building Applications and Solutions with Microsoft 365 Core Services" via their official Learn platform. These courses will help you understand Azure costs and subscription management in detail, leaving no questions unanswered.
Please note all this information is based on Azure CLI and Azure Costs in 2023, and further updates and enhancements are expected to take place.
Azure Subscription, Azure CLI, Instance Details, Subscription Cost, Azure Cost Management, Cloud Computing Expense, Microsoft Azure Billing, Azure Pricing, Azure Cost Analysis, Azure Infrastructure Cost.