From f1992294e2c554e2938e97a95becd2a52d5ef06c Mon Sep 17 00:00:00 2001 From: "Alexander (Sasha) Nosov" Date: Fri, 9 May 2025 14:07:25 -0700 Subject: [PATCH] moved to the old folder --- .../modify-arc-license-type/README.md | 149 ------------------ .../modify-arc-sql-license-type.ps1} | 0 .../modify-azure-aql-license-type.ps1 | 0 3 files changed, 149 deletions(-) delete mode 100644 samples/manage/azure-arc-enabled-sql-server/modify-arc-license-type/README.md rename samples/manage/azure-arc-enabled-sql-server/{modify-arc-license-type/modify-arc-license-type.ps1 => modify-license-type/modify-arc-sql-license-type.ps1} (100%) create mode 100644 samples/manage/azure-hybrid-benefit/modify-license-type/modify-azure-aql-license-type.ps1 diff --git a/samples/manage/azure-arc-enabled-sql-server/modify-arc-license-type/README.md b/samples/manage/azure-arc-enabled-sql-server/modify-arc-license-type/README.md deleted file mode 100644 index 85253360..00000000 --- a/samples/manage/azure-arc-enabled-sql-server/modify-arc-license-type/README.md +++ /dev/null @@ -1,149 +0,0 @@ ---- -services: Azure Arc-enabled SQL Server -platforms: Azure -author: anosov1960 -ms.author: sashan -ms.date: 05/01/2025 ---- - - -# Overview - -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. - -You can specify a single subscription to scan, or provide a list of subscriptions as a .CSV file. -If not specified, all subscriptions your role has access to are scanned. - -# Prerequisites - -- You must have at least a *Azure Connected Machine Resource Administrator* role in each subscription you modify. -- The Azure extension for SQL Server is updated to version 1.1.2230.58 or newer. -- You must be connected to Azure AD and logged in to your Azure account. If your account have access to multiple tenants, make sure to log in with a specific tenant ID. - - -# Launching the script - -The script accepts the following command line parameters: - -| **Parameter**                                         | **Value**                                                                       | **Description** | -|:--|:--|:--| -|`-SubId`|subscription_id *or* a file_name|*Optional*: Subscription id or a .csv file with the list of subscriptions1. If not specified all subscriptions will be scanned| -|`-ResourceGroup` |resource_group_name|*Optional*: Limits the scope to a specific resource group| -|`-MachineName` |machine_name|*Optional*: Limits the scope to a specific machine| -|`-LicenseType` | "Paid", "PAYG" or "LicenseOnly"| *Optional*: Sets the license type to the specified value | -|`-ConsentToRecurringPAYG` | "Yes" or "No" |*Optional*. Consents to enabling the recurring PAYG billing. LicenseType must be "PAYG". Applies to CSP subscriptions only.| -|`-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"| -|`-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"| -|`-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| - -1You can create a .csv file using the following command and then edit to remove the subscriptions you don't want to scan. -```PowerShell -Get-AzSubscription | Export-Csv .\mysubscriptions.csv -NoTypeInformation -``` - -## Example 1 - -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. - -```PowerShell -.\modify-license-type.ps1 -LicenseType Paid -``` - -## Example 2 - -The following command will scan the subscription `` and set the license type value to "Paid" on all servers. - -```PowerShell -.\modify-license-type.ps1 -SubId -LicenseType Paid -Force -``` - -## Example 3 - -The following command will scan resource group `` in the subscription ``, set the license type value to "PAYG" and enable unlimited virtualization license on all servers in the specified resource group. - -```PowerShell -.\modify-license-type.ps1 -SubId -ResourceGroup -LicenseType PAYG -UsePcoreLicense Yes -Force -``` - -## Example 4 - -The following command will set License Type to "Paid" and enables ESU on all servers in the subscriptions `` and the resource group ``. - -```console -.\modify-license-type.ps1 -SubId -ResourceGroup -LicenseType Paid -EnableESU Yes -Force -``` - -## Example 5 - -The following command will disable ESU on all servers in the subscriptions ``. - -```console -.\modify-license-type.ps1 -SubId -EnableESU No -``` - -## Example 6 - -The following command will scan all subscriptions in the account, set the license type value to "PAYG" and consents to enabling recurring billing on all servers in the account. - -```PowerShell -.\modify-license-type.ps1 -LicenseType PAYG -ConsentToRecurringPAYG Yes -Force -``` -> [!NOTE] -> The recurring billing only supported in the CSP accounts. - -# Running the script using Cloud Shell - -This option is recommended because Cloud shell has the Azure PowerShell modules pre-installed and you are automatically authenticated. Use the following steps to run the script in Cloud Shell. - -1. Launch the [Cloud Shell](https://shell.azure.com/). For details, [read more about PowerShell in Cloud Shell](https://aka.ms/pscloudshell/docs). - -1. Connect to Azure AD. You must specify `` if you have access to more than one AAD tenants. - - ```console - Connect-AzureAD -TenantID - ``` - -1. Upload the script to your cloud shell using the following command: - - ```console - curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 -o modify-license-type.ps1 - ``` - -1. Run the script. - -> [!NOTE] -> - To paste the commands into the shell, use `Ctrl-Shift-V` on Windows or `Cmd-v` on MacOS. -> - The script will be uploaded directly to the home folder associated with your Cloud Shell session. - -# Running the script from a PC - - -Use the following steps to run the script in a PowerShell session on your PC. - -1. Copy the script to your current folder: - - ```console - curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 -o modify-license-type.ps1 - ``` - -1. Make sure the NuGet package provider is installed: - - ```console - Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - Install-packageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Scope CurrentUser -Force - ``` - -1. Make sure the the Az module is installed. For more information, see [Install the Azure Az PowerShell module](https://learn.microsoft.com/powershell/azure/install-az-ps): - - ```console - Install-Module Az -Scope CurrentUser -Repository PSGallery -Force - ``` - -1. Connect to Azure AD and log in to your Azure account. You must specify `` if you have access to more than one AAD tenants. - - ```console - Connect-AzureAD -TenantID - Connect-AzAccount -TenantID (Get-AzureADTenantDetail).ObjectId - ``` - -1. Run the script. diff --git a/samples/manage/azure-arc-enabled-sql-server/modify-arc-license-type/modify-arc-license-type.ps1 b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-arc-sql-license-type.ps1 similarity index 100% rename from samples/manage/azure-arc-enabled-sql-server/modify-arc-license-type/modify-arc-license-type.ps1 rename to samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-arc-sql-license-type.ps1 diff --git a/samples/manage/azure-hybrid-benefit/modify-license-type/modify-azure-aql-license-type.ps1 b/samples/manage/azure-hybrid-benefit/modify-license-type/modify-azure-aql-license-type.ps1 new file mode 100644 index 00000000..e69de29b