All scripts
Azure AI 211
Get-AzureBudgetAlertStatus
Reports every configured budget in the subscription, its threshold, and current spend against it, so budget alerts can be verified as actually working rather than just assumed configured.
Get-AzureBudgetAlertStatus.ps1
<#
.SYNOPSIS
Reports budget configuration and current spend against thresholds.
.DESCRIPTION
Lists every budget configured in the subscription with its amount,
alert thresholds, and current spend, so budget alerts can be
verified as actually configured and working rather than assumed to
exist.
.EXAMPLE
.\Get-AzureBudgetAlertStatus.ps1
.NOTES
Requires the Az.CostManagement module and an active Connect-AzAccount session.
.AUTHOR
Shehryar Hassan
#>
$budgets = Get-AzConsumptionBudget
$report = $budgets | ForEach-Object {
[pscustomobject]@{
BudgetName = $_.Name
Amount = $_.Amount
CurrentSpend = $_.CurrentSpend.Amount
PercentUsed = [math]::Round(($_.CurrentSpend.Amount / $_.Amount) * 100, 1)
Thresholds = ($_.Notification.Values.Threshold -join ", ")
}
}
$report | Sort-Object PercentUsed -Descending | Format-Table -AutoSize
Read it before you run it, and test in a safe tenant first.