Skip to content

Commit 2b6fe1b

Browse files
committed
add dowtime prompt
1 parent 5990569 commit 2b6fe1b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

AzureBasicLoadBalancerUpgrade/module/AzureBasicLoadBalancerUpgrade/modules/Start-AzBasicLoadBalancerUpgrade/Start-AzBasicLoadBalancerUpgrade.psm1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ function Start-AzBasicLoadBalancerUpgrade {
173173
[Parameter(Mandatory = $false)][switch] $outputMigrationValiationObj,
174174
[Parameter(Mandatory = $false)][int32] $defaultJobWaitTimeout = (New-Timespan -Minutes 10).TotalSeconds,
175175
[Parameter(Mandatory = $false)][switch] $force,
176+
[Parameter(Mandatory = $false)][boolean] $confirm = $true,
176177
[Parameter(Mandatory = $false)][switch] $Pre
177178
)
178179

@@ -194,6 +195,20 @@ function Start-AzBasicLoadBalancerUpgrade {
194195
Write-Error "The path '$recoveryBackupPath' specified with parameter recoveryBackupPath must exist and be a valid directory." -terminateOnError
195196
}
196197

198+
# warn user about application downtime
199+
If ((($confirm) -and !$force) -and !(Test-Path -Path (Join-Path -Path $RecoveryBackupPath -ChildPath 'Start-AzBasicLoadBalancerUpgrade.log'))) {
200+
$message = "This operation will cause downtime for the application(s) using the Basic Load Balancer--usually a few minutes--see https://aka.ms/BasicLBMigrateDowntime. Are you sure you want to continue? [y/N]"
201+
$result = Read-Host -Prompt $message
202+
If ($result -ne 'y' -and $result -ne 'yes') {
203+
Write-Host "Operation cancelled by user"
204+
return
205+
}
206+
Else {
207+
Write-Host -ForegroundColor Green "`nSpecify parameter ``-confirm `$false`` to skip this prompt in the future`n"
208+
Start-Sleep -Seconds 2
209+
}
210+
}
211+
197212
log -Message "############################## Initializing Start-AzBasicLoadBalancerUpgrade ##############################"
198213

199214
log -Message "[Start-AzBasicLoadBalancerUpgrade] PowerShell Version: $($PSVersionTable.PSVersion.ToString())"

0 commit comments

Comments
 (0)