Incorrectly tries to do ipsec in Windows PS7, which has PSEdition = Core. Adding `-or` logic.
Attaches VPN gateway to Managed Instance virtual network
Contents
About this sample
Before you begin
Run this sample
Sample details
Disclaimers
Related links
About this sample
- Applies to: Azure SQL Database
- Key features: Managed Instance
- Workload: n/a
- Programming Language: PowerShell
- Authors: Srdan Bozovic
- Update history: n/a
Before you begin
To run this sample, you need the following prerequisites.
Software prerequisites:
- PowerShell 5.1 or PowerShell Core 6.0
- Azure PowerShell Az module
Linux prerequisites
- strongSwan
Azure prerequisites:
- Permission to manage Azure virtual network
Run this sample
Run the script below from PowerShell
$scriptUrlBase = 'https://raw.githubusercontent.com/Microsoft/sql-server-samples/master/samples/manage/azure-sql-db-managed-instance/attach-vpn-gateway'
$parameters = @{
subscriptionId = '<subscriptionId>'
resourceGroupName = '<resourceGroupName>'
virtualNetworkName = '<virtualNetworkName>'
certificateNamePrefix = '<certificateNamePrefix>'
}
Invoke-Command -ScriptBlock ([Scriptblock]::Create((iwr ($scriptUrlBase+'/attachVPNGateway.ps1?t='+ [DateTime]::Now.Ticks)).Content)) -ArgumentList $parameters, $scriptUrlBase
Sample details
This sample shows how to attach VPN Gateway to Managed Instance virtual network using PowerShell
This is done in three steps:
- Create and install certificates on client machine
- Calculate future VPN Gateway subnet IP range
- Deploy ARM template that will attach VPN Gateway to subnet
Disclaimers
The scripts and this guide are copyright Microsoft Corporations and are provided as samples. They are not part of any Azure service and are not covered by any SLA or other Azure-related agreements. They are provided as-is with no warranties express or implied. Microsoft takes no responsibility for the use of the scripts or the accuracy of this document. Familiarize yourself with the scripts before using them.
Related Links
For more information, see these articles: