Skapar eller uppdaterar en agentpool i det angivna hanterade klustret.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}?api-version=2026-06-01
URI-parametrar
| Name |
I |
Obligatorisk |
Typ |
Description |
|
agentPoolName
|
path |
True
|
string
minLength: 1 maxLength: 12 pattern: ^[a-z][a-z0-9]{0,11}$
|
Namnet på agentpoolen.
|
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Namnet på resursgruppen. Namnet är skiftlägesokänsligt.
|
|
resourceName
|
path |
True
|
string
minLength: 1 maxLength: 63 pattern: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$
|
Namnet på den hanterade klusterresursen.
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
ID för målprenumerationen. Värdet måste vara ett UUID.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Den API-version som ska användas för den här åtgärden.
|
| Name |
Obligatorisk |
Typ |
Description |
|
if-match
|
|
string
|
Begäran bör endast fortsätta om en entitet matchar den här strängen.
|
|
if-none-match
|
|
string
|
Begäran bör endast fortsätta om ingen entitet matchar den här strängen.
|
Begärandetext
| Name |
Typ |
Description |
|
properties.artifactStreamingProfile
|
AgentPoolArtifactStreamingProfile
|
Konfiguration för användning av artefaktströmning i AKS.
|
|
properties.availabilityZones
|
string[]
|
Listan över Availability zones som ska användas för noder. Detta kan bara anges om egenskapen AgentPoolType är "VirtualMachineScaleSets".
|
|
properties.capacityReservationGroupID
|
string
(arm-id)
|
Det fullt kvalificerade resurs-ID:t för Capacity Reservation Group för att tillhandahålla virtual machines från en reserverad grupp av Virtual Machines. Detta är av formen: '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Compute/capacityreservationgroups/{capacityReservationGroupName}' Kunder använder det för att skapa en agentpool med en specificerad CRG. För mer information, se Capacity Reservation
|
|
properties.count
|
integer
(int32)
|
Antal agenter (VIRTUELLA datorer) som ska vara värdar för Docker-containrar. Tillåtna värden måste ligga mellan 0 och 1 000 (inklusive) för användarpooler och i intervallet 1 till 1 000 (inklusive) för systempooler. Standardvärdet är 1.
|
|
properties.creationData
|
CreationData
|
CreationData som ska användas för att ange källans ögonblicksbilds-ID om nodpoolen ska skapas/uppgraderas med hjälp av en ögonblicksbild.
|
|
properties.enableAutoScaling
|
boolean
|
Om du vill aktivera automatisk skalning
|
|
properties.enableEncryptionAtHost
|
boolean
|
Om värdbaserad os- och dataenhetskryptering ska aktiveras. Detta stöds endast på vissa VM-storlekar och i vissa Azure-regioner. För ytterligare information, se: https://docs.microsoft.com/azure/aks/enable-host-encryption
|
|
properties.enableFIPS
|
boolean
|
Om du vill använda ett FIPS-aktiverat operativsystem. Se Add a FIPS-aktiverad nodpool för mer information.
|
|
properties.enableNodePublicIP
|
boolean
|
Om varje nod allokeras sin egen offentliga IP-adress. Vissa scenarier kan kräva att noder i en nodpool tar emot sina egna dedikerade offentliga IP-adresser. Ett vanligt scenario är för spelarbetsbelastningar, där en konsol måste upprätta en direktanslutning till en virtuell molndator för att minimera hopp. För mer information, se tilldelning av en publik IP per nod. Standardvärdet är falskt.
|
|
properties.enableUltraSSD
|
boolean
|
Om du vill aktivera UltraSSD
|
|
properties.gatewayProfile
|
AgentPoolGatewayProfile
|
Profil som är specifik för en hanterad agentpool i gatewayläge. Det går inte att ange det här fältet om agentpoolläget inte är gateway.
|
|
properties.gpuInstanceProfile
|
GPUInstanceProfile
|
GPUInstanceProfile som ska användas för att ange GPU MIG-instansprofil för GPU VM SKU som stöds.
|
|
properties.gpuProfile
|
GPUProfile
|
GPU-inställningar för agentpoolen.
|
|
properties.hostGroupID
|
string
(arm-id)
|
Det fullständigt kvalificerade resurs-ID:t för den dedikerade värdgruppen som ska etablera virtuella datorer från, som endast används i skapandescenariot och som inte tillåts ändras en gång. Det här formuläret är: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. För mer information, se Azure dedikerade värdar.
|
|
properties.kubeletConfig
|
KubeletConfig
|
Kubelet-konfigurationen på agentpoolnoderna.
|
|
properties.kubeletDiskType
|
KubeletDiskType
|
Bestämmer placeringen av tomma Dir-volymer, containerruntime-data root och Kubelets ephemeral storage.
|
|
properties.linuxOSConfig
|
LinuxOSConfig
|
Operativsystemets konfiguration av Linux-agentnoder.
|
|
properties.localDNSProfile
|
LocalDNSProfile
|
Konfigurerar den lokala DNS:en per nod med VnetDNS- och KubeDNS-åsidosättningar. LocalDNS hjälper till att förbättra prestanda och tillförlitlighet för DNS-matchning i ett AKS-kluster. Mer information finns i aka.ms/aks/localdns.
|
|
properties.maxCount
|
integer
(int32)
|
Maximalt antal noder för automatisk skalning
|
|
properties.maxPods
|
integer
(int32)
|
Det maximala antalet poddar som kan köras på en nod.
|
|
properties.messageOfTheDay
|
string
|
Dagens meddelande för Linux-noder, base64-kodat. En base64-kodad sträng som skrivs till /etc/motd efter avkodning. Detta möjliggör anpassning av dagens meddelande för Linux-noder. Den får inte anges för Windows noder. Det måste vara en statisk sträng (d.v.s. skrivs ut rå och körs inte som ett skript).
|
|
properties.minCount
|
integer
(int32)
|
Det minsta antalet noder för automatisk skalning
|
|
properties.mode
|
AgentPoolMode
|
Läget för en agentpool. Ett kluster måste ha minst en systemagentpool hela tiden. Mer information om begränsningar och metodtips för agentpooler finns i: https://docs.microsoft.com/azure/aks/use-system-pools
|
|
properties.networkProfile
|
AgentPoolNetworkProfile
|
Nätverksrelaterade inställningar för en agentpool.
|
|
properties.nodeImageVersion
|
string
|
Versionen av nodbilden. Att sätta detta värde utlöser en agentPool-rollback.
Endast värden från recentlyUsedVersions är tillåtna.
|
|
properties.nodeLabels
|
object
|
Nodetiketterna som ska bevaras över alla noder i agentpoolen.
|
|
properties.nodePublicIPPrefixID
|
string
(arm-id)
|
Det offentliga IP-prefix-ID som vm-noder ska använda IP-adresser från. Det här är formuläret: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}
|
|
properties.nodeTaints
|
string[]
|
Tainterna som har lagts till i nya noder när nodpoolen skapas och skalas. Till exempel key=value:NoSchedule.
|
|
properties.orchestratorVersion
|
string
|
Den version av Kubernetes som angetts av användaren. Både korrigeringsversionen <major.minor.patch> (t.ex. 1.20.13) och <major.minor> (t.ex. 1.20) stöds. När <major.minor> har angetts väljs den senaste ga-korrigeringsversionen automatiskt. När klustret uppdateras med samma <major.minor> när det har skapats (t.ex. 1.14.x–> 1.14) utlöses inte en uppgradering, även om en nyare korrigeringsversion är tillgänglig. Vi rekommenderar att du uppgraderar alla nodpooler i ett AKS-kluster till samma Kubernetes-version. Nodpoolversionen måste ha samma huvudversion som kontrollplanet. Delversionen av nodpoolen måste ligga inom två delversioner av kontrollplanets version. Nodpoolversionen får inte vara större än kontrollplanets version. För mer information, se upgrading a node pool.
|
|
properties.osDiskSizeGB
|
integer
(int32)
minimum: 0 maximum: 2048
|
Operativsystemets diskstorlek i GB som ska användas för att ange diskstorleken för varje dator i huvud-/agentpoolen. Om du anger 0 tillämpas standardstorleken för osDisk enligt den angivna vmSize-storleken.
|
|
properties.osDiskType
|
OSDiskType
|
Den operativsystemdisktyp som ska användas för datorer i agentpoolen. Standardvärdet är "Tillfällig" om den virtuella datorn stöder den och har en cachedisk som är större än den begärda OSDiskSizeGB. Annars är standardvärdet "Hanterad". Kan inte ändras när du har skapat. För mer information, se Ephemeral OS.
|
|
properties.osSKU
|
OSSKU
|
Anger os-SKU:n som används av agentpoolen. Standardvärdet är Ubuntu om OSType är Linux. Standardvärdet är Windows2019 när Kubernetes <= 1.24 eller Windows2022 när Kubernetes >= 1.25 om OSType är Windows.
|
|
properties.osType
|
OSType
|
Typ av operativsystem. Standardvärdet är Linux.
|
|
properties.podIPAllocationMode
|
PodIPAllocationMode
|
Läge för IP-allokering av poddar. IP-allokeringsläget för poddar i agentpoolen. Måste användas med podSubnetId. Standardvärdet är "DynamicIndividual".
|
|
properties.podSubnetID
|
string
(arm-id)
|
ID för det undernät som poddar ansluter till när de startas. Om detta utelämnas tilldelas podd-IP-adresser statiskt i nodundernätet (mer information finns i vnetSubnetID). Detta är i formuläret : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
|
|
properties.powerState
|
PowerState
|
Om agentpoolen körs eller stoppas. När en agentpool först skapas körs den först. Agentpoolen kan stoppas genom att ställa in fältet på Stoppad. En stoppad agentpool stoppar alla sina virtuella datorer och ackumulerar inte faktureringsavgifter. En agentpool kan bara stoppas om den körs och etableringstillståndet har slutförts
|
|
properties.proximityPlacementGroupID
|
string
(arm-id)
|
ID för närhetsplaceringsgrupp.
|
|
properties.scaleDownMode
|
ScaleDownMode
|
Nedskalningsläget som ska användas vid skalning av agentpoolen. Detta påverkar även autoskalningsbeteendet för klustret. Om det inte anges är standardinställningen Ta bort.
|
|
properties.scaleSetEvictionPolicy
|
ScaleSetEvictionPolicy
|
Borttagningsprincipen för VM-skalningsuppsättningen. Vräkningspolicyn specificerar vad som to do med VM:n när den vräkas. Standardvärdet är Ta bort. För mer information om vräkning, se spot VMs
|
|
properties.scaleSetPriority
|
ScaleSetPriority
|
Prioritet för VM-skalningsuppsättning.
|
|
properties.securityProfile
|
AgentPoolSecurityProfile
|
Säkerhetsinställningarna för en agentpool.
|
|
properties.spotMaxPrice
|
number
(float)
|
Det högsta priset (i us-dollar) som du är villig att betala för spot-instanser. Möjliga värden är ett decimalvärde som är större än noll eller -1 vilket anger att standardpriset är up-to på begäran. Möjliga värden är ett decimalvärde som är större än noll eller -1 vilket indikerar viljan att betala ett pris på begäran. För mer information om spotprissättning, se spot VMs prissättning
|
|
properties.status
|
AgentPoolStatus
|
Innehåller skrivskyddad information om agentpoolen.
|
|
properties.tags
|
object
|
Taggarna som ska sparas på vm-skalningsuppsättningen för agentpoolen.
|
|
properties.type
|
AgentPoolType
|
Typ av agentpool.
|
|
properties.upgradeSettings
|
AgentPoolUpgradeSettings
|
Inställningar för att uppgradera agentpoolen
|
|
properties.virtualMachineNodesStatus
|
VirtualMachineNodes[]
|
Status för noder i en VirtualMachines-agentpool.
|
|
properties.virtualMachinesProfile
|
VirtualMachinesProfile
|
Specifikationer för VirtualMachines-agentpoolen.
|
|
properties.vmSize
|
string
|
Storleken på de virtuella datorerna i agentpoolen. Tillgängligheten för VM-storlek varierar beroende på region. Om en nod innehåller otillräckliga beräkningsresurser (minne, processor osv.) kan poddar inte köras korrekt. Mer information om begränsade VM-storlekar finns i: https://docs.microsoft.com/azure/aks/quotas-skus-regions
|
|
properties.vnetSubnetID
|
string
(arm-id)
|
ID:t för undernätet som agentpoolnoder och eventuellt poddar ansluter till vid start. Om detta inte anges genereras och används ett VNET och undernät. Om inget podSubnetID har angetts gäller detta för noder och poddar, annars gäller det bara för noder. Detta är i formuläret : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
|
|
properties.windowsProfile
|
AgentPoolWindowsProfile
|
Windows-agentpoolens specifika profil.
|
|
properties.workloadRuntime
|
WorkloadRuntime
|
Avgör vilken typ av arbetsbelastning en nod kan köra.
|
Svar
| Name |
Typ |
Description |
|
200 OK
|
AgentPool
|
Uppdateringsåtgärden för resursen "AgentPool" lyckades
|
|
201 Created
|
AgentPool
|
Resursen "AgentPool" har skapats
Sidhuvuden
- Azure-AsyncOperation: string
- Retry-After: integer
|
|
Other Status Codes
|
ErrorResponse
|
Ett oväntat felsvar.
|
Säkerhet
azure_auth
Azure Active Directory OAuth2-flöde.
Typ:
oauth2
Flow:
implicit
Auktoriseringswebbadress:
https://login.microsoftonline.com/common/oauth2/authorize
Omfattningar
| Name |
Description |
|
user_impersonation
|
personifiera ditt användarkonto
|
Exempel
Create Agent Pool using an agent pool snapshot
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"creationData": {
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"
},
"enableFIPS": true,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.CreationData;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_Snapshot.json
*/
/**
* Sample code: Create Agent Pool using an agent pool snapshot.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createAgentPoolUsingAnAgentPoolSnapshot(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1", new AgentPoolInner()
.withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX).withOrchestratorVersion("")
.withEnableFips(true)
.withCreationData(new CreationData().withSourceResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1")),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_snapshot.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"creationData": {
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"
},
"enableFIPS": True,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_Snapshot.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_Snapshot.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolUsingAnAgentPoolSnapshot() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
CreationData: &armcontainerservice.CreationData{
SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"),
},
EnableFIPS: to.Ptr(true),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CreationData: &armcontainerservice.CreationData{
// SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"),
// },
// CurrentOrchestratorVersion: to.Ptr("1.19.6"),
// EnableFIPS: to.Ptr(true),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.19.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_Snapshot.json
*/
async function createAgentPoolUsingAnAgentPoolSnapshot() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
creationData: {
sourceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1",
},
enableFips: true,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"creationData": {
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"
},
"currentOrchestratorVersion": "1.19.6",
"enableFIPS": true,
"maxPods": 110,
"orchestratorVersion": "1.19.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"creationData": {
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"
},
"currentOrchestratorVersion": "1.19.6",
"enableFIPS": true,
"maxPods": 110,
"orchestratorVersion": "1.19.6",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with Capacity Reservation Group
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"capacityReservationGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1",
"count": 3,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_CRG.json
*/
/**
* Sample code: Create Agent Pool with Capacity Reservation Group.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createAgentPoolWithCapacityReservationGroup(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1", new AgentPoolInner()
.withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX).withOrchestratorVersion("")
.withCapacityReservationGroupId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_crg.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"capacityReservationGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1",
"count": 3,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_CRG.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_CRG.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithCapacityReservationGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
CapacityReservationGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"),
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// CapacityReservationGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"),
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_CRG.json
*/
async function createAgentPoolWithCapacityReservationGroup() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
capacityReservationGroupID:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1",
count: 3,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"capacityReservationGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1",
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"capacityReservationGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1",
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with Dedicated Host Group
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"hostGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1",
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_DedicatedHostGroup.json
*/
/**
* Sample code: Create Agent Pool with Dedicated Host Group.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createAgentPoolWithDedicatedHostGroup(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1", new AgentPoolInner()
.withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX).withOrchestratorVersion("")
.withHostGroupId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_dedicated_host_group.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"hostGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1",
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_DedicatedHostGroup.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_DedicatedHostGroup.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithDedicatedHostGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
HostGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// HostGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.19.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_DedicatedHostGroup.json
*/
async function createAgentPoolWithDedicatedHostGroup() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
hostGroupID:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1",
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"hostGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1",
"maxPods": 110,
"orchestratorVersion": "1.19.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"hostGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1",
"maxPods": 110,
"orchestratorVersion": "1.19.6",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with EncryptionAtHost enabled
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"enableEncryptionAtHost": true,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableEncryptionAtHost.json
*/
/**
* Sample code: Create Agent Pool with EncryptionAtHost enabled.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createAgentPoolWithEncryptionAtHostEnabled(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX)
.withOrchestratorVersion("").withEnableEncryptionAtHost(true),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_enable_encryption_at_host.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"enableEncryptionAtHost": True,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableEncryptionAtHost.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_EnableEncryptionAtHost.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEncryptionAtHostEnabled() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
EnableEncryptionAtHost: to.Ptr(true),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.13"),
// EnableEncryptionAtHost: to.Ptr(true),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.13"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableEncryptionAtHost.json
*/
async function createAgentPoolWithEncryptionAtHostEnabled() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
enableEncryptionAtHost: true,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.13",
"enableEncryptionAtHost": true,
"maxPods": 110,
"orchestratorVersion": "1.17.13",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.13",
"enableEncryptionAtHost": true,
"maxPods": 110,
"orchestratorVersion": "1.17.13",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with Ephemeral OS Disk
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"orchestratorVersion": "",
"osDiskSizeGB": 64,
"osDiskType": "Ephemeral",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSDiskType;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_Ephemeral.json
*/
/**
* Sample code: Create Agent Pool with Ephemeral OS Disk.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createAgentPoolWithEphemeralOSDisk(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsDiskSizeGB(64)
.withOsDiskType(OSDiskType.EPHEMERAL).withOsType(OSType.LINUX).withOrchestratorVersion(""),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_ephemeral.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"orchestratorVersion": "",
"osDiskSizeGB": 64,
"osDiskType": "Ephemeral",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_Ephemeral.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_Ephemeral.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEphemeralOSDisk() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr(""),
OSDiskSizeGB: to.Ptr[int32](64),
OSDiskType: to.Ptr(armcontainerservice.OSDiskTypeEphemeral),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSDiskSizeGB: to.Ptr[int32](64),
// OSDiskType: to.Ptr(armcontainerservice.OSDiskTypeEphemeral),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_Ephemeral.json
*/
async function createAgentPoolWithEphemeralOSDisk() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
orchestratorVersion: "",
osDiskSizeGB: 64,
osDiskType: "Ephemeral",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"maxPods": 110,
"orchestratorVersion": "1.17.8",
"osDiskSizeGB": 64,
"osDiskType": "Ephemeral",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"kubeletDiskType": "OS",
"maxPods": 110,
"orchestratorVersion": "1.17.8",
"osDiskSizeGB": 64,
"osDiskType": "Ephemeral",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with FIPS enabled OS
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"enableFIPS": true,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableFIPS.json
*/
/**
* Sample code: Create Agent Pool with FIPS enabled OS.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createAgentPoolWithFIPSEnabledOS(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate(
"rg1", "clustername1", "agentpool1", new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2")
.withOsType(OSType.LINUX).withOrchestratorVersion("").withEnableFips(true),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_enable_fips.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"enableFIPS": True,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableFIPS.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_EnableFIPS.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithFipsEnabledOS() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
EnableFIPS: to.Ptr(true),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.19.6"),
// EnableFIPS: to.Ptr(true),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.19.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableFIPS.json
*/
async function createAgentPoolWithFipsEnabledOS() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
enableFips: true,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.19.6",
"enableFIPS": true,
"maxPods": 110,
"orchestratorVersion": "1.19.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.19.6",
"enableFIPS": true,
"maxPods": 110,
"orchestratorVersion": "1.19.6",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with GPUMIG
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"gpuInstanceProfile": "MIG2g",
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_ND96asr_v4"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.GpuInstanceProfile;
import com.azure.resourcemanager.containerservice.models.KubeletConfig;
import com.azure.resourcemanager.containerservice.models.LinuxOSConfig;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.SysctlConfig;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_GPUMIG.json
*/
/**
* Sample code: Create Agent Pool with GPUMIG.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createAgentPoolWithGPUMIG(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_ND96asr_v4").withOsType(OSType.LINUX)
.withOrchestratorVersion("")
.withKubeletConfig(new KubeletConfig().withCpuManagerPolicy("static").withCpuCfsQuota(true)
.withCpuCfsQuotaPeriod("200ms").withImageGcHighThreshold(90).withImageGcLowThreshold(70)
.withTopologyManagerPolicy("best-effort")
.withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")).withFailSwapOn(false))
.withLinuxOSConfig(new LinuxOSConfig()
.withSysctls(new SysctlConfig().withNetCoreWmemDefault(12345).withNetIpv4TcpTwReuse(true)
.withNetIpv4IpLocalPortRange("20000 60000").withKernelThreadsMax(99999))
.withTransparentHugePageEnabled("always").withTransparentHugePageDefrag("madvise")
.withSwapFileSizeMB(1500))
.withGpuInstanceProfile(GpuInstanceProfile.MIG2G),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_gpumig.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"gpuInstanceProfile": "MIG2g",
"kubeletConfig": {
"allowedUnsafeSysctls": ["kernel.msg*", "net.core.somaxconn"],
"cpuCfsQuota": True,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": False,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": True,
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always",
},
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_ND96asr_v4",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_GPUMIG.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_GPUMIG.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithGpumig() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
GpuInstanceProfile: to.Ptr(armcontainerservice.GPUInstanceProfileMIG2G),
KubeletConfig: &armcontainerservice.KubeletConfig{
AllowedUnsafeSysctls: []*string{
to.Ptr("kernel.msg*"),
to.Ptr("net.core.somaxconn"),
},
CPUCfsQuota: to.Ptr(true),
CPUCfsQuotaPeriod: to.Ptr("200ms"),
CPUManagerPolicy: to.Ptr("static"),
FailSwapOn: to.Ptr(false),
ImageGcHighThreshold: to.Ptr[int32](90),
ImageGcLowThreshold: to.Ptr[int32](70),
TopologyManagerPolicy: to.Ptr("best-effort"),
},
LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
SwapFileSizeMB: to.Ptr[int32](1500),
Sysctls: &armcontainerservice.SysctlConfig{
KernelThreadsMax: to.Ptr[int32](99999),
NetCoreWmemDefault: to.Ptr[int32](12345),
NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
NetIPv4TCPTwReuse: to.Ptr(true),
},
TransparentHugePageDefrag: to.Ptr("madvise"),
TransparentHugePageEnabled: to.Ptr("always"),
},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_ND96asr_v4"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// GpuInstanceProfile: to.Ptr(armcontainerservice.GPUInstanceProfileMIG2G),
// KubeletConfig: &armcontainerservice.KubeletConfig{
// AllowedUnsafeSysctls: []*string{
// to.Ptr("kernel.msg*"),
// to.Ptr("net.core.somaxconn"),
// },
// CPUCfsQuota: to.Ptr(true),
// CPUCfsQuotaPeriod: to.Ptr("200ms"),
// CPUManagerPolicy: to.Ptr("static"),
// FailSwapOn: to.Ptr(false),
// ImageGcHighThreshold: to.Ptr[int32](90),
// ImageGcLowThreshold: to.Ptr[int32](70),
// TopologyManagerPolicy: to.Ptr("best-effort"),
// },
// LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
// SwapFileSizeMB: to.Ptr[int32](1500),
// Sysctls: &armcontainerservice.SysctlConfig{
// KernelThreadsMax: to.Ptr[int32](99999),
// NetCoreWmemDefault: to.Ptr[int32](12345),
// NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
// NetIPv4TCPTwReuse: to.Ptr(true),
// },
// TransparentHugePageDefrag: to.Ptr("madvise"),
// TransparentHugePageEnabled: to.Ptr("always"),
// },
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_ND96asr_v4"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_GPUMIG.json
*/
async function createAgentPoolWithGpumig() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
gpuInstanceProfile: "MIG2g",
kubeletConfig: {
allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"],
cpuCfsQuota: true,
cpuCfsQuotaPeriod: "200ms",
cpuManagerPolicy: "static",
failSwapOn: false,
imageGcHighThreshold: 90,
imageGcLowThreshold: 70,
topologyManagerPolicy: "best-effort",
},
linuxOSConfig: {
swapFileSizeMB: 1500,
sysctls: {
kernelThreadsMax: 99999,
netCoreWmemDefault: 12345,
netIpv4IpLocalPortRange: "20000 60000",
netIpv4TcpTwReuse: true,
},
transparentHugePageDefrag: "madvise",
transparentHugePageEnabled: "always",
},
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_ND96asr_v4",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"gpuInstanceProfile": "MIG2g",
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"maxPods": 110,
"orchestratorVersion": "1.17.8",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_ND96asr_v4"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"gpuInstanceProfile": "MIG2g",
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"podMaxPids": 100,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 65536,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"maxPods": 110,
"orchestratorVersion": "1.17.8",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_ND96asr_v4"
}
}
Create Agent Pool with Krustlet and the WASI runtime
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"mode": "User",
"orchestratorVersion": "",
"osDiskSizeGB": 64,
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
"workloadRuntime": "WasmWasi"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolMode;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.WorkloadRuntime;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_WasmWasi.json
*/
/**
* Sample code: Create Agent Pool with Krustlet and the WASI runtime.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createAgentPoolWithKrustletAndTheWASIRuntime(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsDiskSizeGB(64)
.withWorkloadRuntime(WorkloadRuntime.WASM_WASI).withOsType(OSType.LINUX).withMode(AgentPoolMode.USER)
.withOrchestratorVersion(""),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_wasm_wasi.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"mode": "User",
"orchestratorVersion": "",
"osDiskSizeGB": 64,
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
"workloadRuntime": "WasmWasi",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_WasmWasi.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_WasmWasi.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKrustletAndTheWasiRuntime() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
OrchestratorVersion: to.Ptr(""),
OSDiskSizeGB: to.Ptr[int32](64),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
WorkloadRuntime: to.Ptr(armcontainerservice.WorkloadRuntimeWasmWasi),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// MaxPods: to.Ptr[int32](110),
// Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSDiskSizeGB: to.Ptr[int32](64),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// WorkloadRuntime: to.Ptr(armcontainerservice.WorkloadRuntimeWasmWasi),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_WasmWasi.json
*/
async function createAgentPoolWithKrustletAndTheWasiRuntime() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
mode: "User",
orchestratorVersion: "",
osDiskSizeGB: 64,
osType: "Linux",
vmSize: "Standard_DS2_v2",
workloadRuntime: "WasmWasi",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"maxPods": 110,
"mode": "User",
"orchestratorVersion": "1.17.8",
"osDiskSizeGB": 64,
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2",
"workloadRuntime": "WasmWasi"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"maxPods": 110,
"mode": "User",
"orchestratorVersion": "1.17.8",
"osDiskSizeGB": 64,
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2",
"workloadRuntime": "WasmWasi"
}
}
Create Agent Pool with KubeletConfig and LinuxOSConfig
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.KubeletConfig;
import com.azure.resourcemanager.containerservice.models.LinuxOSConfig;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.SysctlConfig;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_CustomNodeConfig.json
*/
/**
* Sample code: Create Agent Pool with KubeletConfig and LinuxOSConfig.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createAgentPoolWithKubeletConfigAndLinuxOSConfig(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX)
.withOrchestratorVersion("")
.withKubeletConfig(new KubeletConfig().withCpuManagerPolicy("static").withCpuCfsQuota(true)
.withCpuCfsQuotaPeriod("200ms").withImageGcHighThreshold(90).withImageGcLowThreshold(70)
.withTopologyManagerPolicy("best-effort")
.withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")).withFailSwapOn(false))
.withLinuxOSConfig(new LinuxOSConfig()
.withSysctls(new SysctlConfig().withNetCoreWmemDefault(12345).withNetIpv4TcpTwReuse(true)
.withNetIpv4IpLocalPortRange("20000 60000").withKernelThreadsMax(99999))
.withTransparentHugePageEnabled("always").withTransparentHugePageDefrag("madvise")
.withSwapFileSizeMB(1500)),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_custom_node_config.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"kubeletConfig": {
"allowedUnsafeSysctls": ["kernel.msg*", "net.core.somaxconn"],
"cpuCfsQuota": True,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": False,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": True,
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always",
},
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_CustomNodeConfig.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_CustomNodeConfig.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKubeletConfigAndLinuxOSConfig() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
KubeletConfig: &armcontainerservice.KubeletConfig{
AllowedUnsafeSysctls: []*string{
to.Ptr("kernel.msg*"),
to.Ptr("net.core.somaxconn"),
},
CPUCfsQuota: to.Ptr(true),
CPUCfsQuotaPeriod: to.Ptr("200ms"),
CPUManagerPolicy: to.Ptr("static"),
FailSwapOn: to.Ptr(false),
ImageGcHighThreshold: to.Ptr[int32](90),
ImageGcLowThreshold: to.Ptr[int32](70),
TopologyManagerPolicy: to.Ptr("best-effort"),
},
LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
SwapFileSizeMB: to.Ptr[int32](1500),
Sysctls: &armcontainerservice.SysctlConfig{
KernelThreadsMax: to.Ptr[int32](99999),
NetCoreWmemDefault: to.Ptr[int32](12345),
NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
NetIPv4TCPTwReuse: to.Ptr(true),
},
TransparentHugePageDefrag: to.Ptr("madvise"),
TransparentHugePageEnabled: to.Ptr("always"),
},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// KubeletConfig: &armcontainerservice.KubeletConfig{
// AllowedUnsafeSysctls: []*string{
// to.Ptr("kernel.msg*"),
// to.Ptr("net.core.somaxconn"),
// },
// CPUCfsQuota: to.Ptr(true),
// CPUCfsQuotaPeriod: to.Ptr("200ms"),
// CPUManagerPolicy: to.Ptr("static"),
// FailSwapOn: to.Ptr(false),
// ImageGcHighThreshold: to.Ptr[int32](90),
// ImageGcLowThreshold: to.Ptr[int32](70),
// TopologyManagerPolicy: to.Ptr("best-effort"),
// },
// LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
// SwapFileSizeMB: to.Ptr[int32](1500),
// Sysctls: &armcontainerservice.SysctlConfig{
// KernelThreadsMax: to.Ptr[int32](99999),
// NetCoreWmemDefault: to.Ptr[int32](12345),
// NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
// NetIPv4TCPTwReuse: to.Ptr(true),
// },
// TransparentHugePageDefrag: to.Ptr("madvise"),
// TransparentHugePageEnabled: to.Ptr("always"),
// },
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_CustomNodeConfig.json
*/
async function createAgentPoolWithKubeletConfigAndLinuxOSConfig() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
kubeletConfig: {
allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"],
cpuCfsQuota: true,
cpuCfsQuotaPeriod: "200ms",
cpuManagerPolicy: "static",
failSwapOn: false,
imageGcHighThreshold: 90,
imageGcLowThreshold: 70,
topologyManagerPolicy: "best-effort",
},
linuxOSConfig: {
swapFileSizeMB: 1500,
sysctls: {
kernelThreadsMax: 99999,
netCoreWmemDefault: 12345,
netIpv4IpLocalPortRange: "20000 60000",
netIpv4TcpTwReuse: true,
},
transparentHugePageDefrag: "madvise",
transparentHugePageEnabled: "always",
},
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"maxPods": 110,
"orchestratorVersion": "1.17.8",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"podMaxPids": 100,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 65536,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"maxPods": 110,
"orchestratorVersion": "1.17.8",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with Message of the Day
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"messageOfTheDay": "Zm9vCg==",
"mode": "User",
"orchestratorVersion": "",
"osDiskSizeGB": 64,
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolMode;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_MessageOfTheDay.json
*/
/**
* Sample code: Create Agent Pool with Message of the Day.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createAgentPoolWithMessageOfTheDay(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsDiskSizeGB(64)
.withMessageOfTheDay("Zm9vCg==").withOsType(OSType.LINUX).withMode(AgentPoolMode.USER)
.withOrchestratorVersion(""),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_message_of_the_day.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"messageOfTheDay": "Zm9vCg==",
"mode": "User",
"orchestratorVersion": "",
"osDiskSizeGB": 64,
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_MessageOfTheDay.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_MessageOfTheDay.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithMessageOfTheDay() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
MessageOfTheDay: to.Ptr("Zm9vCg=="),
Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
OrchestratorVersion: to.Ptr(""),
OSDiskSizeGB: to.Ptr[int32](64),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// MaxPods: to.Ptr[int32](110),
// MessageOfTheDay: to.Ptr("Zm9vCg=="),
// Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSDiskSizeGB: to.Ptr[int32](64),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_MessageOfTheDay.json
*/
async function createAgentPoolWithMessageOfTheDay() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
messageOfTheDay: "Zm9vCg==",
mode: "User",
orchestratorVersion: "",
osDiskSizeGB: 64,
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"maxPods": 110,
"messageOfTheDay": "Zm9vCg==",
"mode": "User",
"orchestratorVersion": "1.17.8",
"osDiskSizeGB": 64,
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"maxPods": 110,
"messageOfTheDay": "Zm9vCg==",
"mode": "User",
"orchestratorVersion": "1.17.8",
"osDiskSizeGB": 64,
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with OSSKU
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"orchestratorVersion": "",
"osSKU": "AzureLinux",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.KubeletConfig;
import com.azure.resourcemanager.containerservice.models.LinuxOSConfig;
import com.azure.resourcemanager.containerservice.models.OSSku;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.SysctlConfig;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_OSSKU.json
*/
/**
* Sample code: Create Agent Pool with OSSKU.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createAgentPoolWithOSSKU(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX)
.withOsSku(OSSku.AZURE_LINUX).withOrchestratorVersion("")
.withKubeletConfig(new KubeletConfig().withCpuManagerPolicy("static").withCpuCfsQuota(true)
.withCpuCfsQuotaPeriod("200ms").withImageGcHighThreshold(90).withImageGcLowThreshold(70)
.withTopologyManagerPolicy("best-effort")
.withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")).withFailSwapOn(false))
.withLinuxOSConfig(new LinuxOSConfig()
.withSysctls(new SysctlConfig().withNetCoreWmemDefault(12345).withNetIpv4TcpTwReuse(true)
.withNetIpv4IpLocalPortRange("20000 60000").withKernelThreadsMax(99999))
.withTransparentHugePageEnabled("always").withTransparentHugePageDefrag("madvise")
.withSwapFileSizeMB(1500)),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_ossku.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"kubeletConfig": {
"allowedUnsafeSysctls": ["kernel.msg*", "net.core.somaxconn"],
"cpuCfsQuota": True,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": False,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": True,
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always",
},
"orchestratorVersion": "",
"osSKU": "AzureLinux",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_OSSKU.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_OSSKU.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithOssku() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
KubeletConfig: &armcontainerservice.KubeletConfig{
AllowedUnsafeSysctls: []*string{
to.Ptr("kernel.msg*"),
to.Ptr("net.core.somaxconn"),
},
CPUCfsQuota: to.Ptr(true),
CPUCfsQuotaPeriod: to.Ptr("200ms"),
CPUManagerPolicy: to.Ptr("static"),
FailSwapOn: to.Ptr(false),
ImageGcHighThreshold: to.Ptr[int32](90),
ImageGcLowThreshold: to.Ptr[int32](70),
TopologyManagerPolicy: to.Ptr("best-effort"),
},
LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
SwapFileSizeMB: to.Ptr[int32](1500),
Sysctls: &armcontainerservice.SysctlConfig{
KernelThreadsMax: to.Ptr[int32](99999),
NetCoreWmemDefault: to.Ptr[int32](12345),
NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
NetIPv4TCPTwReuse: to.Ptr(true),
},
TransparentHugePageDefrag: to.Ptr("madvise"),
TransparentHugePageEnabled: to.Ptr("always"),
},
OrchestratorVersion: to.Ptr(""),
OSSKU: to.Ptr(armcontainerservice.OSSKUAzureLinux),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// KubeletConfig: &armcontainerservice.KubeletConfig{
// AllowedUnsafeSysctls: []*string{
// to.Ptr("kernel.msg*"),
// to.Ptr("net.core.somaxconn"),
// },
// CPUCfsQuota: to.Ptr(true),
// CPUCfsQuotaPeriod: to.Ptr("200ms"),
// CPUManagerPolicy: to.Ptr("static"),
// FailSwapOn: to.Ptr(false),
// ImageGcHighThreshold: to.Ptr[int32](90),
// ImageGcLowThreshold: to.Ptr[int32](70),
// TopologyManagerPolicy: to.Ptr("best-effort"),
// },
// LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
// SwapFileSizeMB: to.Ptr[int32](1500),
// Sysctls: &armcontainerservice.SysctlConfig{
// KernelThreadsMax: to.Ptr[int32](99999),
// NetCoreWmemDefault: to.Ptr[int32](12345),
// NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
// NetIPv4TCPTwReuse: to.Ptr(true),
// },
// TransparentHugePageDefrag: to.Ptr("madvise"),
// TransparentHugePageEnabled: to.Ptr("always"),
// },
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSSKU: to.Ptr(armcontainerservice.OSSKUAzureLinux),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_OSSKU.json
*/
async function createAgentPoolWithOssku() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
kubeletConfig: {
allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"],
cpuCfsQuota: true,
cpuCfsQuotaPeriod: "200ms",
cpuManagerPolicy: "static",
failSwapOn: false,
imageGcHighThreshold: 90,
imageGcLowThreshold: 70,
topologyManagerPolicy: "best-effort",
},
linuxOSConfig: {
swapFileSizeMB: 1500,
sysctls: {
kernelThreadsMax: 99999,
netCoreWmemDefault: 12345,
netIpv4IpLocalPortRange: "20000 60000",
netIpv4TcpTwReuse: true,
},
transparentHugePageDefrag: "madvise",
transparentHugePageEnabled: "always",
},
orchestratorVersion: "",
osSKU: "AzureLinux",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"maxPods": 110,
"orchestratorVersion": "1.17.8",
"osSKU": "AzureLinux",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.8",
"kubeletConfig": {
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": false,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"podMaxPids": 100,
"topologyManagerPolicy": "best-effort"
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 65536,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": true
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always"
},
"maxPods": 110,
"orchestratorVersion": "1.17.8",
"osSKU": "AzureLinux",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with PPG
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"orchestratorVersion": "",
"osType": "Linux",
"proximityPlacementGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_PPG.json
*/
/**
* Sample code: Create Agent Pool with PPG.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createAgentPoolWithPPG(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1", new AgentPoolInner()
.withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX).withOrchestratorVersion("")
.withProximityPlacementGroupId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_ppg.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"orchestratorVersion": "",
"osType": "Linux",
"proximityPlacementGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_PPG.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_PPG.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithPpg() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
ProximityPlacementGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// ProximityPlacementGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_PPG.json
*/
async function createAgentPoolWithPPG() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
orchestratorVersion: "",
osType: "Linux",
proximityPlacementGroupID:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"proximityPlacementGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Creating",
"proximityPlacementGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with UltraSSD enabled
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"enableUltraSSD": true,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableUltraSSD.json
*/
/**
* Sample code: Create Agent Pool with UltraSSD enabled.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createAgentPoolWithUltraSSDEnabled(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate(
"rg1", "clustername1", "agentpool1", new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2")
.withOsType(OSType.LINUX).withOrchestratorVersion("").withEnableUltraSsd(true),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_enable_ultra_ssd.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"enableUltraSSD": True,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableUltraSSD.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_EnableUltraSSD.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithUltraSsdEnabled() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
EnableUltraSSD: to.Ptr(true),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.13"),
// EnableUltraSSD: to.Ptr(true),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.13"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_EnableUltraSSD.json
*/
async function createAgentPoolWithUltraSSDEnabled() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
enableUltraSSD: true,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.13",
"enableUltraSSD": true,
"maxPods": 110,
"orchestratorVersion": "1.17.13",
"osType": "Linux",
"provisioningState": "Succeeded",
"vmSize": "Standard_DS2_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.17.13",
"enableUltraSSD": true,
"maxPods": 110,
"orchestratorVersion": "1.17.13",
"osType": "Linux",
"provisioningState": "Creating",
"vmSize": "Standard_DS2_v2"
}
}
Create Agent Pool with VirtualMachines pool type
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"type": "VirtualMachines",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"tags": {
"name1": "val1"
},
"virtualMachinesProfile": {
"scale": {
"manual": [
{
"count": 3,
"size": "Standard_D2_v2"
},
{
"count": 2,
"size": "Standard_D2_v3"
}
]
}
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolType;
import com.azure.resourcemanager.containerservice.models.ManualScaleProfile;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.ScaleProfile;
import com.azure.resourcemanager.containerservice.models.VirtualMachinesProfile;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_TypeVirtualMachines.json
*/
/**
* Sample code: Create Agent Pool with VirtualMachines pool type.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createAgentPoolWithVirtualMachinesPoolType(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withOsType(OSType.LINUX).withTypePropertiesType(AgentPoolType.VIRTUAL_MACHINES)
.withOrchestratorVersion("1.9.6").withTags(mapOf("name1", "val1"))
.withNodeLabels(mapOf("key1", "fakeTokenPlaceholder"))
.withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule"))
.withVirtualMachinesProfile(new VirtualMachinesProfile().withScale(new ScaleProfile()
.withManual(Arrays.asList(new ManualScaleProfile().withSize("Standard_D2_v2").withCount(3),
new ManualScaleProfile().withSize("Standard_D2_v3").withCount(2))))),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_type_virtual_machines.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"nodeLabels": {"key1": "val1"},
"nodeTaints": ["Key1=Value1:NoSchedule"],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"tags": {"name1": "val1"},
"type": "VirtualMachines",
"virtualMachinesProfile": {
"scale": {
"manual": [{"count": 3, "size": "Standard_D2_v2"}, {"count": 2, "size": "Standard_D2_v3"}]
}
},
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_TypeVirtualMachines.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_TypeVirtualMachines.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithVirtualMachinesPoolType() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachines),
NodeLabels: map[string]*string{
"key1": to.Ptr("val1"),
},
NodeTaints: []*string{
to.Ptr("Key1=Value1:NoSchedule"),
},
OrchestratorVersion: to.Ptr("1.9.6"),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
Tags: map[string]*string{
"name1": to.Ptr("val1"),
},
VirtualMachinesProfile: &armcontainerservice.VirtualMachinesProfile{
Scale: &armcontainerservice.ScaleProfile{
Manual: []*armcontainerservice.ManualScaleProfile{
{
Count: to.Ptr[int32](3),
Size: to.Ptr("Standard_D2_v2"),
},
{
Count: to.Ptr[int32](2),
Size: to.Ptr("Standard_D2_v3"),
},
},
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachines),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// NodeImageVersion: to.Ptr("AKSUbuntu-1804gen2containerd-2021.09.11"),
// NodeLabels: map[string]*string{
// "key1": to.Ptr("val1"),
// },
// NodeTaints: []*string{
// to.Ptr("Key1=Value1:NoSchedule"),
// },
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// Tags: map[string]*string{
// "name1": to.Ptr("val1"),
// },
// VirtualMachineNodesStatus: []*armcontainerservice.VirtualMachineNodes{
// {
// Count: to.Ptr[int32](3),
// Size: to.Ptr("Standard_D2_v2"),
// },
// {
// Count: to.Ptr[int32](2),
// Size: to.Ptr("Standard_D2_v3"),
// },
// },
// VirtualMachinesProfile: &armcontainerservice.VirtualMachinesProfile{
// Scale: &armcontainerservice.ScaleProfile{
// Manual: []*armcontainerservice.ManualScaleProfile{
// {
// Count: to.Ptr[int32](3),
// Size: to.Ptr("Standard_D2_v2"),
// },
// {
// Count: to.Ptr[int32](2),
// Size: to.Ptr("Standard_D2_v3"),
// },
// },
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_TypeVirtualMachines.json
*/
async function createAgentPoolWithVirtualMachinesPoolType() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
typePropertiesType: "VirtualMachines",
nodeLabels: { key1: "val1" },
nodeTaints: ["Key1=Value1:NoSchedule"],
orchestratorVersion: "1.9.6",
osType: "Linux",
tags: { name1: "val1" },
virtualMachinesProfile: {
scale: {
manual: [
{ count: 3, size: "Standard_D2_v2" },
{ count: 2, size: "Standard_D2_v3" },
],
},
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"type": "VirtualMachines",
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"nodeImageVersion": "AKSUbuntu-1804gen2containerd-2021.09.11",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"tags": {
"name1": "val1"
},
"virtualMachineNodesStatus": [
{
"count": 3,
"size": "Standard_D2_v2"
},
{
"count": 2,
"size": "Standard_D2_v3"
}
],
"virtualMachinesProfile": {
"scale": {
"manual": [
{
"count": 3,
"size": "Standard_D2_v2"
},
{
"count": 2,
"size": "Standard_D2_v3"
}
]
}
}
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"type": "VirtualMachines",
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"nodeImageVersion": "AKSUbuntu-1804gen2containerd-2021.09.11",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Creating",
"tags": {
"name1": "val1"
},
"virtualMachineNodesStatus": [
{
"count": 3,
"size": "Standard_D2_v2"
},
{
"count": 2,
"size": "Standard_D2_v3"
}
],
"virtualMachinesProfile": {
"scale": {
"manual": [
{
"count": 3,
"size": "Standard_D2_v2"
},
{
"count": 2,
"size": "Standard_D2_v3"
}
]
}
}
}
}
Create Agent Pool with VirtualMachines pool type with autoscaling enabled
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"type": "VirtualMachines",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.29.0",
"osType": "Linux",
"tags": {
"name1": "val1"
},
"virtualMachinesProfile": {
"scale": {
"autoscale": [
{
"maxCount": 5,
"minCount": 1,
"size": "Standard_D2_v2"
}
]
}
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolType;
import com.azure.resourcemanager.containerservice.models.AutoScaleProfile;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.ScaleProfile;
import com.azure.resourcemanager.containerservice.models.VirtualMachinesProfile;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_TypeVirtualMachines_Autoscale.json
*/
/**
* Sample code: Create Agent Pool with VirtualMachines pool type with autoscaling enabled.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createAgentPoolWithVirtualMachinesPoolTypeWithAutoscalingEnabled(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withOsType(OSType.LINUX).withTypePropertiesType(AgentPoolType.VIRTUAL_MACHINES)
.withOrchestratorVersion("1.29.0").withTags(mapOf("name1", "val1"))
.withNodeLabels(mapOf("key1", "fakeTokenPlaceholder"))
.withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule"))
.withVirtualMachinesProfile(new VirtualMachinesProfile().withScale(new ScaleProfile().withAutoscale(
Arrays.asList(new AutoScaleProfile().withSize("Standard_D2_v2").withMinCount(1).withMaxCount(5))))),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_type_virtual_machines_autoscale.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"nodeLabels": {"key1": "val1"},
"nodeTaints": ["Key1=Value1:NoSchedule"],
"orchestratorVersion": "1.29.0",
"osType": "Linux",
"tags": {"name1": "val1"},
"type": "VirtualMachines",
"virtualMachinesProfile": {
"scale": {"autoscale": [{"maxCount": 5, "minCount": 1, "size": "Standard_D2_v2"}]}
},
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_TypeVirtualMachines_Autoscale.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_TypeVirtualMachines_Autoscale.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithVirtualMachinesPoolTypeWithAutoscalingEnabled() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachines),
NodeLabels: map[string]*string{
"key1": to.Ptr("val1"),
},
NodeTaints: []*string{
to.Ptr("Key1=Value1:NoSchedule"),
},
OrchestratorVersion: to.Ptr("1.29.0"),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
Tags: map[string]*string{
"name1": to.Ptr("val1"),
},
VirtualMachinesProfile: &armcontainerservice.VirtualMachinesProfile{
Scale: &armcontainerservice.ScaleProfile{
Autoscale: []*armcontainerservice.AutoScaleProfile{
{
MaxCount: to.Ptr[int32](5),
MinCount: to.Ptr[int32](1),
Size: to.Ptr("Standard_D2_v2"),
},
},
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachines),
// CurrentOrchestratorVersion: to.Ptr("1.29.0"),
// MaxPods: to.Ptr[int32](110),
// NodeImageVersion: to.Ptr("AKSUbuntu-1804gen2containerd-2021.09.11"),
// NodeLabels: map[string]*string{
// "key1": to.Ptr("val1"),
// },
// NodeTaints: []*string{
// to.Ptr("Key1=Value1:NoSchedule"),
// },
// OrchestratorVersion: to.Ptr("1.29.0"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// Tags: map[string]*string{
// "name1": to.Ptr("val1"),
// },
// VirtualMachineNodesStatus: []*armcontainerservice.VirtualMachineNodes{
// {
// Count: to.Ptr[int32](1),
// Size: to.Ptr("Standard_D2_v2"),
// },
// },
// VirtualMachinesProfile: &armcontainerservice.VirtualMachinesProfile{
// Scale: &armcontainerservice.ScaleProfile{
// Autoscale: []*armcontainerservice.AutoScaleProfile{
// {
// MaxCount: to.Ptr[int32](5),
// MinCount: to.Ptr[int32](1),
// Size: to.Ptr("Standard_D2_v2"),
// },
// },
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_TypeVirtualMachines_Autoscale.json
*/
async function createAgentPoolWithVirtualMachinesPoolTypeWithAutoscalingEnabled() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
typePropertiesType: "VirtualMachines",
nodeLabels: { key1: "val1" },
nodeTaints: ["Key1=Value1:NoSchedule"],
orchestratorVersion: "1.29.0",
osType: "Linux",
tags: { name1: "val1" },
virtualMachinesProfile: {
scale: { autoscale: [{ maxCount: 5, minCount: 1, size: "Standard_D2_v2" }] },
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"type": "VirtualMachines",
"currentOrchestratorVersion": "1.29.0",
"maxPods": 110,
"nodeImageVersion": "AKSUbuntu-1804gen2containerd-2021.09.11",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.29.0",
"osType": "Linux",
"provisioningState": "Succeeded",
"tags": {
"name1": "val1"
},
"virtualMachineNodesStatus": [
{
"count": 1,
"size": "Standard_D2_v2"
}
],
"virtualMachinesProfile": {
"scale": {
"autoscale": [
{
"maxCount": 5,
"minCount": 1,
"size": "Standard_D2_v2"
}
]
}
}
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"type": "VirtualMachines",
"currentOrchestratorVersion": "1.29.0",
"maxPods": 110,
"nodeImageVersion": "AKSUbuntu-1804gen2containerd-2021.09.11",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.29.0",
"osType": "Linux",
"provisioningState": "Creating",
"tags": {
"name1": "val1"
},
"virtualMachineNodesStatus": [
{
"count": 1,
"size": "Standard_D2_v2"
}
],
"virtualMachinesProfile": {
"scale": {
"autoscale": [
{
"maxCount": 5,
"minCount": 1,
"size": "Standard_D2_v2"
}
]
}
}
}
}
Create Agent Pool with Windows OSSKU
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2?api-version=2026-06-01
{
"properties": {
"count": 3,
"orchestratorVersion": "1.23.3",
"osSKU": "Windows2022",
"osType": "Windows",
"vmSize": "Standard_D4s_v3"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSSku;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_WindowsOSSKU.json
*/
/**
* Sample code: Create Agent Pool with Windows OSSKU.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createAgentPoolWithWindowsOSSKU(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "wnp2",
new AgentPoolInner().withCount(3).withVmSize("Standard_D4s_v3").withOsType(OSType.WINDOWS)
.withOsSku(OSSku.WINDOWS2022).withOrchestratorVersion("1.23.3"),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_windows_ossku.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="wnp2",
parameters={
"properties": {
"count": 3,
"orchestratorVersion": "1.23.3",
"osSKU": "Windows2022",
"osType": "Windows",
"vmSize": "Standard_D4s_v3",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_WindowsOSSKU.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_WindowsOSSKU.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithWindowsOssku() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "wnp2", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr("1.23.3"),
OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022),
OSType: to.Ptr(armcontainerservice.OSTypeWindows),
VMSize: to.Ptr("Standard_D4s_v3"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("wnp2"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.23.3"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.23.3"),
// OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022),
// OSType: to.Ptr(armcontainerservice.OSTypeWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_D4s_v3"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_WindowsOSSKU.json
*/
async function createAgentPoolWithWindowsOssku() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "wnp2", {
count: 3,
orchestratorVersion: "1.23.3",
osSKU: "Windows2022",
osType: "Windows",
vmSize: "Standard_D4s_v3",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "wnp2",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.23.3",
"maxPods": 110,
"orchestratorVersion": "1.23.3",
"osSKU": "Windows2022",
"osType": "Windows",
"provisioningState": "Succeeded",
"vmSize": "Standard_D4s_v3"
}
}
{
"name": "wnp2",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.23.3",
"maxPods": 110,
"orchestratorVersion": "1.23.3",
"osSKU": "Windows2022",
"osType": "Windows",
"provisioningState": "Creating",
"vmSize": "Standard_D4s_v3"
}
}
Create Spot Agent Pool
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"tags": {
"name1": "val1"
},
"vmSize": "Standard_DS1_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy;
import com.azure.resourcemanager.containerservice.models.ScaleSetPriority;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_Spot.json
*/
/**
* Sample code: Create Spot Agent Pool.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createSpotAgentPool(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS1_v2").withOsType(OSType.LINUX)
.withOrchestratorVersion("").withScaleSetPriority(ScaleSetPriority.SPOT)
.withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE).withTags(mapOf("name1", "val1"))
.withNodeLabels(mapOf("key1", "fakeTokenPlaceholder"))
.withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_spot.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"nodeLabels": {"key1": "val1"},
"nodeTaints": ["Key1=Value1:NoSchedule"],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"tags": {"name1": "val1"},
"vmSize": "Standard_DS1_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_Spot.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_Spot.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createSpotAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
NodeLabels: map[string]*string{
"key1": to.Ptr("val1"),
},
NodeTaints: []*string{
to.Ptr("Key1=Value1:NoSchedule"),
},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
Tags: map[string]*string{
"name1": to.Ptr("val1"),
},
VMSize: to.Ptr("Standard_DS1_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// NodeLabels: map[string]*string{
// "key1": to.Ptr("val1"),
// },
// NodeTaints: []*string{
// to.Ptr("Key1=Value1:NoSchedule"),
// },
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
// ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
// SpotMaxPrice: to.Ptr[float32](-1),
// Tags: map[string]*string{
// "name1": to.Ptr("val1"),
// },
// VMSize: to.Ptr("Standard_DS1_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_Spot.json
*/
async function createSpotAgentPool() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
nodeLabels: { key1: "val1" },
nodeTaints: ["Key1=Value1:NoSchedule"],
orchestratorVersion: "",
osType: "Linux",
scaleSetEvictionPolicy: "Delete",
scaleSetPriority: "Spot",
tags: { name1: "val1" },
vmSize: "Standard_DS1_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"spotMaxPrice": -1,
"tags": {
"name1": "val1"
},
"vmSize": "Standard_DS1_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Creating",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"spotMaxPrice": -1,
"tags": {
"name1": "val1"
},
"vmSize": "Standard_DS1_v2"
}
}
Create Windows Agent Pool with disabling OutboundNAT
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2?api-version=2026-06-01
{
"properties": {
"count": 3,
"orchestratorVersion": "1.23.8",
"osSKU": "Windows2022",
"osType": "Windows",
"vmSize": "Standard_D4s_v3",
"windowsProfile": {
"disableOutboundNat": true
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolWindowsProfile;
import com.azure.resourcemanager.containerservice.models.OSSku;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_WindowsDisableOutboundNAT.json
*/
/**
* Sample code: Create Windows Agent Pool with disabling OutboundNAT.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void createWindowsAgentPoolWithDisablingOutboundNAT(
com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "wnp2",
new AgentPoolInner().withCount(3).withVmSize("Standard_D4s_v3").withOsType(OSType.WINDOWS)
.withOsSku(OSSku.WINDOWS2022).withOrchestratorVersion("1.23.8")
.withWindowsProfile(new AgentPoolWindowsProfile().withDisableOutboundNat(true)),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_windows_disable_outbound_nat.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="wnp2",
parameters={
"properties": {
"count": 3,
"orchestratorVersion": "1.23.8",
"osSKU": "Windows2022",
"osType": "Windows",
"vmSize": "Standard_D4s_v3",
"windowsProfile": {"disableOutboundNat": True},
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_WindowsDisableOutboundNAT.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_WindowsDisableOutboundNAT.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createWindowsAgentPoolWithDisablingOutboundNat() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "wnp2", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr("1.23.8"),
OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022),
OSType: to.Ptr(armcontainerservice.OSTypeWindows),
VMSize: to.Ptr("Standard_D4s_v3"),
WindowsProfile: &armcontainerservice.AgentPoolWindowsProfile{
DisableOutboundNat: to.Ptr(true),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("wnp2"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.23.8"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.23.8"),
// OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022),
// OSType: to.Ptr(armcontainerservice.OSTypeWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_D4s_v3"),
// WindowsProfile: &armcontainerservice.AgentPoolWindowsProfile{
// DisableOutboundNat: to.Ptr(true),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_WindowsDisableOutboundNAT.json
*/
async function createWindowsAgentPoolWithDisablingOutboundNAT() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "wnp2", {
count: 3,
orchestratorVersion: "1.23.8",
osSKU: "Windows2022",
osType: "Windows",
vmSize: "Standard_D4s_v3",
windowsProfile: { disableOutboundNat: true },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "wnp2",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.23.8",
"maxPods": 110,
"orchestratorVersion": "1.23.8",
"osSKU": "Windows2022",
"osType": "Windows",
"provisioningState": "Succeeded",
"vmSize": "Standard_D4s_v3",
"windowsProfile": {
"disableOutboundNat": true
}
}
}
{
"name": "wnp2",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.23.8",
"maxPods": 110,
"orchestratorVersion": "1.23.8",
"osSKU": "Windows2022",
"osType": "Windows",
"provisioningState": "Creating",
"vmSize": "Standard_D4s_v3",
"windowsProfile": {
"disableOutboundNat": true
}
}
}
Create/Update Agent Pool
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"mode": "User",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"tags": {
"name1": "val1"
},
"vmSize": "Standard_DS1_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolMode;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy;
import com.azure.resourcemanager.containerservice.models.ScaleSetPriority;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_Update.json
*/
/**
* Sample code: Create/Update Agent Pool.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void
createUpdateAgentPool(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS1_v2").withOsType(OSType.LINUX)
.withMode(AgentPoolMode.USER).withOrchestratorVersion("").withScaleSetPriority(ScaleSetPriority.SPOT)
.withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE).withTags(mapOf("name1", "val1"))
.withNodeLabels(mapOf("key1", "fakeTokenPlaceholder"))
.withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"mode": "User",
"nodeLabels": {"key1": "val1"},
"nodeTaints": ["Key1=Value1:NoSchedule"],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"tags": {"name1": "val1"},
"vmSize": "Standard_DS1_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPoolsCreate_Update.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPoolsCreate_Update.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createUpdateAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
NodeLabels: map[string]*string{
"key1": to.Ptr("val1"),
},
NodeTaints: []*string{
to.Ptr("Key1=Value1:NoSchedule"),
},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
Tags: map[string]*string{
"name1": to.Ptr("val1"),
},
VMSize: to.Ptr("Standard_DS1_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
// NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"),
// NodeLabels: map[string]*string{
// "key1": to.Ptr("val1"),
// },
// NodeTaints: []*string{
// to.Ptr("Key1=Value1:NoSchedule"),
// },
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
// ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
// Tags: map[string]*string{
// "name1": to.Ptr("val1"),
// },
// VMSize: to.Ptr("Standard_DS1_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPoolsCreate_Update.json
*/
async function createOrUpdateAgentPool() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
mode: "User",
nodeLabels: { key1: "val1" },
nodeTaints: ["Key1=Value1:NoSchedule"],
orchestratorVersion: "",
osType: "Linux",
scaleSetEvictionPolicy: "Delete",
scaleSetPriority: "Spot",
tags: { name1: "val1" },
vmSize: "Standard_DS1_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"mode": "User",
"nodeImageVersion": "AKSUbuntu:1604:2020.03.11",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"tags": {
"name1": "val1"
},
"vmSize": "Standard_DS1_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"maxPods": 110,
"mode": "User",
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Creating",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"tags": {
"name1": "val1"
},
"vmSize": "Standard_DS1_v2"
}
}
Start Agent Pool
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"powerState": {
"code": "Running"
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.Code;
import com.azure.resourcemanager.containerservice.models.PowerState;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPools_Start.json
*/
/**
* Sample code: Start Agent Pool.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void startAgentPool(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withPowerState(new PowerState().withCode(Code.RUNNING)), null, null,
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_start.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={"properties": {"powerState": {"code": "Running"}}},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPools_Start.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPools_Start.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_startAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
PowerState: &armcontainerservice.PowerState{
Code: to.Ptr(armcontainerservice.CodeRunning),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](50),
// EnableAutoScaling: to.Ptr(true),
// MaxCount: to.Ptr[int32](55),
// MinCount: to.Ptr[int32](3),
// PowerState: &armcontainerservice.PowerState{
// Code: to.Ptr(armcontainerservice.CodeRunning),
// },
// ProvisioningState: to.Ptr("Starting"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPools_Start.json
*/
async function startAgentPool() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
powerState: { code: "Running" },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 50,
"enableAutoScaling": true,
"maxCount": 55,
"minCount": 3,
"powerState": {
"code": "Running"
},
"provisioningState": "Starting"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 50,
"enableAutoScaling": true,
"maxCount": 55,
"minCount": 3,
"powerState": {
"code": "Running"
},
"provisioningState": "Starting"
}
}
Stop Agent Pool
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"powerState": {
"code": "Stopped"
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.Code;
import com.azure.resourcemanager.containerservice.models.PowerState;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPools_Stop.json
*/
/**
* Sample code: Stop Agent Pool.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void stopAgentPool(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withPowerState(new PowerState().withCode(Code.STOPPED)), null, null,
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_stop.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={"properties": {"powerState": {"code": "Stopped"}}},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPools_Stop.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPools_Stop.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_stopAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
PowerState: &armcontainerservice.PowerState{
Code: to.Ptr(armcontainerservice.CodeStopped),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](0),
// EnableAutoScaling: to.Ptr(false),
// PowerState: &armcontainerservice.PowerState{
// Code: to.Ptr(armcontainerservice.CodeStopped),
// },
// ProvisioningState: to.Ptr("Stopping"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPools_Stop.json
*/
async function stopAgentPool() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
powerState: { code: "Stopped" },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 0,
"enableAutoScaling": false,
"powerState": {
"code": "Stopped"
},
"provisioningState": "Stopping"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 0,
"enableAutoScaling": false,
"powerState": {
"code": "Stopped"
},
"provisioningState": "Stopping"
}
}
Update Agent Pool
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2026-06-01
{
"properties": {
"count": 3,
"enableAutoScaling": true,
"maxCount": 2,
"minCount": 2,
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"vmSize": "Standard_DS1_v2"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy;
import com.azure.resourcemanager.containerservice.models.ScaleSetPriority;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-06-01/AgentPools_Update.json
*/
/**
* Sample code: Update Agent Pool.
*
* @param manager Entry point to ContainerServiceManager.
*/
public static void updateAgentPool(com.azure.resourcemanager.containerservice.ContainerServiceManager manager) {
manager.serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1", "agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS1_v2").withOsType(OSType.LINUX).withMaxCount(2)
.withMinCount(2).withEnableAutoScaling(true).withOrchestratorVersion("")
.withScaleSetPriority(ScaleSetPriority.SPOT).withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE)
.withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"enableAutoScaling": True,
"maxCount": 2,
"minCount": 2,
"nodeTaints": ["Key1=Value1:NoSchedule"],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"vmSize": "Standard_DS1_v2",
}
},
).result()
print(response)
# x-ms-original-file: 2026-06-01/AgentPools_Update.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v9"
)
// Generated from example definition: 2026-06-01/AgentPools_Update.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_updateAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
EnableAutoScaling: to.Ptr(true),
MaxCount: to.Ptr[int32](2),
MinCount: to.Ptr[int32](2),
NodeTaints: []*string{
to.Ptr("Key1=Value1:NoSchedule"),
},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
VMSize: to.Ptr("Standard_DS1_v2"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcontainerservice.AgentPoolsClientCreateOrUpdateResponse{
// AgentPool: armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// EnableAutoScaling: to.Ptr(true),
// MaxCount: to.Ptr[int32](2),
// MaxPods: to.Ptr[int32](110),
// MinCount: to.Ptr[int32](2),
// NodeTaints: []*string{
// to.Ptr("Key1=Value1:NoSchedule"),
// },
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
// ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
// VMSize: to.Ptr("Standard_DS1_v2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an agent pool in the specified managed cluster.
*
* @summary creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: 2026-06-01/AgentPools_Update.json
*/
async function updateAgentPool() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.createOrUpdate("rg1", "clustername1", "agentpool1", {
count: 3,
enableAutoScaling: true,
maxCount: 2,
minCount: 2,
nodeTaints: ["Key1=Value1:NoSchedule"],
orchestratorVersion: "",
osType: "Linux",
scaleSetEvictionPolicy: "Delete",
scaleSetPriority: "Spot",
vmSize: "Standard_DS1_v2",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"enableAutoScaling": true,
"maxCount": 2,
"maxPods": 110,
"minCount": 2,
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Succeeded",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"vmSize": "Standard_DS1_v2"
}
}
{
"name": "agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"properties": {
"count": 3,
"currentOrchestratorVersion": "1.9.6",
"enableAutoScaling": true,
"maxCount": 2,
"maxPods": 110,
"minCount": 2,
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"orchestratorVersion": "1.9.6",
"osType": "Linux",
"provisioningState": "Updating",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"vmSize": "Standard_DS1_v2"
}
}
Definitioner
AgentPool
Objekt
Agentpool.
| Name |
Typ |
Standardvärde |
Description |
|
id
|
string
(arm-id)
|
|
Fullständigt kvalificerat resurs-ID för resursen. Till exempel "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
name
|
string
|
|
Namnet på resursen
|
|
properties.artifactStreamingProfile
|
AgentPoolArtifactStreamingProfile
|
|
Konfiguration för användning av artefaktströmning i AKS.
|
|
properties.availabilityZones
|
string[]
|
|
Listan över Availability zones som ska användas för noder. Detta kan bara anges om egenskapen AgentPoolType är "VirtualMachineScaleSets".
|
|
properties.capacityReservationGroupID
|
string
(arm-id)
|
|
Det fullt kvalificerade resurs-ID:t för Capacity Reservation Group för att tillhandahålla virtual machines från en reserverad grupp av Virtual Machines. Detta är av formen: '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Compute/capacityreservationgroups/{capacityReservationGroupName}' Kunder använder det för att skapa en agentpool med en specificerad CRG. För mer information, se Capacity Reservation
|
|
properties.count
|
integer
(int32)
|
|
Antal agenter (VIRTUELLA datorer) som ska vara värdar för Docker-containrar. Tillåtna värden måste ligga mellan 0 och 1 000 (inklusive) för användarpooler och i intervallet 1 till 1 000 (inklusive) för systempooler. Standardvärdet är 1.
|
|
properties.creationData
|
CreationData
|
|
CreationData som ska användas för att ange källans ögonblicksbilds-ID om nodpoolen ska skapas/uppgraderas med hjälp av en ögonblicksbild.
|
|
properties.currentOrchestratorVersion
|
string
|
|
Versionen av Kubernetes som agentpoolen körs. Om orchestratorVersion är en fullständigt angiven version <major.minor.patch>är det här fältet exakt lika med det. Om orchestratorVersion är <major.minor>innehåller det här fältet den fullständiga <major.minor.patch-> version som används.
|
|
properties.eTag
|
string
|
|
Unik skrivskyddad sträng som används för att implementera optimistisk samtidighet. ETag-värdet ändras när resursen uppdateras. Ange ett if-match- eller if-none-match-huvud med eTag-värdet för en efterföljande begäran för att aktivera optimistisk samtidighet enligt den normala eTag-konventionen.
|
|
properties.enableAutoScaling
|
boolean
|
|
Om du vill aktivera automatisk skalning
|
|
properties.enableEncryptionAtHost
|
boolean
|
|
Om värdbaserad os- och dataenhetskryptering ska aktiveras. Detta stöds endast på vissa VM-storlekar och i vissa Azure-regioner. För ytterligare information, se: https://docs.microsoft.com/azure/aks/enable-host-encryption
|
|
properties.enableFIPS
|
boolean
|
|
Om du vill använda ett FIPS-aktiverat operativsystem. Se Add a FIPS-aktiverad nodpool för mer information.
|
|
properties.enableNodePublicIP
|
boolean
|
|
Om varje nod allokeras sin egen offentliga IP-adress. Vissa scenarier kan kräva att noder i en nodpool tar emot sina egna dedikerade offentliga IP-adresser. Ett vanligt scenario är för spelarbetsbelastningar, där en konsol måste upprätta en direktanslutning till en virtuell molndator för att minimera hopp. För mer information, se tilldelning av en publik IP per nod. Standardvärdet är falskt.
|
|
properties.enableUltraSSD
|
boolean
|
|
Om du vill aktivera UltraSSD
|
|
properties.gatewayProfile
|
AgentPoolGatewayProfile
|
|
Profil som är specifik för en hanterad agentpool i gatewayläge. Det går inte att ange det här fältet om agentpoolläget inte är gateway.
|
|
properties.gpuInstanceProfile
|
GPUInstanceProfile
|
|
GPUInstanceProfile som ska användas för att ange GPU MIG-instansprofil för GPU VM SKU som stöds.
|
|
properties.gpuProfile
|
GPUProfile
|
|
GPU-inställningar för agentpoolen.
|
|
properties.hostGroupID
|
string
(arm-id)
|
|
Det fullständigt kvalificerade resurs-ID:t för den dedikerade värdgruppen som ska etablera virtuella datorer från, som endast används i skapandescenariot och som inte tillåts ändras en gång. Det här formuläret är: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. För mer information, se Azure dedikerade värdar.
|
|
properties.kubeletConfig
|
KubeletConfig
|
|
Kubelet-konfigurationen på agentpoolnoderna.
|
|
properties.kubeletDiskType
|
KubeletDiskType
|
|
Bestämmer placeringen av tomma Dir-volymer, containerruntime-data root och Kubelets ephemeral storage.
|
|
properties.linuxOSConfig
|
LinuxOSConfig
|
|
Operativsystemets konfiguration av Linux-agentnoder.
|
|
properties.localDNSProfile
|
LocalDNSProfile
|
|
Konfigurerar den lokala DNS:en per nod med VnetDNS- och KubeDNS-åsidosättningar. LocalDNS hjälper till att förbättra prestanda och tillförlitlighet för DNS-matchning i ett AKS-kluster. Mer information finns i aka.ms/aks/localdns.
|
|
properties.maxCount
|
integer
(int32)
|
|
Maximalt antal noder för automatisk skalning
|
|
properties.maxPods
|
integer
(int32)
|
|
Det maximala antalet poddar som kan köras på en nod.
|
|
properties.messageOfTheDay
|
string
|
|
Dagens meddelande för Linux-noder, base64-kodat. En base64-kodad sträng som skrivs till /etc/motd efter avkodning. Detta möjliggör anpassning av dagens meddelande för Linux-noder. Den får inte anges för Windows noder. Det måste vara en statisk sträng (d.v.s. skrivs ut rå och körs inte som ett skript).
|
|
properties.minCount
|
integer
(int32)
|
|
Det minsta antalet noder för automatisk skalning
|
|
properties.mode
|
AgentPoolMode
|
|
Läget för en agentpool. Ett kluster måste ha minst en systemagentpool hela tiden. Mer information om begränsningar och metodtips för agentpooler finns i: https://docs.microsoft.com/azure/aks/use-system-pools
|
|
properties.networkProfile
|
AgentPoolNetworkProfile
|
|
Nätverksrelaterade inställningar för en agentpool.
|
|
properties.nodeImageVersion
|
string
|
|
Versionen av nodbilden. Att sätta detta värde utlöser en agentPool-rollback.
Endast värden från recentlyUsedVersions är tillåtna.
|
|
properties.nodeLabels
|
object
|
|
Nodetiketterna som ska bevaras över alla noder i agentpoolen.
|
|
properties.nodePublicIPPrefixID
|
string
(arm-id)
|
|
Det offentliga IP-prefix-ID som vm-noder ska använda IP-adresser från. Det här är formuläret: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}
|
|
properties.nodeTaints
|
string[]
|
|
Tainterna som har lagts till i nya noder när nodpoolen skapas och skalas. Till exempel key=value:NoSchedule.
|
|
properties.orchestratorVersion
|
string
|
|
Den version av Kubernetes som angetts av användaren. Både korrigeringsversionen <major.minor.patch> (t.ex. 1.20.13) och <major.minor> (t.ex. 1.20) stöds. När <major.minor> har angetts väljs den senaste ga-korrigeringsversionen automatiskt. När klustret uppdateras med samma <major.minor> när det har skapats (t.ex. 1.14.x–> 1.14) utlöses inte en uppgradering, även om en nyare korrigeringsversion är tillgänglig. Vi rekommenderar att du uppgraderar alla nodpooler i ett AKS-kluster till samma Kubernetes-version. Nodpoolversionen måste ha samma huvudversion som kontrollplanet. Delversionen av nodpoolen måste ligga inom två delversioner av kontrollplanets version. Nodpoolversionen får inte vara större än kontrollplanets version. För mer information, se upgrading a node pool.
|
|
properties.osDiskSizeGB
|
integer
(int32)
minimum: 0 maximum: 2048
|
|
Operativsystemets diskstorlek i GB som ska användas för att ange diskstorleken för varje dator i huvud-/agentpoolen. Om du anger 0 tillämpas standardstorleken för osDisk enligt den angivna vmSize-storleken.
|
|
properties.osDiskType
|
OSDiskType
|
|
Den operativsystemdisktyp som ska användas för datorer i agentpoolen. Standardvärdet är "Tillfällig" om den virtuella datorn stöder den och har en cachedisk som är större än den begärda OSDiskSizeGB. Annars är standardvärdet "Hanterad". Kan inte ändras när du har skapat. För mer information, se Ephemeral OS.
|
|
properties.osSKU
|
OSSKU
|
|
Anger os-SKU:n som används av agentpoolen. Standardvärdet är Ubuntu om OSType är Linux. Standardvärdet är Windows2019 när Kubernetes <= 1.24 eller Windows2022 när Kubernetes >= 1.25 om OSType är Windows.
|
|
properties.osType
|
OSType
|
Linux
|
Typ av operativsystem. Standardvärdet är Linux.
|
|
properties.podIPAllocationMode
|
PodIPAllocationMode
|
|
Läge för IP-allokering av poddar. IP-allokeringsläget för poddar i agentpoolen. Måste användas med podSubnetId. Standardvärdet är "DynamicIndividual".
|
|
properties.podSubnetID
|
string
(arm-id)
|
|
ID för det undernät som poddar ansluter till när de startas. Om detta utelämnas tilldelas podd-IP-adresser statiskt i nodundernätet (mer information finns i vnetSubnetID). Detta är i formuläret : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
|
|
properties.powerState
|
PowerState
|
|
Om agentpoolen körs eller stoppas. När en agentpool först skapas körs den först. Agentpoolen kan stoppas genom att ställa in fältet på Stoppad. En stoppad agentpool stoppar alla sina virtuella datorer och ackumulerar inte faktureringsavgifter. En agentpool kan bara stoppas om den körs och etableringstillståndet har slutförts
|
|
properties.provisioningState
|
string
|
|
Det aktuella distributions- eller etableringstillståndet.
|
|
properties.proximityPlacementGroupID
|
string
(arm-id)
|
|
ID för närhetsplaceringsgrupp.
|
|
properties.scaleDownMode
|
ScaleDownMode
|
|
Nedskalningsläget som ska användas vid skalning av agentpoolen. Detta påverkar även autoskalningsbeteendet för klustret. Om det inte anges är standardinställningen Ta bort.
|
|
properties.scaleSetEvictionPolicy
|
ScaleSetEvictionPolicy
|
Delete
|
Borttagningsprincipen för VM-skalningsuppsättningen. Vräkningspolicyn specificerar vad som to do med VM:n när den vräkas. Standardvärdet är Ta bort. För mer information om vräkning, se spot VMs
|
|
properties.scaleSetPriority
|
ScaleSetPriority
|
Regular
|
Prioritet för VM-skalningsuppsättning.
|
|
properties.securityProfile
|
AgentPoolSecurityProfile
|
|
Säkerhetsinställningarna för en agentpool.
|
|
properties.spotMaxPrice
|
number
(float)
|
-1
|
Det högsta priset (i us-dollar) som du är villig att betala för spot-instanser. Möjliga värden är ett decimalvärde som är större än noll eller -1 vilket anger att standardpriset är up-to på begäran. Möjliga värden är ett decimalvärde som är större än noll eller -1 vilket indikerar viljan att betala ett pris på begäran. För mer information om spotprissättning, se spot VMs prissättning
|
|
properties.status
|
AgentPoolStatus
|
|
Innehåller skrivskyddad information om agentpoolen.
|
|
properties.tags
|
object
|
|
Taggarna som ska sparas på vm-skalningsuppsättningen för agentpoolen.
|
|
properties.type
|
AgentPoolType
|
|
Typ av agentpool.
|
|
properties.upgradeSettings
|
AgentPoolUpgradeSettings
|
|
Inställningar för att uppgradera agentpoolen
|
|
properties.virtualMachineNodesStatus
|
VirtualMachineNodes[]
|
|
Status för noder i en VirtualMachines-agentpool.
|
|
properties.virtualMachinesProfile
|
VirtualMachinesProfile
|
|
Specifikationer för VirtualMachines-agentpoolen.
|
|
properties.vmSize
|
string
|
|
Storleken på de virtuella datorerna i agentpoolen. Tillgängligheten för VM-storlek varierar beroende på region. Om en nod innehåller otillräckliga beräkningsresurser (minne, processor osv.) kan poddar inte köras korrekt. Mer information om begränsade VM-storlekar finns i: https://docs.microsoft.com/azure/aks/quotas-skus-regions
|
|
properties.vnetSubnetID
|
string
(arm-id)
|
|
ID:t för undernätet som agentpoolnoder och eventuellt poddar ansluter till vid start. Om detta inte anges genereras och används ett VNET och undernät. Om inget podSubnetID har angetts gäller detta för noder och poddar, annars gäller det bara för noder. Detta är i formuläret : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
|
|
properties.windowsProfile
|
AgentPoolWindowsProfile
|
|
Windows-agentpoolens specifika profil.
|
|
properties.workloadRuntime
|
WorkloadRuntime
|
|
Avgör vilken typ av arbetsbelastning en nod kan köra.
|
|
systemData
|
systemData
|
|
Azure Resource Manager-metadata som innehåller createdBy och modifiedBy information.
|
|
type
|
string
|
|
Resurstypen. Till exempel "Microsoft.Compute/virtualMachines" eller "Microsoft.Storage/storageAccounts"
|
AgentPoolArtifactStreamingProfile
Objekt
Artefakt-streamingprofil för agentpoolen.
| Name |
Typ |
Description |
|
enabled
|
boolean
|
Artefaktströmning påskyndar kallstarten av containrar på en nod genom inläsning av avbildning på begäran. Om du vill använda den här funktionen måste containeravbildningar även aktivera artefaktströmning på ACR. Om det inte anges är standardvärdet falskt.
|
AgentPoolGatewayProfile
Objekt
Profil för agentpoolen för den hanterade klustergatewayen.
| Name |
Typ |
Standardvärde |
Description |
|
publicIPPrefixSize
|
integer
(int32)
minimum: 28 maximum: 31
|
31
|
Gateway-agentpoolen associerar en offentlig IPPrefix för varje statisk utgående gateway för att tillhandahålla offentlig utgående trafik. Storleken på offentlig IPPrefix ska väljas av användaren. Varje nod i agentpoolen tilldelas en IP-adress från IPPrefix. IPPrefix-storleken fungerar därmed som ett tak för storleken på gatewayagentpoolen. På grund av Azure offentlig STORLEKsbegränsning för IPPrefix är det giltiga värdeintervallet [28, 31] (/31 = 2 noder/IP-adresser, /30 = 4 noder/IP-adresser, /29 = 8 noder/IP-adresser, /28 = 16 noder/IP-adresser). Standardvärdet är 31.
|
AgentPoolMode
Uppräkning
Läget för en agentpool. Ett kluster måste ha minst en systemagentpool hela tiden. Mer information om begränsningar och metodtips för agentpooler finns i: https://docs.microsoft.com/azure/aks/use-system-pools
| Värde |
Description |
|
System
|
Systemagentpooler är främst till för att hantera kritiska systempoddar som CoreDNS och metrics-server. Systemagentpooler osType måste vara Linux. Systemagentpooler VM SKU måste ha minst 2vCPU:er och 4 GB minne.
|
|
User
|
Användaragentpooler är främst till för att vara värd för dina programpoddar.
|
|
Gateway
|
Gatewayagentpooler är dedikerade för att tillhandahålla statiska utgående IP-adresser till poddar. Mer information finns i https://aka.ms/aks/static-egress-gateway.
|
AgentPoolNetworkProfile
Objekt
Nätverksinställningar för en agentpool.
| Name |
Typ |
Description |
|
allowedHostPorts
|
PortRange[]
|
De portområden som tillåts access. De angivna intervallen får överlappa varandra.
|
|
applicationSecurityGroups
|
string[]
(arm-id)
|
ID:t för de programsäkerhetsgrupper som agentpoolen associerar när de skapas.
|
|
dranet
|
DRANETProfile
|
DRANET-inställningar för en agentpool.
|
|
nodePublicIPTags
|
IPTag[]
|
IPTags för offentliga IP-adresser på instansnivå.
|
AgentPoolSecurityProfile
Objekt
Säkerhetsinställningarna för en agentpool.
| Name |
Typ |
Description |
|
enableSecureBoot
|
boolean
|
Säker start är en funktion i Trusted Launch som säkerställer att endast signerade operativsystem och drivrutiner kan starta. Mer information finns i aka.ms/aks/trustedlaunch. Om det inte anges är standardvärdet falskt.
|
|
enableVTPM
|
boolean
|
vTPM är en betrodd startfunktion för att konfigurera ett dedikerat säkert valv för nycklar och mått som lagras lokalt på noden. Mer information finns i aka.ms/aks/trustedlaunch. Om det inte anges är standardvärdet falskt.
|
|
sshAccess
|
AgentPoolSSHAccess
|
SSH-access-metoden för en agentpool.
|
AgentPoolSSHAccess
Uppräkning
SSH-access-metoden för en agentpool.
| Värde |
Description |
|
LocalUser
|
Kan SSH på noden som en lokal användare med hjälp av en privat nyckel.
|
|
Disabled
|
SSH-tjänsten kommer att stängas av på noden.
|
|
EntraId
|
SSH till nod med EntraId-integrering. Mer information finns under https://aka.ms/aks/ssh/aad
|
AgentPoolStatus
Objekt
Innehåller skrivskyddad information om agentpoolen.
| Name |
Typ |
Description |
|
provisioningError
|
ErrorDetail
|
Felinformationen för agentpoolen. Bevarar detaljerad information om fel. Om det inte uppstod något fel utelämnas det här fältet.
|
AgentPoolType
Uppräkning
Typ av agentpool.
| Värde |
Description |
|
VirtualMachineScaleSets
|
Skapa en agentpool som backas upp av en VM-skalningsuppsättning.
|
|
AvailabilitySet
|
Användning av detta rekommenderas starkt.
|
|
VirtualMachines
|
Skapa en agentpool som backas upp av en vm-orkestreringsläge för en enskild instans.
|
AgentPoolUpgradeSettings
Objekt
Inställningar för att uppgradera en agentpool
| Name |
Typ |
Description |
|
drainTimeoutInMinutes
|
integer
(int32)
minimum: 1 maximum: 1440
|
Tidsgränsen för tömning för en nod. Hur lång tid (i minuter) som ska vänta vid borttagning av poddar och graciös avslutning per nod. Den här avhysningsväntetiden hedrar väntan på poddavbrottsbudgetar. Om den här tiden överskrids misslyckas uppgraderingen. Om det inte anges är standardvärdet 30 minuter.
|
|
maxSurge
|
string
|
Det maximala antalet eller procentandelen noder som ökar under uppgraderingen. Detta kan antingen anges till ett heltal (t.ex. "5") eller en procentandel (t.ex. "50%"). Om en procentandel anges är det procentandelen av den totala agentpoolens storlek vid tidpunkten för uppgraderingen. För procentandelar avrundas bråknoder uppåt. Om det inte anges är standardvärdet 10%. Mer information, inklusive metodtips, finns i: https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster
|
|
maxUnavailable
|
string
|
Det maximala antalet eller procentandelen noder som kan vara samtidigt otillgängliga under uppgraderingen. Detta kan antingen anges till ett heltal (t.ex. "1") eller en procentandel (t.ex. "5%"). Om en procentandel anges är det procentandelen av den totala agentpoolens storlek vid tidpunkten för uppgraderingen. För procentandelar avrundas bråknoder uppåt. Om det inte anges är standardvärdet 0. Mer information, inklusive metodtips, finns i: https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster
|
|
nodeSoakDurationInMinutes
|
integer
(int32)
minimum: 0 maximum: 30
|
Blötläggningstiden för en nod. Hur lång tid (i minuter) som ska vänta efter tömning av en nod och innan du återskapar den och går vidare till nästa nod. Om det inte anges är standardvärdet 0 minuter.
|
|
undrainableNodeBehavior
|
UndrainableNodeBehavior
|
Definierar beteendet för oanvändbara noder under uppgraderingen. Den vanligaste orsaken till oanvändbara noder är poddavbrottsbudgetar (PDB), men andra problem, till exempel respitperiod för poddavslut överskrider den återstående timeouten per nod eller podden fortfarande är i ett körningstillstånd, kan också orsaka oanvändbara noder.
|
AgentPoolWindowsProfile
Objekt
Windows-agentpoolens specifika profil.
| Name |
Typ |
Description |
|
disableOutboundNat
|
boolean
|
Om du vill inaktivera OutboundNAT i Windows-noder. Standardvärdet är falskt. Utgående NAT kan bara inaktiveras om klustret outboundType är NAT Gateway och Windows-agentpoolen inte har nodens offentliga IP-adress aktiverad.
|
AutoScaleProfile
Objekt
Specifikationer för automatisk skalning.
| Name |
Typ |
Description |
|
maxCount
|
integer
(int32)
|
Det maximala antalet noder av de angivna storlekarna.
|
|
minCount
|
integer
(int32)
|
Det minsta antalet noder av de angivna storlekarna.
|
|
size
|
string
|
VM-storlek som AKS använder när du skapar och skalar, t.ex. "Standard_E4s_v3", "Standard_E16s_v3" eller "Standard_D16s_v5".
|
Code
Uppräkning
Anger om klustret körs eller stoppas
| Värde |
Description |
|
Running
|
Klustret körs.
|
|
Stopped
|
Klustret stoppas.
|
createdByType
Uppräkning
Den typ av identitet som skapade resursen.
| Värde |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
CreationData
Objekt
Data som används när du skapar en målresurs från en källresurs.
| Name |
Typ |
Description |
|
sourceResourceId
|
string
(arm-id)
|
Det här är ARM-ID:t för källobjektet som ska användas för att skapa målobjektet.
|
DRANETMode
Uppräkning
DRANET-läget för agentpoolen.
| Värde |
Description |
|
Unmanaged
|
DRANET förvaltas inte av AKS.
|
|
Managed
|
DRANET förvaltas av AKS.
|
DRANETProfile
Objekt
DRANET-inställningar för en agentpool.
| Name |
Typ |
Description |
|
mode
|
DRANETMode
|
DRANET-läget för agentpoolen.
|
ErrorAdditionalInfo
Objekt
Ytterligare information om resurshanteringsfelet.
| Name |
Typ |
Description |
|
info
|
object
|
Ytterligare information.
|
|
type
|
string
|
Ytterligare informationstyp.
|
ErrorDetail
Objekt
Felinformationen.
| Name |
Typ |
Description |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Ytterligare information om felet.
|
|
code
|
string
|
Felkoden.
|
|
details
|
ErrorDetail[]
|
Felinformationen.
|
|
message
|
string
|
Felmeddelandet.
|
|
target
|
string
|
Felmålet.
|
ErrorResponse
Objekt
Felsvar
GPUDriver
Uppräkning
Om du vill installera GPU-drivrutiner. När den inte har angetts är standardinställningen Installera.
| Värde |
Description |
|
Install
|
Installera drivrutin.
|
|
None
|
Hoppa över drivrutinsinstallation.
|
GPUInstanceProfile
Uppräkning
GPUInstanceProfile som ska användas för att ange GPU MIG-instansprofil för GPU VM SKU som stöds.
| Värde |
Description |
|
MIG1g
|
MIG 1G GPU-instansprofil.
|
|
MIG2g
|
MIG 2G GPU-instansprofil.
|
|
MIG3g
|
MIG 3G GPU-instansprofil.
|
|
MIG4g
|
MIG 4G GPU-instansprofil.
|
|
MIG7g
|
MIG 7G GPU-instansprofil.
|
GPUProfile
Objekt
GPU-inställningar för agentpoolen.
| Name |
Typ |
Description |
|
driver
|
GPUDriver
|
Om du vill installera GPU-drivrutiner. När den inte har angetts är standardinställningen Installera.
|
IPTag
Objekt
Innehåller DEN IPTag som är associerad med objektet.
| Name |
Typ |
Description |
|
ipTagType
|
string
|
Typ av IP-tagg. Exempel: RoutingPreference.
|
|
tag
|
string
|
Värdet för IP-taggen som är associerad med den offentliga IP-adressen. Exempel: Internet.
|
KubeletConfig
Objekt
Kubelet-konfigurationer av agentnoder. Mer information finns i konfiguration av anpassade AKS-noder.
| Name |
Typ |
Description |
|
allowedUnsafeSysctls
|
string[]
|
Tillåten lista över osäkra sysctls eller osäkra sysctl-mönster (slutar i *).
|
|
containerLogMaxFiles
|
integer
(int32)
minimum: 2
|
Det maximala antalet containerloggfiler som kan finnas för en container. Talet måste vara ≥ 2.
|
|
containerLogMaxSizeMB
|
integer
(int32)
|
Maximal storlek (t.ex. 10Mi) för containerloggfilen innan den roteras.
|
|
cpuCfsQuota
|
boolean
|
Om CPU CFS-kvottillämpning är aktiverat för containrar som anger CPU-gränser. Standardvärdet är sant.
|
|
cpuCfsQuotaPeriod
|
string
|
Värdet för CPU CFS-kvotperiod. Standardvärdet är "100 ms". Giltiga värden är en sekvens med decimaltal med ett valfritt bråk och ett enhetssuffix. Exempel: "300ms", "2h45m". Enheter som stöds är "ns", "us", "ms", "s", "m" och "h".
|
|
cpuManagerPolicy
|
string
|
Cpu Manager-principen som ska användas. Standardvärdet är "none". Mer information finns i Kubernetes CPU-hanteringsprinciper . Tillåtna värden är "none" och "static".
|
|
failSwapOn
|
boolean
|
Om värdet är sant kommer Kubelet inte att starta om växlingen är aktiverad på noden.
|
|
imageGcHighThreshold
|
integer
(int32)
|
Den procent av diskanvändningen varefter skräpinsamling av avbildningar alltid körs. För att inaktivera skräpinsamling av bilder, ange värdet till 100. Standardvärdet är 85%
|
|
imageGcLowThreshold
|
integer
(int32)
|
Den procentuella andelen av diskanvändning före vilket skräpinsamlingen för bilder aldrig körs. Detta kan inte anges högre än imageGcHighThreshold. Standardvärdet är 80%
|
|
podMaxPids
|
integer
(int32)
|
Maximalt antal processer per podd.
|
|
topologyManagerPolicy
|
string
|
Topologihanterarens princip som ska användas. Mer information finns i Kubernetes Toppology Manager. Standardvärdet är "none". Tillåtna värden är "none", "best-effort", "restricted" och "single-numa-node".
|
KubeletDiskType
Uppräkning
Bestämmer placeringen av tomma Dir-volymer, containerruntime-data root och Kubelets ephemeral storage.
| Värde |
Description |
|
OS
|
Kubelet använder OS-disken för sina data.
|
|
Temporary
|
Kubelet använder den tillfälliga disken för sina data.
|
LinuxOSConfig
Objekt
OS-konfigurationer av Linux-agentnoder. Mer information finns i konfiguration av anpassade AKS-noder.
| Name |
Typ |
Description |
|
swapFileSizeMB
|
integer
(int32)
|
Storleken i MB för en växlingsfil som skapas på varje nod.
|
|
sysctls
|
SysctlConfig
|
Sysctl-inställningar för Linux-agentnoder.
|
|
transparentHugePageDefrag
|
string
|
Om kerneln ska använda minneskomprimering aggressivt för att göra fler stora sidor tillgängliga. Giltiga värden är "always", "defer", "defer+madvise", "madvise" och "never". Standardvärdet är "madvise". Mer information finns i Transparenta enorma sidor.
|
|
transparentHugePageEnabled
|
string
|
Om transparenta enorma sidor är aktiverade. Giltiga värden är "always", "madvise" och "never". Standardvärdet är "always". Mer information finns i Transparenta enorma sidor.
|
LocalDNSForwardDestination
Uppräkning
Målserver för DNS-frågor som ska vidarebefordras från localDNS.
| Värde |
Description |
|
ClusterCoreDNS
|
Vidarebefordra DNS-frågor från localDNS till klustrets CoreDNS.
|
|
VnetDNS
|
Vidarebefordra DNS-frågor från localDNS till DNS-servern som konfigurerats i det virtuella nätverket. Ett virtuellt nätverk kan ha flera DNS-servrar konfigurerade.
|
LocalDNSForwardPolicy
Uppräkning
Vidarebefordra princip för att välja överordnad DNS-server. Se vidarebefordra plugin för mer information.
| Värde |
Description |
|
Sequential
|
Implementerar sekventiellt val av DNS-server uppströms. Se vidarebefordra plugin för mer information.
|
|
RoundRobin
|
Implementerar val av resursallokering av överordnad DNS-server. Se vidarebefordra plugin för mer information.
|
|
Random
|
Implementerar slumpmässigt val av DNS-server uppströms. Se vidarebefordra plugin för mer information.
|
LocalDNSMode
Uppräkning
Aktiveringsläge för localDNS.
| Värde |
Description |
|
Preferred
|
Om den aktuella orkestreringsversionen stöder den här funktionen föredrar du att aktivera localDNS.
|
|
Required
|
Aktivera localDNS.
|
|
Disabled
|
Inaktivera localDNS.
|
LocalDNSOverride
Objekt
Åsidosättningar för localDNS-profil.
| Name |
Typ |
Standardvärde |
Description |
|
cacheDurationInSeconds
|
integer
(int32)
|
3600
|
Cachelagring av maximalt TTL-värde i sekunder. Se cache-plugin för mer information.
|
|
forwardDestination
|
LocalDNSForwardDestination
|
ClusterCoreDNS
|
Målserver för DNS-frågor som ska vidarebefordras från localDNS.
|
|
forwardPolicy
|
LocalDNSForwardPolicy
|
Sequential
|
Vidarebefordra princip för att välja överordnad DNS-server. Se vidarebefordra plugin för mer information.
|
|
maxConcurrent
|
integer
(int32)
|
1000
|
Maximalt antal samtidiga frågor. Se vidarebefordra plugin för mer information.
|
|
protocol
|
LocalDNSProtocol
|
PreferUDP
|
Framtvinga TCP eller föredra UDP-protokoll för anslutningar från localDNS till överordnad DNS-server.
|
|
queryLogging
|
LocalDNSQueryLogging
|
Error
|
Loggnivå för DNS-frågor i localDNS.
|
|
serveStale
|
LocalDNSServeStale
|
Immediate
|
Princip för att betjäna inaktuella data. Se cache-plugin för mer information.
|
|
serveStaleDurationInSeconds
|
integer
(int32)
|
3600
|
Servera inaktuell varaktighet i sekunder. Se cache-plugin för mer information.
|
LocalDNSProfile
Objekt
Konfigurerar den lokala DNS:en per nod med VnetDNS- och KubeDNS-åsidosättningar. LocalDNS hjälper till att förbättra prestanda och tillförlitlighet för DNS-matchning i ett AKS-kluster. Mer information finns i aka.ms/aks/localdns.
| Name |
Typ |
Standardvärde |
Description |
|
kubeDNSOverrides
|
<string,
LocalDNSOverride>
|
|
KubeDNS-åsidosättningar gäller för DNS-trafik från poddar med dnsPolicy:ClusterFirst (kallas KubeDNS-trafik).
|
|
mode
|
LocalDNSMode
|
Preferred
|
Aktiveringsläge för localDNS.
|
|
state
|
LocalDNSState
|
|
Systemgenererat tillstånd för localDNS.
|
|
vnetDNSOverrides
|
<string,
LocalDNSOverride>
|
|
VnetDNS-åsidosättningar gäller för DNS-trafik från poddar med dnsPolicy:default eller kubelet (kallas VnetDNS-trafik).
|
LocalDNSProtocol
Uppräkning
Framtvinga TCP eller föredra UDP-protokoll för anslutningar från localDNS till överordnad DNS-server.
| Värde |
Description |
|
PreferUDP
|
Föredra UDP-protokoll för anslutningar från localDNS till den överordnade DNS-servern.
|
|
ForceTCP
|
Framtvinga TCP-protokoll för anslutningar från localDNS till överordnad DNS-server.
|
LocalDNSQueryLogging
Uppräkning
Loggnivå för DNS-frågor i localDNS.
| Värde |
Description |
|
Error
|
Aktiverar felloggning i localDNS. Se plugin-programmet errors för mer information.
|
|
Log
|
Aktiverar frågeloggning i localDNS. Se logg-plugin för mer information.
|
LocalDNSServeStale
Uppräkning
Princip för att betjäna inaktuella data. Se cache-plugin för mer information.
| Värde |
Description |
|
Verify
|
Hantera inaktuella data med verifiering. Kontrollera först att en post fortfarande inte är tillgänglig från källan innan du skickar den utgångna posten till klienten. Se cache-plugin för mer information.
|
|
Immediate
|
Servera inaktuella data omedelbart. Skicka den utgångna posten till klienten innan du kontrollerar om posten är tillgänglig från källan. Se cache-plugin för mer information.
|
|
Disable
|
Inaktivera servering av inaktuella data.
|
LocalDNSState
Uppräkning
Systemgenererat tillstånd för localDNS.
| Värde |
Description |
|
Enabled
|
localDNS är aktiverat.
|
|
Disabled
|
localDNS är inaktiverat.
|
ManualScaleProfile
Objekt
Specifikationer för antal datorer.
| Name |
Typ |
Description |
|
count
|
integer
(int32)
|
Antal noder.
|
|
size
|
string
|
VM-storlek som AKS använder när du skapar och skalar, t.ex. "Standard_E4s_v3", "Standard_E16s_v3" eller "Standard_D16s_v5".
|
OSDiskType
Uppräkning
Den operativsystemdisktyp som ska användas för datorer i agentpoolen. Standardvärdet är "Tillfällig" om den virtuella datorn stöder den och har en cachedisk som är större än den begärda OSDiskSizeGB. Annars är standardvärdet "Hanterad". Kan inte ändras när du har skapat. För mer information, se Ephemeral OS.
| Värde |
Description |
|
Managed
|
Azure replikerar operativsystemdisken för en virtuell dator till Azure Storage för att undvika dataförlust om den virtuella datorn behöver flyttas till en annan värd. Eftersom containrar inte är utformade för att ha kvar lokalt tillstånd ger det här beteendet ett begränsat värde samtidigt som vissa nackdelar, inklusive långsammare nodetablering och högre svarstid för läsning/skrivning.
|
|
Ephemeral
|
Tillfälliga OS-diskar lagras bara på värddatorn, precis som en tillfällig disk. Detta ger lägre svarstid för läsning/skrivning, tillsammans med snabbare nodskalning och klusteruppgraderingar.
|
OSSKU
Uppräkning
Anger os-SKU:n som används av agentpoolen. Standardvärdet är Ubuntu om OSType är Linux. Standardvärdet är Windows2019 när Kubernetes <= 1.24 eller Windows2022 när Kubernetes >= 1.25 om OSType är Windows.
| Värde |
Description |
|
Ubuntu
|
Använd Ubuntu som operativsystem för nodavbildningar.
|
|
AzureLinux
|
Använd AzureLinux som operativsystem för nodavbildningar. Azure Linux är en containeroptimerad Linux-distribution byggd av Microsoft, besök https://aka.ms/azurelinux för mer information.
|
|
AzureLinux3
|
Använd AzureLinux3 som operativsystem för nodavbildningar. Azure Linux är en containeroptimerad Linux-distribution byggd av Microsoft, besök https://aka.ms/azurelinux för mer information. Om du vill begränsa antalet besök kan du besöka https://aka.ms/aks/node-images. Vägledning för OS-migrering finns i https://aka.ms/aks/upgrade-os-version.
|
|
CBLMariner
|
Inaktuell OSSKU. Microsoft rekommenderar att nya implementationer väljer 'AzureLinux' istället.
|
|
Windows2019
|
Använd Windows2019 som operativsystem för nodavbildningar. Stöds inte för systemnodpooler. Windows2019 stöder endast Windows2019-containrar. Det går inte att köra Windows2022-containrar och vice versa.
|
|
Windows2022
|
Använd Windows2022 som operativsystem för nodavbildningar. Stöds inte för systemnodpooler. Windows2022 stöder endast Windows2022-containrar. Det går inte att köra Windows2019-containrar och vice versa.
|
|
Ubuntu2204
|
Använd Ubuntu2204 som operativsystem för nodavbildningar, men Ubuntu 22.04 kanske inte stöds för alla nodpooler. Begränsningar och kubernetes-versioner som stöds finns i https://aka.ms/aks/supported-ubuntu-versions
|
|
Windows2025
|
Använd Windows2025 som operativsystem för nodavbildningar. Stöds inte för systemnodpooler. Windows2025 stöder Windows 2022 och Windows 2025-containrar; den kan inte köra Windows2019-containrar och vice versa.
|
|
Ubuntu2404
|
Använd Ubuntu2404 som operativsystem för nodavbildningar, men Ubuntu 24.04 kanske inte stöds för alla nodpooler. Begränsningar och kubernetes-versioner som stöds finns i se https://aka.ms/aks/supported-ubuntu-versions
|
|
AzureContainerLinux
|
Använd Azure Container Linux som operativsystem för nodbilder. Azure Container Linux är ett containeroptimerat, säkerhetsfokuserat Linux-operativsystem byggt på Azure Linux, med ett oföränderligt filsystem. ACL är härlett från Flatcar Container Linux-projektet, som bygger vidare på Flatcars beprövade container-först, oföränderliga design, samtidigt som Azure Linux-paket, service och djup integration med Azure- och AKS-livscykeln läggs till. För mer information, se https://aka.ms/azurecontainerlinux
|
OSType
Uppräkning
Typ av operativsystem. Standardvärdet är Linux.
| Värde |
Description |
|
Linux
|
Använd Linux.
|
|
Windows
|
Använd Windows.
|
PodIPAllocationMode
Uppräkning
Läge för IP-allokering av poddar. IP-allokeringsläget för poddar i agentpoolen. Måste användas med podSubnetId. Standardvärdet är "DynamicIndividual".
| Värde |
Description |
|
DynamicIndividual
|
Varje nod allokeras med en icke-sammanhängande lista över IP-adresser som kan tilldelas till poddar. Detta är bättre för att maximera ett litet till medelstort undernät med storlek /16 eller mindre. Azure CNI-klustret med dynamisk IP-allokering är standard i det här läget om kunden inte uttryckligen anger en podIPAllocationMode
|
|
StaticBlock
|
Varje nod är statiskt allokerade CIDR-block av storlek /28 = 16 IP-adresser per block för att uppfylla maxPods per nod. Antal CIDR-block >= (maxPods / 16). Blocket, istället för en enskild IP, räknas mot Azure Vnet Private IP-gränsen på 65K. Därför är blockläge lämpligt för att köra större arbetsbelastningar med mer än den aktuella gränsen på 65 000 poddar i ett kluster. Det här läget passar bättre för skalning med större undernät på /15 eller större
|
PortRange
Objekt
Portintervallet.
| Name |
Typ |
Description |
|
portEnd
|
integer
(int32)
minimum: 1 maximum: 65535
|
Den maximala port som ingår i intervallet. Den bör vara mellan 1 och 65535 och vara större än eller lika med portStart.
|
|
portStart
|
integer
(int32)
minimum: 1 maximum: 65535
|
Den minsta port som ingår i intervallet. Den bör vara mellan 1 och 65535 och vara mindre än eller lika med portEnd.
|
|
protocol
|
Protocol
|
Portens nätverksprotokoll.
|
PowerState
Objekt
Beskriver klustrets energitillstånd
| Name |
Typ |
Description |
|
code
|
Code
|
Anger om klustret körs eller stoppas
|
Protocol
Uppräkning
Portens nätverksprotokoll.
| Värde |
Description |
|
TCP
|
TCP-protokoll.
|
|
UDP
|
UDP-protokoll.
|
ScaleDownMode
Uppräkning
Beskriver hur virtuella datorer läggs till eller tas bort från agentpooler. Se faktureringsstatus.
| Värde |
Description |
|
Delete
|
Skapa nya instanser under uppskalning och ta bort instanser under nedskalning.
|
|
Deallocate
|
Försök att starta frigjorda instanser (om de finns) under uppskalning och frigöra instanser under nedskalning.
|
ScaleProfile
Objekt
Specifikationer för hur du skalar en VirtualMachines-agentpool.
| Name |
Typ |
Description |
|
autoscale
|
AutoScaleProfile[]
|
Specifikationer för hur du automatiskt skalar VirtualMachines-agentpoolen inom ett fördefinierat storleksintervall.
Varje profil riktar sig till en specifik VM-SKU och utvärderas oberoende.
Skalningsbeslut över profiler styrs av klusterets autoskalerexpander, konfigurerbar via ManagedCluster.properties.autoScalerProfile.expander.
|
|
manual
|
ManualScaleProfile[]
|
Specifikationer för hur du skalar VirtualMachines-agentpoolen till en fast storlek.
|
ScaleSetEvictionPolicy
Uppräkning
Borttagningsprincipen för VM-skalningsuppsättningen. Vräkningspolicyn specificerar vad som to do med VM:n när den vräkas. Standardvärdet är Ta bort. För mer information om vräkning, se spot VMs
| Värde |
Description |
|
Delete
|
Noder i den underliggande skalningsuppsättningen för nodpoolen tas bort när de avlägsnas.
|
|
Deallocate
|
Noder i den underliggande skalningsuppsättningen för nodpoolen är inställda på tillståndet stoppad frigjord vid borttagning. Noder i det stoppade frigjorda tillståndet räknas mot din beräkningskvot och kan orsaka problem med klusterskalning eller uppgradering.
|
ScaleSetPriority
Uppräkning
Prioritet för VM-skalningsuppsättning.
| Värde |
Description |
|
Spot
|
Virtuella datorer med platsprioritet används. Det finns inget serviceavtal för skalningsnoder för oanvänd kapacitet. Mer information finns i plats på AKS-.
|
|
Regular
|
Vanliga virtuella datorer används.
|
SysctlConfig
Objekt
Sysctl-inställningar för Linux-agentnoder.
| Name |
Typ |
Description |
|
fsAioMaxNr
|
integer
(int32)
|
Sysctl-inställning fs.aio-max-nr.
|
|
fsFileMax
|
integer
(int32)
|
Sysctl-inställning fs.file-max.
|
|
fsInotifyMaxUserWatches
|
integer
(int32)
|
Sysctl-inställning fs.inotify.max_user_watches.
|
|
fsNrOpen
|
integer
(int32)
|
Sysctl-inställning fs.nr_open.
|
|
kernelThreadsMax
|
integer
(int32)
|
Sysctl-inställning kernel.threads-max.
|
|
netCoreNetdevMaxBacklog
|
integer
(int32)
|
Sysctl-inställning net.core.netdev_max_backlog.
|
|
netCoreOptmemMax
|
integer
(int32)
|
Sysctl-inställning net.core.optmem_max.
|
|
netCoreRmemDefault
|
integer
(int32)
|
Sysctl-inställning net.core.rmem_default.
|
|
netCoreRmemMax
|
integer
(int32)
|
Sysctl-inställning net.core.rmem_max.
|
|
netCoreSomaxconn
|
integer
(int32)
|
Sysctl-inställning net.core.somaxconn.
|
|
netCoreWmemDefault
|
integer
(int32)
|
Sysctl-inställning net.core.wmem_default.
|
|
netCoreWmemMax
|
integer
(int32)
|
Sysctl-inställning net.core.wmem_max.
|
|
netIpv4IpLocalPortRange
|
string
|
Sysctl-inställning net.ipv4.ip_local_port_range.
|
|
netIpv4NeighDefaultGcThresh1
|
integer
(int32)
|
Sysctl-inställning net.ipv4.neigh.default.gc_thresh1.
|
|
netIpv4NeighDefaultGcThresh2
|
integer
(int32)
|
Sysctl-inställning net.ipv4.neigh.default.gc_thresh2.
|
|
netIpv4NeighDefaultGcThresh3
|
integer
(int32)
|
Sysctl-inställning net.ipv4.neigh.default.gc_thresh3.
|
|
netIpv4TcpFinTimeout
|
integer
(int32)
|
Sysctl-inställning net.ipv4.tcp_fin_timeout.
|
|
netIpv4TcpKeepaliveProbes
|
integer
(int32)
|
Sysctl-inställning net.ipv4.tcp_keepalive_probes.
|
|
netIpv4TcpKeepaliveTime
|
integer
(int32)
|
Sysctl-inställning net.ipv4.tcp_keepalive_time.
|
|
netIpv4TcpMaxSynBacklog
|
integer
(int32)
|
Sysctl-inställning net.ipv4.tcp_max_syn_backlog.
|
|
netIpv4TcpMaxTwBuckets
|
integer
(int32)
|
Sysctl-inställning net.ipv4.tcp_max_tw_buckets.
|
|
netIpv4TcpTwReuse
|
boolean
|
Sysctl-inställning net.ipv4.tcp_tw_reuse.
|
|
netIpv4TcpkeepaliveIntvl
|
integer
(int32)
minimum: 10 maximum: 90
|
Sysctl-inställning net.ipv4.tcp_keepalive_intvl.
|
|
netNetfilterNfConntrackBuckets
|
integer
(int32)
minimum: 65536 maximum: 524288
|
Sysctl-inställning net.netfilter.nf_conntrack_buckets.
|
|
netNetfilterNfConntrackMax
|
integer
(int32)
minimum: 131072 maximum: 2097152
|
Sysctl-inställning net.netfilter.nf_conntrack_max.
|
|
vmMaxMapCount
|
integer
(int32)
|
Sysctl-inställning vm.max_map_count.
|
|
vmSwappiness
|
integer
(int32)
|
Sysctl-inställning vm.swappiness.
|
|
vmVfsCachePressure
|
integer
(int32)
|
Sysctl-inställning vm.vfs_cache_pressure.
|
systemData
Objekt
Metadata som rör skapande och senaste ändring av resursen.
| Name |
Typ |
Description |
|
createdAt
|
string
(date-time)
|
Tidsstämpeln för resursskapande (UTC).
|
|
createdBy
|
string
|
Identiteten som skapade resursen.
|
|
createdByType
|
createdByType
|
Den typ av identitet som skapade resursen.
|
|
lastModifiedAt
|
string
(date-time)
|
Tidsstämpeln för resursens senaste ändring (UTC)
|
|
lastModifiedBy
|
string
|
Identiteten som senast ändrade resursen.
|
|
lastModifiedByType
|
createdByType
|
Den typ av identitet som senast ändrade resursen.
|
UndrainableNodeBehavior
Uppräkning
Definierar beteendet för oanvändbara noder under uppgraderingen. Den vanligaste orsaken till oanvändbara noder är poddavbrottsbudgetar (PDB), men andra problem, till exempel respitperiod för poddavslut överskrider den återstående timeouten per nod eller podden fortfarande är i ett körningstillstånd, kan också orsaka oanvändbara noder.
| Värde |
Description |
|
Cordon
|
AKS kommer att spärra de blockerade noderna och ersätta dem med överspänningsnoder under uppgraderingen. De blockerade noderna kommer att spärras av och ersättas av överspänningsnoder. De blockerade noderna har etiketten "kubernetes.azure.com/upgrade-status:Quarantined". En överspänningsnod behålls för varje blockerad nod. Ett bästa försök görs att ta bort alla andra överspänningsnoder. Om det finns tillräckligt med överspänningsnoder för att ersätta blockerade noder är uppgraderingsåtgärden och det hanterade klustret i feltillstånd. Annars avbryts uppgraderingsåtgärden och det hanterade klustret.
|
|
Schedule
|
AKS markerar de blockerade noderna som kan schemaläggas, men de blockerade noderna uppgraderas inte. Ett bästa försök görs att ta bort alla överspänningsnoder. Uppgraderingsåtgärden och det hanterade klustret är i fel tillstånd om det finns några blockerade noder.
|
VirtualMachineNodes
Objekt
Aktuell status för en grupp noder med samma vm-storlek.
| Name |
Typ |
Description |
|
count
|
integer
(int32)
|
Antal noder.
|
|
size
|
string
|
Storleken på den virtuella datorn för de agenter som används som värd för den här gruppen med noder.
|
VirtualMachinesProfile
Objekt
Specifikationer för VirtualMachines-agentpoolen.
| Name |
Typ |
Description |
|
scale
|
ScaleProfile
|
Specifikationer för hur du skalar en VirtualMachines-agentpool.
|
WorkloadRuntime
Uppräkning
Avgör vilken typ av arbetsbelastning en nod kan köra.
| Värde |
Description |
|
OCIContainer
|
Noder använder Kubelet för att köra standardarbetsbelastningar för OCI-container.
|
|
WasmWasi
|
Noder använder Krustlet för att köra WASM-arbetsbelastningar med WASI-providern (förhandsversion).
|
|
KataVmIsolation
|
Noder kan använda (Kata + Cloud Hypervisor + Hyper-V) för att aktivera kapslade VM-baserade poddar. På grund av användningen av Hyper-V är AKS-nod-OS själv en nästlad VM (rot-OS:et) av Hyper-V. Därför kan den bara användas med VM-serier som stöder kapslad virtualisering, till exempel Dv3-serien.
|