0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Microsoft クラウドセキュリティベンチマークを Azure のリソースグループに適用してからポリシー準拠の状態変化を確認してみた

Posted at

Azure に作成したリソースが、セキュリティ的に正しく設定されている事を説明したい場合があったとします。自分自身でセキュリティ診断をすると甘くなったり隠したりする可能性が否定できないので、第三者にセキュリティ診断を依頼して証明してもらうケースもあります。今回は、Azure Advisor や Microsoft Defender for Cloud のベースとなる「 Microsoft クラウドセキュリティベンチマーク」という Azure Policy 定義が 210 個含まれるものを、特定の Azure リソースグループに適用してから、ポリシーに準拠しない App Service を作成して状態変化を確認してみました。

リソースグループを作成して Microsoft クラウドセキュリティベンチマークを割り当てる

bash
# 環境変数をセットします
prefix=mnrpt
region=japaneast

# リソースグループを作成し ID を取得します
rgid=$(az group create \
  --name ${prefix}-rg \
  --location $region \
  --query id \
  --output tsv)

# Microsoft クラウドセキュリティベンチマークの名前を取得します
defname=$(az policy set-definition list \
  --query "[?displayName=='Microsoft cloud security benchmark'].name" \
  --output tsv)

# リソースグループに Microsoft クラウドセキュリティベンチマークを割り当てます
az policy assignment create \
  --name MCSB-${prefix}-rg \
  --display-name MCSB-${prefix}-rg \
  --scope $rgid \
  --policy-set-definition $defname \
  --mi-system-assigned \
  --location $region

# ポリシーのスキャンを開始します
az policy state trigger-scan \
  --resource-group ${prefix}-rg \
  --no-wait

ポリシースキャン後の状態

azure-policy-01.png

ポリシーに準拠しない App Service を作成

bash
# App Service プランを作成します
az appservice plan create \
  --resource-group ${prefix}-rg \
  --name ${prefix}-plan \
  --sku FREE

# App Service を作成します
az webapp create \
  --resource-group ${prefix}-rg \
  --name ${prefix}-web \
  --plan ${prefix}-plan

# ポリシーのスキャンを開始します
az policy state trigger-scan \
  --resource-group ${prefix}-rg \
  --no-wait

ポリシー準拠の状態変化

azure-policy-02.png

Azure Advisor のセキュリティから見た状態

azure-policy-03.png

Microsoft Defender for Cloud から作成した App Service のリソース正常性を見た状態

azure-policy-04.png

作成した App Service の Advisor の推奨事項から見た状態

azure-policy-05.png

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?