Automate AKS Stop

Subin Sabu 40 Reputation points
2025-07-17T04:42:09.3866667+00:00

Hi, I have an AKS cluster that need to be stopped daily. What are my options to automate this, I tried Automate Account on Azure, created a powershell script, scheduled it. But after the process, my cluster was actually in failed state, I had to reconcile, I'm not sure what caused it. If this is a one time issue, I can still use it since it is the best and simple cost effective way. Can anyone confirm the cause of this issue and suggest if there are more simple ways. I will attach the script here. Thank You.

Error message: An internal error occurred. This is usually some internal issue that you cannot fix on your side. If the error persists, please contact AKS support.

Script:


$resourceGroup = "xyz"
$aksName = "abc"


Connect-AzAccount -Identity

Stop-AzAksCluster -ResourceGroupName $resourceGroup -Name $aksName

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
0 comments No comments
{count} votes

Accepted answer
  1. Akram Kathimi 1,751 Reputation points Microsoft Employee
    2025-07-17T07:55:23.1333333+00:00

    @Subin Sabu Thank you for posting this question.

    Yes, the easiest way is what you have up there ;).
    Regarding the error you faced when you stopped the cluster, I would advise you to create a support request to have an engineer check the cluster. (maybe try stopping the cluster one more time and see if you face any issues).

    Thanks.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.