3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AVD用のFirewallpolicyをある程度ぱぱっと入れる

Posted at

はじめに

AzureFirewall×AVDの検証をする際、AVD用のFirewallポリシーが多すぎて何かいい方法はないかと公式ドキュメントを見ていたのですが、下記を見つけました。

下記を実行すればある程度ポリシーを入れてくれるようです。
https://github.com/Azure/RDS-Templates/tree/master/AzureFirewallPolicyForAVD

コード編集

下記がパラメータを集約してくれたコードになっているので編集
FirewallPolicyForAVD-parameters.json

<コメント>の部分を消去して、ご自分の環境のパラメータに置き換えてください



{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "firewallPolicies_AVD_DefaultPolicy_name": {
            "value": "<ポリシーの名前>"
        },
        "location": {
            "value": "<japaneastなどfirewall作成したリージョン>"
        },
        "firewall-policy-tier": {
            "value": "<standardなどSKUを入力>"
        },
       "dns-server": {
            "value": "<192.168.0.5などDNSのIP入力>"
        },
        "avd-hostpool-subnet": {
            "value": "<192.168.100.10/16などhostpoolのアドレスレンジ入力>"
        }
    }
}

実行

下記2つが任意の場所に格納されていることを確認
(Azureportal上のpowershellを使用する場合はアップロード)

  • FirewallPolicyForAVD-parameters.json
  • FirewallPolicyForAVD-template.json

powershellで下記を実行
<<<>>>の部分を置き換えてください
Run the deploymentの部分でAVD用のポリシーが作成されます。

Connect-AzAccount
Select-AzSubscription -Subscription "<<<Your Subscription ID >>>"

# Variable definition
$ResourceGroupName = "<<<Your Resource Group Name>>>"
$Location = "<<<Your Azure Region>>>"

# Run the deployment
New-AzResourceGroupDeployment -ResourceGroupName $ResourceGroupName -Location $Location -TemplateFile ".\FirewallPolicyForAVD-template.json" -TemplateParameterFile ".\FirewallPolicyForAVD-parameters.json"

# Once completed, review all the Policy settings and rules, then associate to an existing Firewall: #

$fwpolicyname = "<<<Your AVD Firewall Policy Name>>>"
$fwpolicyresourcegroup = "<<<Resource Group where the Policy has been created>>>"
$fwname = "<<<Your Firewall Name>>>"
$fwresourcegroup = "<<<Resource Group where the Azure Firewall is located>>>"

$azFw = Get-AzFirewall -Name $fwname -ResourceGroupName $fwresourcegroup
$azPolicy = Get-AzFirewallPolicy -Name $fwpolicyname -ResourceGroupName $fwpolicyresourcegroup

$azFw.FirewallPolicy = $azPolicy.Id
$azFw | Set-AzFirewall

確認

AzureFirewallの
ネットワーク規則とアプリケーション規則にルールが登場します。
こんな感じです。

rule.png

これだけの数手動でいれるのはめんどうなのでいいですね~

留意点①

AzConnectで下記のような警告が出る場合があります。

WARNING: Interactive authentication is not supported in this session, please run cmdlet 'Connect-AzAccount -UseDeviceAuthentication'.

この警告が出た場合は素直にコマンドを下記に変えてください

Connect-AzAccount -UseDeviceAuthentication

実行すると
URLとコードが発行されると思うので
URLに飛んでコード入力してログインすればOKです。

留意点②

セッションホスト→pip向けの通信を許可しているので
それ以外の通信に関しては追記してあげる必要があります。
また、PrivateLinkを使用している場合は余計な通信を許可していることになるのでPrivateLink分(AVD、ストレージアカウントなど)は削除してあげるとよりセキュアになります。

環境によりますが、AVDの通信のうち接続クライアントのグローバルIP向け通信もAzureFirewallを経由させる場合はこのルールだけでは足りません。

内容はよくご確認の上使用ください。

3
1
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?