Distribuera och hantera Azure Arc Extended Security Updates-licenser programmatiskt

Den här artikeln innehåller instruktioner för att programmatiskt provisionera och hantera livscykelåtgärder för Windows Server utökade säkerhetsuppdateringar via Azure Arc ESU ARM-API:er. Anvisningarna gäller för Windows Server 2012/2012 R2 och Windows Server 2016. Använd väljaren överst i artikeln för att välja den operativsystemversion som du licensierar.

För vart och ett av API-kommandona som beskrivs i den här artikeln anger du korrekt parameterinformation för plats, status, edition, typ och processorer beroende på ditt specifika scenario. Ange target-egenskapen för det operativsystem du licensierar:

  • Windows Server 2012
  • Windows Server 2012 R2

Important

ESU-perioden för Windows Server 2012 och Windows Server 2012 R2 upphör den 13 oktober 2026. Vid midnatt coordinated universal time (UTC) den 14 oktober 2026 inaktiveras ESU-licenser som är aktiverade av Azure Arc och upphör att ge rätt till uppdateringar. Inaktiverade licensresurser är fortfarande möjliga att söka i, men de kan inte ge behörighet för säkerhetsuppdateringar som släppts efter den 13 oktober 2026.

  • Windows Server 2016

Anmärkning

Du måste skapa ett tjänsthuvudnamn för att kunna använda Azure-API:et för att hantera ESU:er. Mer information finns i Ansluta hybriddatorer till Azure i stor skala och Azure REST API-referens .

Tilldela en licens

För att tilldela en licens, kör följande kommando:

PUT  
https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.HybridCompute/licenses/LICENSE_NAME?api-version=2023-06-20-preview 
{  
    "location": "ENTER-REGION",  
    "properties": {  
        "licenseDetails": {  
            "state": "Activated",  
            "target": "Windows Server 2012",  
            "Edition": "Datacenter",  
            "Type": "pCore",  
            "Processors": 12  
        }  
    }  
}
PUT  
https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.HybridCompute/licenses/LICENSE_NAME?api-version=2023-06-20-preview 
{  
    "location": "ENTER-REGION",  
    "properties": {  
        "licenseDetails": {  
            "state": "Activated",  
            "target": "Windows Server 2016",  
            "Edition": "Datacenter",  
            "Type": "pCore",  
            "Processors": 12  
        }  
    }  
}

Parametern --volume-license-details gäller endast för övergången från Volume Licensing-rättigheter för år 1. Den här övergångsperioden har avslutats. Kommandosyntaxen behåller parametern för kompatibilitet med befintlig automatisering:

az connectedmachine license create --license-name
                                   --resource-group
                                   [--edition {Datacenter, Standard}]
                                   [--license-type {ESU}]
                                   [--location]
                                   [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                                   [--processors]
                                   [--state {Activated, Deactivated}]
                                   [--tags]
                                   [--target {Windows Server 2012, Windows Server 2012 R2}]
                                   [--tenant-id]
                                   [--type {pCore, vCore}]
                                   [--volume-license-details]

Övergång från volymlicensiering

Övergången från volymlicensiering stöds inte för Windows Server 2016 ESUs som aktiveras av Azure Arc.

Om du vill länka en licens kör du följande kommando:

PUT  
https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.HybridCompute/machines/MACHINE_NAME/licenseProfiles/default?api-version=2023-06-20-preview 
{
   "location": "SAME_REGION_AS_MACHINE",
   "properties": {
      "esuProfile": {
         "assignedLicense": "RESOURCE_ID_OF_LICENSE"
      }
   }
}

Om du vill ta bort länken till en licens kör du följande kommando:

PUT 
https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.HybridCompute/machines/MACHINE_NAME/licenseProfiles/default?api-version=2023-06-20-preview
{
  "location": "SAME_REGION_AS_MACHINE",
  "properties": {
    "esuProfile": {
    }
  }
}

Ändra en licens

Om du vill ändra en licens kör du följande kommando:

PUT/PATCH 
https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.HybridCompute/licenses/LICENSE_NAME?api-version=2023-06-20-preview 
{  
    "location": "ENTER-REGION",  
    "properties": {  
        "licenseDetails": {  
            "state": "Activated",  
            "target": "Windows Server 2012",  
            "Edition": "Datacenter",  
            "Type": "pCore",  
            "Processors": 12  
        }  
    }  
}
PUT/PATCH 
https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.HybridCompute/licenses/LICENSE_NAME?api-version=2023-06-20-preview 
{  
    "location": "ENTER-REGION",  
    "properties": {  
        "licenseDetails": {  
            "state": "Activated",  
            "target": "Windows Server 2016",  
            "Edition": "Datacenter",  
            "Type": "pCore",  
            "Processors": 12  
        }  
    }  
}

Kör följande kommando för att ta bort en licens:

DELETE  
https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.HybridCompute/licenses/LICENSE_NAME?api-version=2023-06-20-preview