Skip to content

Commit 911fd26

Browse files
authored
Added warning suppression
1 parent 0a9c399 commit 911fd26

2 files changed

Lines changed: 21 additions & 14 deletions

File tree

samples/manage/azure-hybrid-benefit/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services: Azure SQL
33
platforms: Azure
44
author: anosov1960
55
ms.author: sashan
6-
ms.date: 3/27/2021
6+
ms.date: 10/26/2022
77
---
88

99
# Overview
@@ -58,6 +58,8 @@ The script accepts the following command line parameters:
5858
|-Cred|credential_object|Optional: value of type PSCredential to securely pass database user and password|
5959
|-FilePath|csv_file_name|Optional: filename where the data will be saved in a .csv format. Ignored if database parameters are specified|
6060
|-ShowUnregistered|\$True or \$False (default)|Optional: causes the script to report the total size of VMs with a self-hosted SQL server instance that is unregistered with the IaaS SQL extension|
61+
|-ShowNC|\$True or \$False (default)|Optional: causes the script to report the AHB and PAYG consumption in normalized cores (NC). For more information about normalized cores, see [How licenses apply to Azure resources](https://learn.microsoft.com/azure/cost-management-billing/scope-level/overview-azure-hybrid-benefit-scope#how-licenses-apply-to-azure-resources).|
62+
6163

6264
<sup>1</sup>You can create a .csv file using the following command and then edit to remove the subscriptions you don't want to scan.
6365
```PowerShell

samples/manage/azure-hybrid-benefit/sql-license-usage.ps1

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ param (
4040
[Parameter (Mandatory= $false)]
4141
[bool] $UseInRunbook = $false,
4242
[Parameter (Mandatory= $false)]
43-
[bool] $ShowEC = $false,
43+
[bool] $ShowNC = $false,
4444
[Parameter (Mandatory= $false)]
4545
[bool] $ShowUnregistered = $false
4646

@@ -183,6 +183,11 @@ function DiscoveryOnWindows {
183183
Write-Output $SqlInstalled
184184
}
185185

186+
#
187+
# Suppress warnings
188+
#
189+
Update-AzConfig -DisplayBreakingChangeWarning $false
190+
186191
#
187192
# This script checks if SQL Server is installed on Linux
188193
#
@@ -271,8 +276,8 @@ if ($useDatabase){
271276
[Time] [time](7) NOT NULL,
272277
[SubscriptionName] [nvarchar](50) NOT NULL,
273278
[SubscriptionID] [nvarchar](50) NOT NULL,
274-
[AHB_EC] [int] NULL,
275-
[PAYG_EC] [int] NULL,
279+
[AHB_NC] [int] NULL,
280+
[PAYG_NC] [int] NULL,
276281
[AHB_STD_vCores] [int] NULL,
277282
[AHB_ENT_vCores] [int] NULL,
278283
[PAYG_STD_vCores] [int] NULL,
@@ -288,8 +293,8 @@ if ($useDatabase){
288293
[Time],
289294
[SubscriptionName],
290295
[SubscriptionID],
291-
[AHB_EC],
292-
[PAYG_EC],
296+
[AHB_NC],
297+
[PAYG_NC],
293298
[AHB_STD_vCores],
294299
[AHB_ENT_vCores],
295300
[PAYG_STD_vCores],
@@ -324,7 +329,7 @@ if ($useDatabase){
324329
}
325330

326331
[System.Collections.ArrayList]$usageTable = @()
327-
$usageTable += ,(@("Date", "Time", "Subscription Name", "Subscription ID", "AHB ECs", "PAYG ECs", "AHB Std vCores", "AHB Ent vCores", "PAYG Std vCores", "PAYG Ent vCores", "HADR Std vCores", "HADR Ent vCores", "Developer vCores", "Express vCores", "Unregistered vCores", "Unknown vCores"))
332+
$usageTable += ,(@("Date", "Time", "Subscription Name", "Subscription ID", "AHB NCs", "PAYG NCs", "AHB Std vCores", "AHB Ent vCores", "PAYG Std vCores", "PAYG Ent vCores", "HADR Std vCores", "HADR Ent vCores", "Developer vCores", "Express vCores", "Unregistered vCores", "Unknown vCores"))
328333
}
329334

330335
$global:VM_SKUs = @{} # To hold the VM SKU table for future use
@@ -542,18 +547,18 @@ foreach ($sub in $subscriptions){
542547
$Date = Get-Date -Format "yyy-MM-dd"
543548

544549
$Time = Get-Date -Format "HH:mm:ss"
545-
if ($ShowEC){
546-
$ahb_ec = ($subtotal.ahb_std + $subtotal.ahb_ent*4)
547-
$payg_ec = ($subtotal.payg_std + $subtotal.payg_ent*4)
550+
if ($ShowNC){
551+
$ahb_nc = ($subtotal.ahb_std + $subtotal.ahb_ent*4)
552+
$payg_nc = ($subtotal.payg_std + $subtotal.payg_ent*4)
548553
}else{
549-
$ahb_ec = 0
550-
$payg_ec = 0
554+
$ahb_nc = 0
555+
$payg_nc = 0
551556
}
552557
if ($useDatabase){
553-
$propertiesToSplat.Query = $insertSQL -f $Date, $Time, $sub.Name, $sub.Id, $ahb_ec, $payg_ec, $subtotal.ahb_std, $subtotal.ahb_ent, $subtotal.payg_std, $subtotal.payg_ent, $subtotal.hadr_std, $subtotal.hadr_ent, $subtotal.developer, $subtotal.express, $subtotal.unreg_sqlvm, $subtotal.unknown_tier
558+
$propertiesToSplat.Query = $insertSQL -f $Date, $Time, $sub.Name, $sub.Id, $ahb_nc, $payg_nc, $subtotal.ahb_std, $subtotal.ahb_ent, $subtotal.payg_std, $subtotal.payg_ent, $subtotal.hadr_std, $subtotal.hadr_ent, $subtotal.developer, $subtotal.express, $subtotal.unreg_sqlvm, $subtotal.unknown_tier
554559
Invoke-SQLCmd @propertiesToSplat
555560
}else{
556-
$usageTable += ,(@( $Date, $Time, $sub.Name, $sub.Id, $ahb_ec, $payg_ec, $subtotal.ahb_std, $subtotal.ahb_ent, $subtotal.payg_std, $subtotal.payg_ent, $subtotal.hadr_std, $subtotal.hadr_ent, $subtotal.developer, $subtotal.express, $subtotal.unreg_sqlvm, $subtotal.unknown_tier))
561+
$usageTable += ,(@( $Date, $Time, $sub.Name, $sub.Id, $ahb_nc, $payg_nc, $subtotal.ahb_std, $subtotal.ahb_ent, $subtotal.payg_std, $subtotal.payg_ent, $subtotal.hadr_std, $subtotal.hadr_ent, $subtotal.developer, $subtotal.express, $subtotal.unreg_sqlvm, $subtotal.unknown_tier))
557562
}
558563
}
559564

0 commit comments

Comments
 (0)