You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/manage/azure-hybrid-benefit/README.md
+10-16Lines changed: 10 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,14 @@ services: Azure SQL
3
3
platforms: Azure
4
4
author: anosov1960
5
5
ms.author: sashan
6
-
ms.date: 12/15/2020
6
+
ms.date: 12/17/2020
7
7
---
8
8
9
9
# Overview
10
10
11
-
This script is provided to help you manage the SQL Server licenses that are consumed by the SQL Servers deployed to Azure. The script's output is a`sql-license-usage_<timestamp>.csv` file with the consolidated SQL Server license usage by all SQL resources in the specific subscriptions or the entire account. By periodically generating the usage report you can track your license utilization over time. The usage is broken into the following license categories:
11
+
This script is provided to help you manage the SQL Server licenses that are consumed by the SQL Servers deployed to Azure. The script writes the results`sql-license-usage.csv` file with the consolidated SQL Server license usage by all SQL resources in the specific subscriptions or the entire account. If the file with this name already exists, the new results will be appended. The reports includes the following data for each scanned subscription and a total number of vCores in each category:
12
12
13
+
- Date and time of scan
13
14
- AHB Standard vCores
14
15
- AHB Enterprise vCores
15
16
- PAYG Standard vCores
@@ -24,40 +25,33 @@ This script is provided to help you manage the SQL Server licenses that are cons
24
25
> - For IaaS workloads, such as SQL Server in Virtual Machines or SSIS integration runtimes, each vCPU is counted as one vCore.
25
26
> - 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.
26
27
27
-
28
28
# Running the script using Cloud Shell
29
29
30
30
Use the following steps to calculate the SQL Server license usage:
31
31
32
-
1. Launch the [Cloud Shell](https://shell.azure.com/). For details, [read more about PowerShell in Cloud Shell](https://aka.ms/pscloudshell/docs).
32
+
1. Launch the [Cloud Shell](https://shell.azure.com/). For details, read [PowerShell in Cloud Shell](https://aka.ms/pscloudshell/docs).
33
33
34
34
2. Upload the script to the shell using the following command:
3. Run the script in interactive mode. The script will prompt for a subscriptions ID or `*`. The latter will automatically scan all the subscriptions in you account.
40
+
3. Run the script with a specific subscriptions ID or the file name as the parameter. The file should be used if you need to scan a subset of the subscriptions. If the parameter is not specified, the script will scan all the subscriptions in your account.
41
41
42
42
```console
43
-
./sql-license-usage.ps1
43
+
./sql-license-usage.ps1 <subscription ID> or <filename>.csv
44
44
```
45
45
46
-
If you need to scan a subset of the subscriptions, use the following steps:
47
-
48
-
1. Create a `.csv` with the list off all subscriptions in your account using the following command. You can edit the file to remove the subscriptions you don't want to scan.
46
+
If the a file is specified, it must be a `.csv` file with the list of subscriptions. To create a file containing all subscriptions in your account, use the following command. You can then edit the file to remove the subscriptions you don't want to scan.
2. Run the script and specify the `.csv` file as a parameter.
55
-
```console
56
-
./sql-license-usage.ps1 .\mysubscriptions.csv
57
-
```
58
-
59
51
> [!NOTE]
60
52
> - To paste the commands into the shell, use `Ctrl-Shift-V` on Windows or `Cmd-v` on MacOS.
61
53
> - The `curl`command will copy the script directly to the home folder associated with your Cloud Shell session.
62
-
> - The script will prompt for the resource group name and print a message when migration is completed.
63
54
55
+
# Tracking SQL license usage over time
56
+
57
+
You can track your license utilization over time by periodically running this script. Each new scan will add the results to `sql-license-usage.csv`, which you can use for reporting the license usage over time in Excel or other tools. To this script on schedule using Azure automation, read [Create a PowerShell runbook tutorial](https://docs.microsoft.com/azure/automation/learn/automation-tutorial-runbook-textual-powershell).
Copy file name to clipboardExpand all lines: samples/manage/azure-hybrid-benefit/sql-license-usage.ps1
+38-38Lines changed: 38 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -14,52 +14,49 @@
14
14
#
15
15
# Sample script to calculate the consolidated SQL Server license usage by all of the SQL resources in a specific subscription or the entire the account.
16
16
#
17
-
# This script accepts a .csv file as a parameter, which provides a list of subscriptions to be scanned for the license usage. You can create
17
+
# This script accepts a .csv file or a subscription ID as a parameter. The file must include a list of subscriptions to be scanned for the license usage. You can create
18
18
# such a file by the following command and then edit to remove the subscriptions you don't want to scan:
# If no file is provided, the script will prompt for a subscriptiobn ID or `*`. The latter will automatically scan all the subscriptions you account
21
+
# If no parameter is provided, the script will prompt for a file or subscriptiobn ID. If no value is provided, the scipt will scan all the subscriptions you account
22
22
# has access to.
23
23
#
24
24
#
25
25
# NOTE: The script does not calculate usage for Azure SQL resources that use the DTU-based purchasing model
0 commit comments