0

Is it possible to run this two commands as a PowerShell cmdlet?

az aks stop --name myAKSCluster --resource-group myResourceGroup

az aks start --name myAKSCluster --resource-group myResourceGroup

I cannot find the PowerShell equivalent here: https://learn.microsoft.com/en-us/powershell/module/az.aks/?view=azps-6.2.1

The reason why I'm asking this:

  • I would like to run those commands within an Azure Automation runbook, so therefore I need the PowerShell cmdlets. Or is there any other way to run azure cli from a runbook?

Thanks for your help

Peter Wyss
  • 395
  • 2
  • 16

2 Answers2

0

Using Powershell cmdlet you can run in Azure Automation runbook to start /stop AKS cluster here.

az aks stop --name myAKSCluster --resource-group myResourceGroup

az aks start --name myAKSCluster --resource-group myResourceGroup

You Can use this above command in Azure CLI to stop and start a Kubernetes Service Cluster.

To Start and Stop AKS Cluster using Powershell You need to use below example code:

Start-AzAksCluster -ResourceGroupName group -Name myCluster
Stop-AzAksCluster -ResourceGroupName group -Name myCluster

For further details please refer this Link.

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15
0

Usually if we use PowerShell then Automation runbook can work for us. Unfortunately I could not find PowerShell to start/ stop AKS. I found this marketplace solution that runs a VM and shuts down/ starts AKS cluster on the time specified. Refer this link for the deployment - https://azuremarketplace.microsoft.com/en-in/marketplace/apps/bowspritconsultingopcprivatelimited1596291408582.aksautomation2?tab=Overview

kunal
  • 456
  • 5
  • 4