こんにちは。cloud.config Divの神田です。
今回は構築中に遭遇した、App Service Environment(ASE)にデプロイしたFunction Appが、
バックアップから復元できなかった問題について書きます。
インフラ構成
今回のインフラ構成は以下の画像の通りです。
内部ASEにFunction Appを作成し、ASEが割り当てられているサブネットから外部へのアクセスを、
Route Tableを用いてAzure Firewall経由で行うように構成します。
また、Function AppのバックアップをStorage Accountに格納するようにします。






問題
上記の構成を行った際に、Function Appのバックアップ作成は成功しますが、
以下のエラーメッセージとともにバックアップの復元が失敗するという現象が発生します。
エラーメッセージストレージ BLOB からの復元操作に失敗しました。エラーの詳細:Error occurred while downloading meta data from the storage account.


対処法
上記の事象ですが、Storage AccountのFirewallに 100.64.0.0/10
からの通信を許可することで対処することができます。
こちらのIPアドレスはキャリアグレードNATと呼ばれるIPアドレスであり、
Function AppやApp Serviceではバックアップの復元にこのIPアドレスを使用しているので、
内部ASEのような閉じた環境でバックアップからの復元をする際には、
場合によっては通信を許可する必要があるそうです。



最後に
App Service EnvironmentはApp Serviceを仮想ネットワーク内にデプロイできるサービスですが、
他のリソースとの依存関係や、バックグラウンドで使用するために通信を許可しなければならないIPアドレスがいくつか存在しているので、
構成やセキュリティの制限が複雑になってしまいます。
IP制限をかける際は注意しましょう。