Skip to content

Commit 972ca56

Browse files
mod: verify ps version for attach p2s
1 parent 68c8aff commit 972ca56

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

samples/manage/azure-sql-db-managed-instance/attach-vpn-gateway/attachVPNGateway.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ $force = $parameters['force']
88

99
$scriptUrlBase = $args[1]
1010

11+
function VerifyPSVersion
12+
{
13+
Write-Host "Verifying PowerShell version, must be 5.0 or higher."
14+
if($PSVersionTable.PSVersion.Major -ge 5)
15+
{
16+
Write-Host "PowerShell version verified." -ForegroundColor Green
17+
}
18+
else
19+
{
20+
Write-Host "You need to install PowerShell version 5.0 or heigher." -ForegroundColor Red
21+
Break;
22+
}
23+
}
24+
1125
function Ensure-Login ()
1226
{
1327
$context = Get-AzureRmContext
@@ -156,6 +170,7 @@ function CalculateVpnClientAddressPoolPrefix
156170

157171
}
158172

173+
VerifyPSVersion
159174
Ensure-Login
160175
Select-SubscriptionId -subscriptionId $subscriptionId
161176

0 commit comments

Comments
 (0)