-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathDeleteCluster.ps1
33 lines (29 loc) · 1.04 KB
/
DeleteCluster.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[CmdletBinding(PositionalBinding=$True)]
Param(
[Parameter(Mandatory = $true)]
[ValidatePattern("^[a-z0-9-]*$")]
[ValidateLength(8,64)]
[String]$ClusterName # required needs to be alphanumeric or "-"
)
###########################################################
# Start - Initialization - Invocation, Logging etc
###########################################################
$VerbosePreference = "SilentlyContinue"
$ErrorActionPreference = "Stop"
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath
& "$scriptDir\..\..\init.ps1"
if(-not $?)
{
throw "Initialization failure."
exit -9999
}
###########################################################
# End - Initialization - Invocation, Logging etc
###########################################################
Write-InfoLog "Deleting Azure HDInsight cluster: $ClusterName" (Get-ScriptName) (Get-ScriptLineNumber)
$cluster = Get-AzureHDInsightCLuster -Name $ClusterName
if($cluster)
{
Remove-AzureHDInsightCluster -Name $ClusterName
}