LoginSignup
14
5

More than 3 years have passed since last update.

AzureAD認証を利用するAppServiceをAppGWで構成設定

Last updated at Posted at 2019-12-09

だいたいこんな感じの環境を作る

image.png

  • トップページは静的サイトでお客様?が運用しています。
  • アプリAは私たちが開発担当
  • アプリBは別の会社が開発担当

のためこのような構成になっています。

基本的には

この設定に
https://blogs.msdn.microsoft.com/waws/2017/11/21/setting-up-application-gateway-with-an-app-service-that-uses-azure-active-directory-authentication/
パスベースでサイト振り分けを行い
https://docs.microsoft.com/ja-jp/azure/application-gateway/create-url-route-portal
V2を使ってカスタムドメインを使わずにRewriteでなんとかしてみました。
https://docs.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-portal

では、実際に設定した値を見てみましょう。

AGW

WAFV2

image.png

Firewallはとりあえずなしにしておく

image.png

Backend poolsの設定

image.png

アプリA

image.png

アプリB

image.png

トップページ用アプリ

image.png

HTTPsetting

image.png

アプリA

image.png

アプリB

image.png

トップページ

image.png

Frontend IPの設定

image.png

image.png

Listnerの設定

image.png

image.png

PIPのドメインで証明書も作っておきます

Ruleの設定

image.png

image.png

注意)Path-baseは初回で設定しないと登録できないかも

Rewriteの設定

image.png

AppService Authの奴だけ設定

image.png

image.png

だいぶ無理やりな設定
(.*)redirect_uri=https%3A%2F%2F40017001.azurewebsites.net(.*)$

image.png

{http_resp_Location_1}redirect_uri=https%3A%2F%2Fn40017.japaneast.cloudapp.azure.com%2Ffastdelivery{http_resp_Location_2}

Health probesの設定

image.png

大事なのは必要なエラーステータスコードも含めておくこと

Topページ用

image.png

アプリA用

image.png

アプリB用

image.png

Appservice

AppserviceのAuthentication

image.png

AzureAD

AGW用のドメインも追加しておく

image.png

終わり

その他のサービスに関しては任意の設定で大丈夫だと思います。
そもそもこんな環境を構築することが他であるかわからないので何の参考にもならないかと思いますが、結構苦戦したので備忘録として残しておきます。

14
5
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
14
5