Distribuera och hantera Azure Arc Extended Security Updates-licenser programmatiskt

Den här artikeln innehåller instruktioner för att programmatiskt etablera och hantera livscykelåtgärder för Windows Server utökade säkerhetsuppdateringar via Azure Arc ARM-API:er för ESU. 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, tillstånd, utgåva, typ och processorer beroende på ditt specifika scenario. Ange egenskapen target till det operativsystem som du licensierar:

  • Windows Server 2012
  • Windows Server 2012 R2
  • Windows Server 2016

Anmärkning

Du måste skapa ett huvudnamn för tjänsten för att använda Azure API för att hantera EESU: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  
        }  
    }  
}

Programmässigt kan du använda Azure CLI för att generera nya licenser genom att specificera Volume License Details-parametern i dina rättigheter för Volymlicensering för år 1 genom att ange respektive fakturanummer. Du måste uttryckligen ange faktura-ID (nummer) i licensetablering för Azure Arc:

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.

För att länka en licens, kör 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"
      }
   }
}

För att av länka en licens, kör 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

För att modifiera en licens, utför 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  
        }  
    }  
}

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

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