Más contenido relacionado La actualidad más candente (20) Similar a 俺の俺による俺のための App Service Environment (20) 俺の俺による俺のための App Service Environment4. ASE とは?
4
Azure App Service Environment は、
App Service アプリを大規模かつ安全に
実行するために完全に分離された専用の
環境を提供する、Azure App Service の
機能です。
https://docs.microsoft.com/ja-jp/azure/app-service/environment/intro
7. ASE ここが素晴らしい
• App Service を仮想ネットワーク内に配
置させることができる
– ExpressRoute や VPN 経由でオンプレミス
にあるリソースを使うことができる。
• インターネットから完全に切り離された
App Service を作れる
7
12. 今日のお品書き
• 今日話すこと
– App Service Environment V2
– 内部ロードバランサーの App Service Environment
• 今日話さないこと
– App Service Environment V1
– 外部ロードバランサーの App Service Environment
12
27. PowerShell 実行して
27
$certificate = New-SelfSignedCertificate `
-certstorelocation "cert:¥localmachine¥my" `
-dnsname "*.harutama-example.org","*.scm.harutama-example.org" `
-NotAfter (Get-Date).AddYears(100);
$certThumbprint = "cert:¥localMachine¥my¥" + $certificate.Thumbprint;
$password = ConvertTo-SecureString -String "Password1!" -Force -AsPlainText;
$fileName = "harutama-example.pfx";
Export-PfxCertificate -cert $certThumbprint `
-FilePath $fileName -Password $password;
$fileContentBytes = get-content -encoding byte $fileName;
$fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes);
$fileContentEncoded | set-content ($fileName + ".b64");
36. 今の状態
• ASE のドメインはどこにも登録されてない
– インターネットから直接参照できたら意味がない
– イントラ側も名前解決するところ(DNS)がない
• サブネットの中に Web App が配置された
– 同じ仮想ネットワーク内でないとアクセスできない
– サブネット間の通信は NSG によってコントロール
• バーチャルホストへのアクセスなので
リクエストに Host ヘッダが無いとサイトが見えない
– 詳しくは後で
36
65. DNS の選択肢
• HOSTS ファイルで頑張る
– 辛くて無理
• Azure DNS プラーベートゾーン
– おすすめしたいけど今はプレビュー
• DNS サーバーを自前で作って頑張る
– イントラに DNS があって接続できるなら候補
• Azure AD ドメインサービス (AADDS) の DNS
– AADDS を使っているのならば選択肢
65
66. Azure DNS Private Zones
66https://docs.microsoft.com/ja-jp/azure/dns/private-dns-overview
80. Application Gateway の機能
• Web アプリケーションファイアウォール(WAF)
• HTTP の負荷分散
• SSL オフロード
• リクエストのリダイレクト
• 正常性の監視
• Cookie ベースのセッション アフィニティ
とかとか
80
82. Application Gateway を作る
• ポータルから作れないことはないです
– 設定することがめっちゃ多い
– 設定変更の反映に20分くらいかかる
– ちゃんと構成できてるか自信を失う
• PowerShell や ARM で作ることをおすす
めします
82
83. このくらい長いです
83
#
# Login-AzureRmAccount
#
# Subscription
Select-AzureRmSubscription -Subscriptionid "35efd6bc-33c4-415f-9f07-3760277e78e1"
$vnet = Get-AzureRmVirtualNetwork -Name "DemoNet" -ResourceGroupName "GABC-Infra"
$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "AppGatewaySubnet" -VirtualNetwork $vnet
$publicip = Get-AzureRmPublicIpAddress -Name "PubIP-AppGW" -ResourceGroupName "GABC-AppGW"
# https://azure.microsoft.com/ja-jp/documentation/articles/application-gateway-create-gateway-arm/
# Custom Plobe
$probe = New-AzureRmApplicationGatewayProbeConfig -Name "probe" -HostName "harutama.gekkyoku-teiso.info" `
-Protocol Http -Path '/' -Interval 30 -Timeout 120 -UnhealthyThreshold 8
# Backend Pool
$gipconfig = New-AzureRmApplicationGatewayIPConfiguration -Name "appgatewayip" -Subnet $subnet
$pool = New-AzureRmApplicationGatewayBackendAddressPool -Name "apppool" -BackendIPAddresses "172.30.10.11"
$poolSetting = New-AzureRmApplicationGatewayBackendHttpSettings -Name "apppoolsetting" -Port 80 -Protocol Http `
-CookieBasedAffinity Disabled -Probe $probe
# Frontend IP
$fipconfig = New-AzureRmApplicationGatewayFrontendIPConfig -Name "fipconfig" -PublicIPAddress $publicip
# HTTPS Cert
$https_cert_password = ConvertTo-SecureString "Password1!" -AsPlainText -Force
$https_cert = New-AzureRmApplicationGatewaySslCertificate -Name "https-cert" `
-CertificateFile "C:¥Users¥SunaoTomita¥Dropbox¥release¥20180421GlobalAzureBootCamp¥harutama-com.pfx" -Password
$https_cert_password
# Frontend HTTPS
$https_fp = New-AzureRmApplicationGatewayFrontendPort -Name "https-frontend" -Port 443
$https_listener_appgw = New-AzureRmApplicationGatewayHttpListener -Name "https-listener-appgw" -Protocol Https `
-FrontendIPConfiguration $fipconfig -FrontendPort $https_fp -SslCertificate $https_cert `
-HostName "harutama-appgw.westus2.cloudapp.azure.com"
$https_rule_appgw = New-AzureRmApplicationGatewayRequestRoutingRule -Name "https-rule-appgw" -RuleType "Basic" `
-BackendHttpSettings $poolSetting -HttpListener $https_listener_appgw -BackendAddressPool $pool
# Frontend HTTP
$http_fp = New-AzureRmApplicationGatewayFrontendPort -Name "http-frontend" -Port 80
$http_listener_appgw = New-AzureRmApplicationGatewayHttpListener -Name "http-listener-appgw" -Protocol Http `
-FrontendIPConfiguration $fipconfig -FrontendPort $http_fp `
-HostName "harutama-appgw.westus2.cloudapp.azure.com"
$http_redirect_appgw = New-AzureRmApplicationGatewayRedirectConfiguration -Name "redirect-http-https-appgw" -RedirectType
Permanent `
-TargetListener $https_listener_appgw -IncludePath $true -IncludeQueryString $true
$http_rule_appgw = New-AzureRmApplicationGatewayRequestRoutingRule -Name "http-rule-appgw" `
-RuleType Basic -HttpListener $http_listener_appgw -RedirectConfiguration $http_redirect_appgw
# Sku
$sku = New-AzureRmApplicationGatewaySku -Name Standard_Small -Tier Standard -Capacity 1
# SSL Policy
$policy = New-AzureRmApplicationGatewaySslPolicy -PolicyType Predefined -PolicyName "AppGwSslPolicy20170401S"
# Create App Gateway !!!!!!!!!!!!!!!!!!!!!
$appgw = New-AzureRmApplicationGateway -Name "AppGW-Harutama" -ResourceGroupName "GABC-AppGW" -Location "West US 2" `
-BackendAddressPools $pool -BackendHttpSettingsCollection $poolSetting `
-SslCertificates $https_cert -AuthenticationCertificates $poolCert `
-FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $http_fp, $https_fp `
-HttpListeners $http_listener_appgw, $https_listener_appgw `
-RequestRoutingRules $http_rule_appgw, $https_rule_appgw `
-RedirectConfiguration $http_redirect_appgw `
-Sku $sku -Probes $probe -SslPolicy $policy
87. App Service Environment
• いろいろ面倒
– 証明書、DNS、アプリのデプロイとかとか
いろいろ用意するものと考えることはある。
– 仮想マシン運用するよりとっても健全。
• Web App のメリットはそのまんま
– ちゃんと構成すれば自動で運用もできます。
• そして高い…
87
89. Let’s dream and then let’s build.
- Ray Ozzie
冨田 順 (@harutama)
http://twitter.com/harutama
89