|
1 | 1 | ---
|
2 |
| -services: azure automation |
3 |
| -platforms: azure |
| 2 | +services: Azure SQL |
| 3 | +platforms: Azure |
4 | 4 | author: anosov1960
|
| 5 | +ms.author: sashan |
| 6 | +ms.date: 12/15/2020 |
5 | 7 | ---
|
6 | 8 |
|
7 |
| -# Managing Azure Hybrid Benefit |
| 9 | +# Overview |
| 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.csv` file with the consolidated SQL Server license usage by all SQL resources in the specific subscriptions or the entire account. The usage is broken down into the following categories of licenses: |
| 12 | + |
| 13 | +- AHB Standard vCores |
| 14 | +- AHB Enterprise vCores |
| 15 | +- PAYG Standard vCores |
| 16 | +- PAYG Enterprise vCores |
| 17 | +- HADR Standard vCores |
| 18 | +- HADR Enterprise vCores |
| 19 | +- Developer vCores |
| 20 | +- Express vCores |
| 21 | + |
| 22 | +>[!NOTE] |
| 23 | +> - The usage data is a snapshot at the time of the script execution based on the size of the deployed SQL resources in vCores. |
| 24 | +> - For IaaS workloads, such as SQL Server in Virtual Machines or SSIS integration runtimes, each vCPU is counted as one vCore. |
| 25 | +> - 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 | + |
| 28 | +# Running the script using Cloud Shell |
| 29 | + |
| 30 | +Use the following steps to calculate the SQL Server license usage: |
| 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). |
| 33 | + |
| 34 | +2. Upload the script to the shell using the following command: |
| 35 | + |
| 36 | + ```console |
| 37 | + curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-hybrid-benefit/sql-license-usage.ps1 -o sql-license-usage.ps1 |
| 38 | + ``` |
| 39 | + |
| 40 | +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. |
| 41 | + |
| 42 | + ```console |
| 43 | + ./sql-license-usage.ps1 |
| 44 | + ``` |
| 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. |
| 49 | + |
| 50 | + ```console |
| 51 | + Get-AzSubscription | Export-Csv .\mysubscriptions.csv -NoTypeInformation |
| 52 | + ``` |
| 53 | + |
| 54 | +2. Run the script and specify the `.csv` file as a parameter. |
| 55 | + ```console |
| 56 | + ./sql-license-usage.ps1 .\mysubscriptions.csv |
| 57 | + ``` |
| 58 | + |
| 59 | +> [!NOTE] |
| 60 | +> - To paste the commands into the shell, use `Ctrl-Shift-V` on Windows or `Cmd-v` on MacOS. |
| 61 | +> - The script will be uploaded 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. |
8 | 63 |
|
9 |
| -Provides the scripts to help you manage the [Azure Hybrid Benefit](https://azure.microsoft.com/pricing/hybrid-benefit/). |
|
0 commit comments