Skip to content

Commit 4c2449e

Browse files
authored
Cleaned up readme
1 parent 9d71c6b commit 4c2449e

2 files changed

Lines changed: 25 additions & 12 deletions

File tree

samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ ms.date: 05/01/2025
1818

1919
05/09/2025 - added *-ReportOnly* and *-TenandId* parameters
2020

21+
05/13/2025 - added support for a .CSV file with the machine names
22+
2123
# Overview
2224

2325
This script provides a scaleable solution to set or change the license type and/or enable or disable the ESU policy on all Azure-connected SQL Servers in a specified scope.
@@ -38,34 +40,45 @@ The script accepts the following command line parameters:
3840

3941
| **Parameter**                                         | **Value**                                                                       | **Description** |
4042
|:--|:--|:--|
41-
|`-SubId`|subscription_id *or* a file_name|*Optional*: Subscription id or a .csv file with the list of subscriptions<sup>1</sup>. If not specified all subscriptions will be scanned|
42-
|`-ResourceGroup` |resource_group_name|*Optional*: Limits the scope to a specific resource group|
43-
|`-MachineName` |machine_name|*Optional*: Limits the scope to a specific machine|
44-
|`-LicenseType` | "Paid", "PAYG" or "LicenseOnly"| *Optional*: Sets the license type to the specified value |
45-
|`-ConsentToRecurringPAYG` | "Yes" or "No" |*Optional*. Consents to enabling the recurring PAYG billing. LicenseType must be "PAYG". Applies to CSP subscriptions only.|
46-
|`-UsePcoreLicense` | "Yes", "No" | *Optional*. Enables unlimited virtualization license if the value is "Yes" or disables it if the value is "No". To enable, the license type must be "Paid" or "PAYG"|
47-
|`-EnableESU` | "Yes", "No" | *Optional*. Enables the ESU policy the value is "Yes" or disables it if the value is "No". To enable, the license type must be "Paid" or "PAYG"|
43+
|`-SubId`|`subscription_id` *or* `file_name`|*Optional*: Subscription id or a .csv file with the list of subscriptions<sup>1</sup>. If not specified all subscriptions will be scanned|
44+
|`-ResourceGroup` |`resource_group_name`|*Optional*: Limits the scope to a specific resource group|
45+
|`-MachineName` |`machine_name`|*Optional*: A single machine name or a CSV file name containing a list of machine names<sup>2</sup>.|
46+
|`-LicenseType` | `Paid`, `PAYG` or `LicenseOnly`| *Optional*: Sets the license type to the specified value |
47+
|`-ConsentToRecurringPAYG` | `Yes`, `No` |*Optional*. Consents to enabling the recurring PAYG billing. LicenseType must be "PAYG". Applies to CSP subscriptions only.|
48+
|`-UsePcoreLicense` | `Yes`, `No` | *Optional*. Enables unlimited virtualization license if the value is "Yes" or disables it if the value is "No". To enable, the license type must be "Paid" or "PAYG"|
49+
|`-EnableESU` | `Yes`, `No` | *Optional*. Enables the ESU policy the value is "Yes" or disables it if the value is "No". To enable, the license type must be "Paid" or "PAYG"|
4850
|`-Force`| |*Optional*. Forces the change of the license type to the specified value on all installed extensions. If `-Force` is not specified, the `-LicenseType` value is set only if undefined. Ignored if `-LicenseType` is not specified|
51+
|`-ExclusionTags`| `{"name":"value","name":"value"}` |*Optional*. If specified, excludes the resources that have this tag assigned.|
52+
|`-TenantId`| `tenant_id` |*Optional*. If specified, uses this tenant id to log in. Otherwise, the current context is used.|
53+
|`-ReportOnly`| |*Optional*. If true, generates a csv file with the list of resources that are to be modified, but doesn't make the actual change.|
54+
|`-UseManagedIdentity`| |*Optional*. If true, logs in both PoaerShell and CLI using managed identity. Required to run the script as a runbook.|
4955

5056
<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.
5157
```PowerShell
5258
Get-AzSubscription | Export-Csv .\mysubscriptions.csv -NoTypeInformation
5359
```
60+
<sup>2</sup>The .csv file must include a column *MachineName*. E.g.:
61+
```
62+
"MachineName",
63+
"Prod1",
64+
"Prod2",
65+
"Prod3"
66+
```
5467

5568
## Example 1
5669

57-
The following command will scan all the subscriptions to which the user has access to, and set the license type to "Paid" on all servers where license type is undefined.
70+
The following command will scan all the subscriptions to which the user has access to, and set the license type to "PAYG" on all servers where license type is undefined, except those with the tag `Environment:Dev`
5871

5972
```PowerShell
60-
.\modify-license-type.ps1 -LicenseType Paid
73+
.\modify-license-type.ps1 -LicenseType PAYG -ExclusionTags {"Environment":"Dev"}
6174
```
6275

6376
## Example 2
6477

65-
The following command will scan the subscription `<sub_id>` and set the license type value to "Paid" on all servers.
78+
The following command will scan the subscription `<sub_id>` and set the license type value to "Paid" on all servers listed in `machines.csv`.
6679

6780
```PowerShell
68-
.\modify-license-type.ps1 -SubId <sub_id> -LicenseType Paid -Force
81+
.\modify-license-type.ps1 -SubId <sub_id> -MachineName machines.csv -LicenseType Paid -Force
6982
```
7083

7184
## Example 3

samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-arc-sql-license-type.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function Connect-Azure {
115115
$ctx = Connect-AzAccount -Tenant $TenantId -Identity -ErrorAction Stop | Out-Null
116116
}
117117
else {
118-
$ctx = Connect-A-AzAccount -Tenant $TenantId -ErrorAction Stop | Out-Null
118+
$ctx = Connect-AzAccount -Tenant $TenantId -ErrorAction Stop | Out-Null
119119
}
120120
Write-Output "Connected to Azure PowerShell as: $($ctx.Account)"
121121

0 commit comments

Comments
 (0)