Created
February 15, 2023 10:44
-
-
Save oliverlabs/60e985a7d69dccd03f944a4507e9a10f to your computer and use it in GitHub Desktop.
AKS Start Stop PowerShell Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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