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

services, platforms, author, ms.author, ms.date
services platforms author ms.author ms.date
Azure SQL Azure anosov1960 sashan 06/24/2024

Overview

This script performes a scheduled activation of a SQL Server p-core license.

Required permissions

Your RBAC role must include the following permissions:

  • Microsoft.AzureArcData/SqlLicenses/read
  • Microsoft.AzureArcData/SqlLicenses/write
  • Microsoft.Management/managementGroups/read
  • Microsoft.Resources/subscriptions/read
  • Microsoft.Resources/subscriptions/resourceGroups/read
  • Microsoft.Support/supporttickets/write

Creating a Azure runbook

You can scahedule to run the the command as a runbook. To set it up using Azure Portal, follow these steps.

  1. Open a command shell on your device and run this command. It will copy the script to your local folder.
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 or open an existing one. In the Advanced section, make sure that System assigned identity is selecetd.
  2. In the Process automation group select Runbooks
  3. Click on the Import a runbook tab and configure it:
    • select the file you downloaded in Step 1
    • type in a name of the runbook
    • select the type as PowerShell
    • select the runtime version 5.1
    • click Import.
  4. When import is completed, click the Publish button.
  5. Once the status changes to Published on the runbook blade, click on the Link to schedule button
  6. Select Link a schedule to your runbook and click + Add a schedule
  7. Configure the schedule:
    • type in the name of the schedule
    • set the start time
    • set Recurrance to Once
    • click Create
  8. In a separate browser window, open the Azure resource of your inactive licence, go to the Settings group, select Properties and copy the license ID (URI) to the clipboard.
  9. Go back to Schedule runbook page, click on Parameters and run settings and paste the license ID value you copied to the clipboard.
  10. Click OK to link to the schedule and OK again to create the job.
  11. On the runbook Overview page, click to open a recent job that was completed right after the specified start time.
  12. Click on the Output tab and notice the Properties.activationState=Activated. Your license is now active.

For more information about the runbooks, see the Runbook tutorial