Skip to content

Commit d440e93

Browse files
fixed sharedkey
1 parent a5c2753 commit d440e93

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

Step 3C. Attach Azure S2S to Existing Network.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ $currentGwConnection = Get-AzVirtualNetworkGatewayConnection -Name $AzureExistin
408408
-ResourceGroupName $AzureExistingConfig.ResourceGroupName -ErrorAction SilentlyContinue
409409
If($Force){
410410
Write-Host ("Force is impletemented. Rebuilding router's VPN settings...") -ForegroundColor Cyan
411-
$Global:sharedPSKKey = Get-AzVirtualNetworkGatewayConnectionSharedKey -Name $AzureExistingConfig.ConnectionName -ResourceGroupName $AzureExistingConfig.ResourceGroupName
411+
$Global:sharedPSKKey = Get-AzVirtualNetworkGatewayConnectionSharedKey -Name $AzureExistingConfig.ConnectionName `
412+
-ResourceGroupName $AzureExistingConfig.ResourceGroupName -ErrorAction SilentlyContinue
412413
$VyOSConfig['ResetVPNConfigs'] = $true
413414
}
414415
ElseIf( ($currentGwConnection).ConnectionStatus -eq "Connected")
@@ -454,7 +455,8 @@ Else{
454455
If( ($response1 -eq 'Y') -or ($VyOSConfig['ResetVPNConfigs'] -eq $true) )
455456
{
456457
Write-Host ("Attempting to update vyos router vpn configurations to use Azure's public IP [{0}]..." -f $azpip.IpAddress) -ForegroundColor Yellow
457-
$Global:sharedPSKKey = Get-AzVirtualNetworkGatewayConnectionSharedKey -Name $AzureExistingConfig.ConnectionName -ResourceGroupName $AzureExistingConfig.ResourceGroupName
458+
$Global:sharedPSKKey = Get-AzVirtualNetworkGatewayConnectionSharedKey -Name $AzureExistingConfig.ConnectionName `
459+
-ResourceGroupName $AzureExistingConfig.ResourceGroupName -ErrorAction SilentlyContinue
458460
$VyOSConfig['ResetVPNConfigs'] = $true
459461
}
460462
Else{

configs.ps1

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,22 @@ If(!$Global:randomChar){
224224
#endregion
225225

226226
If(Test-SameSubnet -Ip1 ($OnPremSubnetCIDR -replace '/\d+$','') -ip2 ($AzureSiteAHubCIDR -replace '/\d+$','') ){
227-
Write-Host ("[`$OnPremSubnetCIDR] and [`$AzureSiteAHubCIDR] variables cannot be in the same subnet space!" ) -ForegroundColor Red
227+
Write-Host ("[`$OnPremSubnetCIDR] and [`$AzureSiteAHubCIDR] variables cannot be in the same subnet space!" ) -ForegroundColor Black -BackgroundColor Red
228228
break
229229
}
230230

231231
If(Test-SameSubnet -Ip1 ($OnPremSubnetCIDR -replace '/\d+$','') -ip2 ($AzureSiteBHubCIDR -replace '/\d+$','') ){
232-
Write-Host ("[`$OnPremSubnetCIDR] and [`$AzureSiteBHubCIDR] variables cannot be in the same subnet space!" ) -ForegroundColor Red
232+
Write-Host ("[`$OnPremSubnetCIDR] and [`$AzureSiteBHubCIDR] variables cannot be in the same subnet space!" ) -ForegroundColor Black -BackgroundColor Red
233233
break
234234
}
235235

236236
If(Test-SameSubnet -Ip1 ($AzureSiteAHubCIDR -replace '/\d+$','') -ip2 ($AzureSiteASpokeCIDR -replace '/\d+$','') ){
237-
Write-Host ("[`$AzureSiteAHubCIDR] and [`$AzureSiteASpokeCIDR] variables cannot be in the same subnet space!" ) -ForegroundColor Red
237+
Write-Host ("[`$AzureSiteAHubCIDR] and [`$AzureSiteASpokeCIDR] variables cannot be in the same subnet space!" ) -ForegroundColor Black -BackgroundColor Red
238238
break
239239
}
240240

241241
If(Test-SameSubnet -Ip1 ($AzureSiteBHubCIDR -replace '/\d+$','') -ip2 ($AzureSiteBSpokeCIDR -replace '/\d+$','') ){
242-
Write-Host ("[`$AzureSiteBHubCIDR] and [`$AzureSiteBSpokeCIDR] variables cannot be in the same subnet space!" ) -ForegroundColor Red
242+
Write-Host ("[`$AzureSiteBHubCIDR] and [`$AzureSiteBSpokeCIDR] variables cannot be in the same subnet space!" ) -ForegroundColor Black -BackgroundColor Red
243243
break
244244
}
245245

@@ -274,9 +274,12 @@ If(!$NoAzureCheck){
274274
$Global:AzSubscription = Get-AzSubscription -WarningAction SilentlyContinue | Out-GridView -PassThru -Title "Select a valid Azure Subscription" | Select-AzSubscription -WarningAction SilentlyContinue
275275
Set-AzContext -Tenant $Global:AzSubscription.Tenant.id -SubscriptionId $Global:AzSubscription.Subscription.id | Out-Null
276276
}
277-
Write-Host ("Using Account ID: {0} " -f $Global:AzSubscription.Account.Id) -ForegroundColor Green
278-
Write-Host ("Using Tenant ID: {0} " -f $Global:AzSubscription.Tenant.Id) -ForegroundColor Green
279-
Write-host ("Using Subscription: {0} " -f $Global:AzSubscription.Subscription.Name) -ForegroundColor Green
277+
Write-Host ("Using Account ID: ") -ForegroundColor White
278+
Write-Host ("{0}" -f $Global:AzSubscription.Account.Id) -ForegroundColor Green
279+
Write-Host ("Using Tenant ID: ") -ForegroundColor White
280+
Write-Host ("{0}" -f $Global:AzSubscription.Tenant.Id) -ForegroundColor Green
281+
Write-host ("Using Subscription: ") -ForegroundColor White
282+
Write-Host ("{0}" -f $Global:AzSubscription.Subscription.Name) -ForegroundColor Green
280283
}
281284
}
282285
#endregion

0 commit comments

Comments
 (0)