Files
sql-server-samples/samples/manage/azure-arc-enabled-sql-server/activate-pcore-license/activate-pcore-license.md
T

777 B

<# .DESCRIPTION This runbook activates a SQL Server license using the Managed Identity The runbook accepts the following parameters:

-LicenseID            (The license resource URI)

.NOTES
    AUTHOR: Alexander (Sasha) Nosov
    LASTEDIT: June 15, 2024

#>

param ( [Parameter (Mandatory= $true)] [string] $LicenseId, )

Suppress warnings

Update-AzConfig -DisplayBreakingChangeWarning $false

Logging in to Azure..."

try { Connect-AzAccount -Identity } catch { Write-Error -Message $.Exception throw $.Exception }

$currentLicense = Get-AzResource -ResourceId $LicenseId $currentLicense.properties.activationState = "Activated" $currentLicense | Set-AzResource -Force