diff --git a/samples/manage/azure-sql-db-managed-instance/prepare-subnet/prepareSubnet.ps1 b/samples/manage/azure-sql-db-managed-instance/prepare-subnet/prepareSubnet.ps1 index 51b6995a..34c553e4 100644 --- a/samples/manage/azure-sql-db-managed-instance/prepare-subnet/prepareSubnet.ps1 +++ b/samples/manage/azure-sql-db-managed-instance/prepare-subnet/prepareSubnet.ps1 @@ -14,7 +14,7 @@ function Ensure-Login () Write-Host "Loging in ..." If((Login-AzureRmAccount -ErrorAction SilentlyContinue -ErrorVariable Errors) -eq $null) { - Write-Host ("Login failed: {0}" -f $Errors.Message) -ForegroundColor Red + Write-Host ("Login failed: {0}" -f $Errors[0].Exception.Message) -ForegroundColor Red Break } } @@ -36,7 +36,7 @@ function Select-SubscriptionId { Catch { Write-Host "Subscription selection failed: $_" -ForegroundColor Red - Exit + Break } } Write-Host "Subscription selected." -ForegroundColor Green @@ -57,7 +57,7 @@ function Load-VirtualNetwork { else { Write-Host "Virtual network not found." -ForegroundColor Red - Exit + Break } } @@ -78,7 +78,7 @@ function Load-VirtualNetworkSubnet { else { Write-Host "Subnet not found." -ForegroundColor Red - Exit + Break } } @@ -94,7 +94,7 @@ function Verify-Subnet { Else { Write-Host "Failed Validation - Minimum supported subnet size is /28." -ForegroundColor Red - Exit + Break } If( ($subnet.IpConfigurations.Count -eq 0) -and @@ -109,7 +109,7 @@ function Verify-Subnet { Else { Write-Host "Failed Validation - Subnet is already in use." -ForegroundColor Red - Exit + Break } }