Skip to content

Instantly share code, notes, and snippets.

@oliverlabs
Created February 15, 2023 10:44
Show Gist options
  • Save oliverlabs/60e985a7d69dccd03f944a4507e9a10f to your computer and use it in GitHub Desktop.
Save oliverlabs/60e985a7d69dccd03f944a4507e9a10f to your computer and use it in GitHub Desktop.
AKS Start Stop PowerShell Script
Param
(
[Parameter (Mandatory=$true)]
[string]$AKSResourceGroup,
[Parameter (Mandatory=$true)]
[string]$AKSName,
[Parameter (Mandatory=$true)]
[string]$subscriptionID,
[Parameter (Mandatory=$true,HelpMessage="start or stop")]
[string]$Action
)
Connect-AzAccount -Identity
Set-AzContext -SubscriptionId $subscriptionID
if ($Action -eq "start") {
Get-AzAksCluster -Name $AKSName -ResourceGroupName $AKSResourceGroup
#####################
Start-AzAksCluster -Name $AKSName -ResourceGroupName $AKSResourceGroup
}
elseif ($Action -eq "stop") {
Get-AzAksCluster -Name $AKSName -ResourceGroupName $AKSResourceGroup
#####################
Stop-AzAksCluster -Name $AKSName -ResourceGroupName $AKSResourceGroup
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment