LoginSignup
1
1

More than 5 years have passed since last update.

Azure SQL接続用プロキシ

Last updated at Posted at 2018-10-07

個人メモ。
Azure SQLを利用する場合、オンプレミスの端末からのアクセスにはExpress Routeも必要となる。
Express Routeはケチりたかったため、Azure SQLにアクセスできるAzure上のCentOSの仮想マシンにNginxをインストールして、オンプレミスの端末から踏み台にさせて接続できるようにする。

Nginx

・インストール

[user@centos7 ~]$ sudo yum -y install gcc openssl-devel pcre-devel
[user@centos7 ~]$ cd /tmp
[user@centos7 tmp]$ wget http://nginx.org/download/nginx-1.12.2.tar.gz
[user@centos7 tmp]$ tar xvfz nginx-1.12.2.tar.gz
[user@centos7 tmp]$ cd nginx-1.12.2
[user@centos7 nginx-1.12.2]$ sudo ./configure --prefix=/opt/nginx --with-stream
[user@centos7 nginx-1.12.2]$ sudo make
[user@centos7 nginx-1.12.2]$ sudo make install

・設定

nginx.conf
stream {
    server {
        listen 1433;
        proxy_pass sqlsv-hogefuga-001.database.windows.net:1433;
    }
}

オンプレミスからの接続

接続先:CentOSのIPアドレス
ユーザー名:Azure SQLユーザー名@sqlsv-hogefuga-001

注意

NSGの設定をそれなりにしている場合は、Azure SQLへのTCP 1433の通信が設定されているかなど確認をしておくこと

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1