Hi @teamdever ,
With the features that are currently available, to disable an AKS node pool's auto-scaling via Powershell, I would recommend to leverage Agent Pools - Create Or Update REST API and Invoke-RestMethod PowerShell cmdlets and create an Azure Automation runbook something as shown below.
$SubscriptionID = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$ResourceGroupName = "xxxxxxxxxxxxxxxxxxxxxx"
$AKSClusterName = "xxxxxxxxxxxxxxxxxxx"
$AgentPoolName = "xxxxxxxxxxxxxxxxxxx"
$URI = "https://management.azure.com/subscriptions/$SubscriptionID/resourceGroups/$ResourceGroupName/providers/Microsoft.ContainerService/managedClusters/$AKSClusterName/agentPools/$AgentPoolName"+"?api-version=2022-01-01"
$Body = @{
properties = @{
enableAutoScaling = "false";
mode = "System"
}
}
$Body.properties.enableAutoScaling=$false
$JSONBody = $Body | ConvertTo-Json
$azContext = (Connect-AzAccount -Identity).context
$azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile
$profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile)
$token = $profileClient.AcquireAccessToken($azContext.Subscription.TenantId)
$authHeader = @{
'Content-Type'='application/json'
'Authorization'='Bearer ' + $token.AccessToken
}
$response = Invoke-RestMethod -Uri $URI -Method PUT -Headers $authHeader -Body $JSONBody
$response | fl *
On the other hand, as we have feature to disable AKS node pool's auto-scaling via Agent Pools - Create Or Update REST API and az aks nodepool update CLI commands so we are supposed to have the same feature via direct Azure PowerShell cmdlet as well. So, I am reaching out to our internal team to check on this and will keep you updated as I hear more information.