😀

Azure App Service カスタムバックアップをプレビュー中の仮想ネットワーク経由でやってみた

に公開

今までの Azure App Service カスタムバックアップは、パブリックネットワーク経由の Azure Storage しか選択肢がありませんでした。今回検証する仮想ネットワーク経由のカスタムバックアップはプレビュー中ですが、どのような設定が必要になるのか試してみました。これができるようになると、よりセキュアにシステムを構成する事が可能になりますね。

検証環境を Azure CLI で構築

bash
# 環境変数をセット
region=japaneast
prefix=mnrapbk

# リソースグループを作成
az group create \
  --name ${prefix}-rg \
  --location $region

# 仮想ネットワークを作成
az network vnet create \
  --name ${prefix}-vnet \
  --resource-group ${prefix}-rg \
  --address-prefixes 10.0.0.0/24

# ネットワークセキュリティグループを作成
az network nsg create \
  --resource-group ${prefix}-rg \
  --name ${prefix}-nsg

# サブネットを作成
az network vnet subnet create \
  --resource-group ${prefix}-rg \
  --vnet-name ${prefix}-vnet \
  --name app-subnet \
  --address-prefix 10.0.0.0/26 \
  --network-security-group ${prefix}-nsg \
  --service-endpoints Microsoft.Storage

# ストレージを作成
az storage account create \
  --name ${prefix}stor \
  --resource-group ${prefix}-rg \
  --sku Standard_LRS

# バックアップ用のコンテナを作成
az storage container create \
  --account-name ${prefix}stor \
  --name backups

# 外部アクセスを無効化
az storage account update \
  --name ${prefix}stor \
  --resource-group ${prefix}-rg \
  --default-action deny

# サブネット経由のアクセスを許可
az storage account network-rule add \
  --account-name ${prefix}stor \
  --resource-group ${prefix}-rg \
  --vnet-name ${prefix}-vnet \
  --subnet app-subnet

# VNET 統合可能な B1 で App Service Plan を作成
az appservice plan create \
  --name ${prefix}-plan \
  --resource-group ${prefix}-rg \
  --is-linux \
  --sku B1

# Web App を作成
az webapp create \
  --name ${prefix}-app \
  --resource-group ${prefix}-rg \
  --plan ${prefix}-plan \
  --runtime "PHP|8.2" \
  --https-only true

# VNET 統合を追加
az webapp vnet-integration add \
  --name ${prefix}-app \
  --resource-group ${prefix}-rg \
  --vnet ${prefix}-vnet \
  --subnet app-subnet

「カスタムバックの構成」で設定

「仮想ネットワーク統合でのバックアップ/復元(プレビュー)」というチェックボックスが増えていました。

appservice-backup-01.png

「今すぐバックアップ」を実行

バックアップは成功。スクショにはありませんが、その後の復元ももちろん成功しました。

appservice-backup-02.png

参考

https://azure.microsoft.com/ja-jp/updates/app-service-backup-and-restore-over-azure-virtual-network/

https://learn.microsoft.com/ja-jp/azure/app-service/manage-backup?tabs=portal#back-up-and-restore-over-azure-virtual-network-preview

Discussion