mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Merge pull request #1403 from anosov1960/PAYG-transition
renames the file ext to .md
This commit is contained in:
@@ -27,7 +27,7 @@ You can scahedule to run the the command as a runbook. To set it up using Azure
|
||||
|
||||
1. Open a command shell on your device and run this command. It will copy the script to your local folder.
|
||||
```console
|
||||
curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-arc-enabled-sql-server/activate-pcore-license/activate-pcore-license.md -o activate-pcore-license.ps1
|
||||
curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-arc-enabled-sql-server/activate-pcore-license/activate-pcore-license.ps1 -o activate-pcore-license.ps1
|
||||
```
|
||||
1. [Create a new automation account](https://ms.portal.azure.com/#create/Microsoft.AutomationAccount) or open an existing one. In the Advanced section, make sure that *System assigned identity* is selecetd.
|
||||
1. In the **Process automation** group select **Runbooks**
|
||||
|
||||
+36
-36
@@ -1,36 +1,36 @@
|
||||
.<#
|
||||
.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 24, 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
|
||||
|
||||
.<#
|
||||
.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 24, 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
|
||||
|
||||
Reference in New Issue
Block a user