0

Azure SQL Managed Instance is placed in private Azure VNet with private IP address.

How can I connect to the instance directly from my local machine/laptop? How to connect my machine to the VNet where the instance is placed using point-to-site connection?

Jovan MSFT
  • 13,232
  • 4
  • 40
  • 55

1 Answers1

0

You can run the following script and populate subscription id, name of the resource group where VNet is placed, and virtual network name:

$scriptUrlBase = 'https://raw.githubusercontent.com/Microsoft/sql-server-samples/master/samples/manage/azure-sql-db-managed-instance/attach-vpn-gateway'

$parameters = @{
    subscriptionId = '<subscription id>'
    resourceGroupName = '<resource group name>'
    virtualNetworkName = '<virtual network name>'
    certificateNamePrefix  = '<name prefix of the automatically generated certificate>'
}

Invoke-Command -ScriptBlock ([Scriptblock]::Create((iwr ($scriptUrlBase+'/attachVPNGateway.ps1?t='+ [DateTime]::Now.Ticks)).Content)) -ArgumentList $parameters, $scriptUrlBase

This script will create certificate that will be used to connect to VNet. Then you need to find a Gateway, download and install VPN client and connect to the VNet. Then you will be able to connect to instance from your computer.

If you open the details of the instance in Azure portal you will see pre-populated values in Quick-start section.

See https://learn.microsoft.com/en-us/azure/sql-database/sql-database-managed-instance-configure-p2s for more details.

Jovan MSFT
  • 13,232
  • 4
  • 40
  • 55