<p>I am in the middle of creating a function to schedule node pool scaling on azure. </p>

<p>This was fairly easy using the AKS Module and creating a function to scale the nodepool, but now the development team has started using multuple node pools in the same kubernetes service, usually i would just use the Set-AzAks as follow </p>

<pre class="lang-bsh prettyprint-override"><code>Set-AzAks -Name &lt;name&gt; -ResourceGroupName &lt;rgname&gt; -NodeCount 1
</code></pre>

<p>But i seem unable to specify individual node pools in the command. I have been able to use the az CLI tool to get the functionality i want doing it manually, but I really want to use the azure automation account to do this. </p>

<p>Any help would be appreciated</p>

Shadesfear
<p>This is an <a href="https://github.com/Azure/azure-powershell/issues/8934" rel="nofollow noreferrer">issue</a> which already existed in the Github. So I think it's not a good way to use the PowerShell command <code>Set-AzAks</code> to scale the AKS nodes count in the current situation.</p>

<p>For this, I recommend you to use the Azure REST API <a href="https://learn.microsoft.com/en-us/rest/api/aks/managedclusters/createorupdate" rel="nofollow noreferrer">Managed Clusters - Create Or Update</a> through PowerShell, it will also work perfectly as the Azure CLI commands for you.</p>

<p><strong>Update:</strong></p>

<p>As you wish, I will show you the example below:</p>

<pre><code>$body = '{
  "location": "eastus",
  "properties": {
    "kubernetesVersion": "1.14.6",
    "dnsPrefix": "xxxxx",
    "agentPoolProfiles": [
      {
        "count": 2,
        "vmSize": "Standard_DS2_v2",
        "osDiskSizeGB": 100,
        "vnetSubnetID": "xxxxxxxx",
        "maxPods": 30,
        "osType": "Linux",
        "type": "AvailabilitySet",
        "orchestratorVersion": "1.14.6",
        "name": "agentpool"
      }
    ],
    "addonProfiles": {
      "httpapplicationrouting": {
        "enabled": false,
        "config": {}
      },
      "omsagent": {
        "enabled": true,
        "config": {
          "loganalyticsworkspaceresourceid": "xxxxxxxx"
        }
      }
    },
    "nodeResourceGroup": "xxxxxxxxx",
    "enableRBAC": true,
    "networkProfile": {
      "networkPlugin": "azure",
      "serviceCidr": "10.1.0.0/16",
      "dnsServiceIP": "10.1.0.10",
      "dockerBridgeCidr": "172.17.0.1/16",
      "loadBalancerSku": "Basic"
    }
  }
}'
$requestUri = "https://management.azure.com/subscriptions/{subscription_id}/resourceGroups/{your_group_name}/providers/Microsoft.ContainerService/managedClusters/{your_cluster_name}?api-version=2019-08-01"
$accessToken = "xxxxxxx"
Invoke-RestMethod -Headers @{Authorization = "Bearer $accessToken"} -Uri $requestUri -Method PUT -ContentType 'application/json' -Body $body
</code></pre>

<p>You can change the context in the body as you need and the properties describe in the REST API.</p>
