From 331db52ade127852993f953d1441a904fcaaeb48 Mon Sep 17 00:00:00 2001 From: "Alexander (Sasha) Nosov" Date: Thu, 1 May 2025 17:57:42 -0700 Subject: [PATCH] Modified consent property --- .../modify-license-type/README.md | 6 +++--- .../modify-license-type/modify-license-type.ps1 | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md index 8ba24753..2a86d276 100644 --- a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md +++ b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md @@ -31,10 +31,10 @@ The script accepts the following command line parameters: |`-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.| +|`-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| +|`-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 @@ -86,7 +86,7 @@ The following command will disable ESU on all servers in the subscriptions ` [!NOTE] > The recurring billing only supported in the CSP accounts. diff --git a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 index 0b743171..96cc0ec2 100644 --- a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 +++ b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 @@ -12,7 +12,7 @@ # -ResourceGroup [resource_goup] (Optional. Limits the scope to a specific resoure group) # -MachineName [machine_name] (Optional. Limits the scope to a specific machine) # -LicenseType [license_type_value] (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. +# -ConsentToRecurringPAYG [Yes or No] (Optional. Consents to enabling the recurring PAYG billing. LicenseType must be "PAYG". Applies to CSP subscriptions only. # -UsePcoreLicense [Yes or 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 or No] (Optional. Enables the ESU policy if the value is "Yes" or disables it if the value is "No" @@ -36,7 +36,7 @@ param ( [ValidateSet("PAYG","Paid","LicenseOnly", IgnoreCase=$false)] [string] $LicenseType, [ValidateSet("Yes","No", IgnoreCase=$false)] - [string] $ConsentToRecurringPayg, + [string] $ConsentToRecurringPAYG, [Parameter (Mandatory= $false)] [ValidateSet("Yes","No", IgnoreCase=$false)] [string] $UsePcoreLicense, @@ -264,14 +264,14 @@ foreach ($sub in $subscriptions){ } } - # Add or update ConsentToRecurringPayg setting if applicable - if ($ConsentToRecurringPayg -eq "Yes") { + # Add or update ConsentToRecurringPAYG setting if applicable + if ($ConsentToRecurringPAYG -eq "Yes") { $isPayg = ($LicenseType -eq "PAYG") -or ($settings["LicenseType"] -eq "PAYG") if ($isPayg) { - if (-not $settings.ContainsKey("ConsentToRecurringPayg") -or -not $settings["ConsentToRecurringPayg"]["IsApplied"]) { - $settings["ConsentToRecurringPayg"] = @{ - "IsApplied" = $true; - "LastUpdatedTimestamp" = [DateTime]::UtcNow.ToString('yyyy-MM-ddTHH:mm:ss.fffZ') + if (-not $settings.ContainsKey("ConsentToRecurringPAYG") -or -not $settings["ConsentToRecurringPAYG"]["Consented"]) { + $settings["ConsentToRecurringPAYG"] = @{ + "Consented" = $true; + "ConsentTimestamp" = [DateTime]::UtcNow.ToString('yyyy-MM-ddTHH:mm:ss.fffZ') } $WriteSettings = $true }