Skip to content

Commit 40d6622

Browse files
authored
Merge pull request #912 from anosov1960/master
New date
2 parents 7d472a4 + 54e04eb commit 40d6622

9 files changed

Lines changed: 14 additions & 72 deletions

File tree

DiscoverSql.ps1

Lines changed: 0 additions & 12 deletions
This file was deleted.

DiscoverSql.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

mysubscriptions.csv

Lines changed: 0 additions & 16 deletions
This file was deleted.

samples/manage/azure-hybrid-benefit/DiscoverSql.ps1

Lines changed: 0 additions & 11 deletions
This file was deleted.

samples/manage/azure-hybrid-benefit/DiscoverSql.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
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/5/2021
6+
ms.date: 3/9/2021
77
---
88

99
# Overview
@@ -42,7 +42,7 @@ The following resources are in scope for the license utilization analysis:
4242
> - For PaaS workloads, each vCore of Business Critical service tier is counted as one Enterprise vCore and each vCore of General Purpose service tier is counted as one Standard vCore.
4343
> - In the DTU-based purchasing model, the SQL license cost is built into the individual SKU prices. These resources are not eligible for Azure Hybrid Benefit or HADR benefit, and therefore are not in scope of the tool.
4444
> - You must be at least a *Reader* of each subscription you scan.
45-
> - Unregistered vCores are only reported for Virtual Machines running Windows. You must be a subscription *Contributor* or *Owner*, otherwise this column will show a zero value.
45+
> - To report unregistered vCores, you must be a subscription *Contributor* or *Owner*, otherwise this column will show a zero value.
4646
> - The values AHB ECs and PAYG ECs are reserved for the future use and should be ignored
4747
4848
# Launching the script

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

Lines changed: 0 additions & 2 deletions
This file was deleted.

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@
3131
# The script accepts the following command line parameters:
3232
#
3333
# -SubId [subscription_id] | [csv_file_name] (Accepts a .csv file with the list of subscriptions)
34-
# -UseInRunbook [True] | [False] (Required when executed as a Runbook)
3534
# -Server [protocol:]server[instance_name][,port] (Required to save data to the database)
3635
# -Database [database_name] (Required to save data to the database)
3736
# -Cred [credential_object] (Required to save data to the database)
3837
# -FilePath [csv_file_name] (Required to save data in a .csv format. Ignored if database parameters are specified)
39-
#
38+
# -UseInRunbook [True] | [False] (Required when executed as a Runbook)
4039
#
4140

4241
param (
@@ -84,7 +83,7 @@ function CheckModule ($m) {
8483
}
8584

8685
function GetVCores {
87-
# This function translates each VM or Host sku typo and name into vCores
86+
# This function translates each VM or Host sku type and name into vCores
8887

8988
[CmdletBinding()]
9089
param (
@@ -114,7 +113,7 @@ function GetVCores {
114113
}
115114
}
116115
function AddVCores {
117-
# This function populets the $subtotal nubmers
116+
# This function breaks down vCores into the $subtotal columns
118117

119118
[CmdletBinding()]
120119
param (
@@ -264,7 +263,7 @@ if ($SubId -like "*.csv") {
264263

265264
[bool] $useDatabase = $PSBoundParameters.ContainsKey("Server") -and $PSBoundParameters.ContainsKey("Cred") -and $PSBoundParameters.ContainsKey("Database")
266265

267-
#Initialize tables and arrays
266+
# Initialize tables and arrays
268267

269268
if ($useDatabase){
270269

@@ -363,42 +362,42 @@ foreach ($sub in $subscriptions){
363362
# Get all resource groups in the subscription
364363
$rgs = Get-AzResourceGroup
365364

366-
#Get all logical servers
365+
# Get all logical servers
367366
$servers = Get-AzSqlServer
368367

369-
#Scan all vCore-based SQL database resources in the subscription
368+
# Scan all vCore-based SQL database resources in the subscription
370369
$servers | Get-AzSqlDatabase | Where-Object { $_.SkuName -ne "ElasticPool" -and $_.Edition -in "GeneralPurpose", "BusinessCritical", "Hyperscale"} | Foreach-Object {
371370
AddVCores -Tier $_.Edition -LicenseType $_.LicenseType -CoreCount $_.Capacity
372371
}
373372
[system.gc]::Collect()
374373

375-
#Scan all vcOre-based SQL elastic pool resources in the subscription
374+
# Scan all vcOre-based SQL elastic pool resources in the subscription
376375
$servers | Get-AzSqlElasticPool | Where-Object { $_.Edition -in "GeneralPurpose", "BusinessCritical", "Hyperscale"} | Foreach-Object {
377376
AddVCores -Tier $_.Edition -LicenseType $_.LicenseType -CoreCount $_.Capacity
378377
}
379378
[system.gc]::Collect()
380379

381-
#Scan all SQL managed instance resources in the subscription
380+
# Scan all SQL managed instance resources in the subscription
382381
Get-AzSqlInstance | Where-Object { $_.InstancePoolName -eq $null} | Foreach-Object {
383382
AddVCores -Tier $_.Sku.Tier -LicenseType $_.LicenseType -CoreCount $_.VCores
384383
}
385384
[system.gc]::Collect()
386385

387-
#Scan all instance pool resources in the subscription
386+
# Scan all instance pool resources in the subscription
388387
Get-AzSqlInstancePool | Foreach-Object {
389388
AddVCores -Tier $_.Edition -LicenseType $_.LicenseType -CoreCount $_.VCores
390389
}
391390
[system.gc]::Collect()
392391

393-
#Scan all SSIS imtegration runtime resources in the subscription
392+
# Scan all SSIS imtegration runtime resources in the subscription
394393
$rgs | Get-AzDataFactoryV2 | Get-AzDataFactoryV2IntegrationRuntime | Where-Object { $_.State -eq "Started" -and $_.Nodesize -ne $null } | Foreach-Object {
395394
$vCores = GetVCores -type "virtualMachines" -name $_.NodeSize
396395
AddVCores -Tier $_.Edition -LicenseType $_.LicenseType -CoreCount $vCores
397396
}
398397
[system.gc]::Collect()
399398

400-
#Scan all VMs with SQL server installed using a parallel loop (up to 10 at a time). For that reason function AddVCores is not used
401-
#NOTE: ForEach-Object -Parallel is not supported in Runbooks (requires PS v7.1)
399+
# Scan all VMs with SQL server installed using a parallel loop (up to 10 at a time). For that reason function AddVCores is not used
400+
# NOTE: ForEach-Object -Parallel is not supported in Runbooks (requires PS v7.1)
402401
if ($PSVersionTable.PSVersion.Major -ge 7){
403402
$vms = Get-AzVM -Status | Where-Object { $_.powerstate -eq 'VM running' } | ForEach-Object -ThrottleLimit 10 -Parallel {
404403
$function:GetVCores = $using:GetVCoresDef

sql-license-usage.csv

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)