Modified consent property

This commit is contained in:
Alexander (Sasha) Nosov
2025-05-01 17:57:42 -07:00
committed by GitHub
parent 743cff4da6
commit 331db52ade
2 changed files with 11 additions and 11 deletions
@@ -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| |`-ResourceGroup` |resource_group_name|*Optional*: Limits the scope to a specific resource group|
|`-MachineName` |machine_name|*Optional*: Limits the scope to a specific machine| |`-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 | |`-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"| |`-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"| |`-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|
<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. <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.
```PowerShell ```PowerShell
@@ -86,7 +86,7 @@ The following command will disable ESU on all servers in the subscriptions `<sub
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. 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 ```PowerShell
.\modify-license-type.ps1 -LicenseType PAYG -ConsentToRecurringPayg Yes -Force .\modify-license-type.ps1 -LicenseType PAYG -ConsentToRecurringPAYG Yes -Force
``` ```
> [!NOTE] > [!NOTE]
> The recurring billing only supported in the CSP accounts. > The recurring billing only supported in the CSP accounts.
@@ -12,7 +12,7 @@
# -ResourceGroup [resource_goup] (Optional. Limits the scope to a specific resoure group) # -ResourceGroup [resource_goup] (Optional. Limits the scope to a specific resoure group)
# -MachineName [machine_name] (Optional. Limits the scope to a specific machine) # -MachineName [machine_name] (Optional. Limits the scope to a specific machine)
# -LicenseType [license_type_value] (Optional. Sets the license type to the specified value) # -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" # -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" # 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" # -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)] [ValidateSet("PAYG","Paid","LicenseOnly", IgnoreCase=$false)]
[string] $LicenseType, [string] $LicenseType,
[ValidateSet("Yes","No", IgnoreCase=$false)] [ValidateSet("Yes","No", IgnoreCase=$false)]
[string] $ConsentToRecurringPayg, [string] $ConsentToRecurringPAYG,
[Parameter (Mandatory= $false)] [Parameter (Mandatory= $false)]
[ValidateSet("Yes","No", IgnoreCase=$false)] [ValidateSet("Yes","No", IgnoreCase=$false)]
[string] $UsePcoreLicense, [string] $UsePcoreLicense,
@@ -264,14 +264,14 @@ foreach ($sub in $subscriptions){
} }
} }
# Add or update ConsentToRecurringPayg setting if applicable # Add or update ConsentToRecurringPAYG setting if applicable
if ($ConsentToRecurringPayg -eq "Yes") { if ($ConsentToRecurringPAYG -eq "Yes") {
$isPayg = ($LicenseType -eq "PAYG") -or ($settings["LicenseType"] -eq "PAYG") $isPayg = ($LicenseType -eq "PAYG") -or ($settings["LicenseType"] -eq "PAYG")
if ($isPayg) { if ($isPayg) {
if (-not $settings.ContainsKey("ConsentToRecurringPayg") -or -not $settings["ConsentToRecurringPayg"]["IsApplied"]) { if (-not $settings.ContainsKey("ConsentToRecurringPAYG") -or -not $settings["ConsentToRecurringPAYG"]["Consented"]) {
$settings["ConsentToRecurringPayg"] = @{ $settings["ConsentToRecurringPAYG"] = @{
"IsApplied" = $true; "Consented" = $true;
"LastUpdatedTimestamp" = [DateTime]::UtcNow.ToString('yyyy-MM-ddTHH:mm:ss.fffZ') "ConsentTimestamp" = [DateTime]::UtcNow.ToString('yyyy-MM-ddTHH:mm:ss.fffZ')
} }
$WriteSettings = $true $WriteSettings = $true
} }