0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Azure】App ServiceからSQL Databaseに接続できるようにする

Posted at

Azure App Service から Azure SQL Database にアクセスできるようにするためには初回に設定を行う必要があります。

作業のたびに毎回調べているため資料に残します。

結論

下記コマンドを使用します。

az webapp connection create sql --system-identity
-g <your-resource-group>
-n <your-app-service-name>
--tg <your-database-server-resource-group>
--server <your-database-server-name>
--database <your-database-name>

使用するパラメーターはそれぞれ下記です。

パラメータ 説明
your-resource-group App Service が存在しているリソースグループ名
your-app-service-name 接続元の App Service 名
your-database-server-resource-group SQL Database が存在するリソースグループ名
your-database-server-name Database が存在する server 名
your-database-name Database 名

1 行目を実行すると 2 行目以降は対話的に実行できます。
また上記のコマンドはMicrosoft Entraでパスワードレス認証を行うものです。

SQL 認証を行う際は--system-identityをなくせば OK です。対話的に実行している際にユーザーとパスワード入力が追加されます。

パスワードを入力する際は画面上に入力内容が表示されないため心の目を信じて入力してください。

おわりに

これで、Azure App Service から Azure SQL Database への接続がスムーズに行えるようになります。ぜひ参考にしてみてください。

この記事が皆様のコーディングライフの助けになれば幸いです。

参考

Azure SQL Database Quickstart

0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?