Architecture & Governance参照資料確認: 2026-09-11

Network Policy as Code

Azure networkingのIaC・Azure Policy・AVNM configurationをsource control、review、test、staged deployment、drift detectionへ統合し、安全に変更する。

Architecture contract

network policyをportal上の最終状態ではなく、source-controlledなintentとして管理する。IaCがresource topologyを作る責任、Azure Policyがcomplianceを評価/強制する責任、AVNMがcentral network intentを配布する責任を分離し、single-writer、test、canary、rollback、runtime verificationまでpipelineの一部にする。

この記事の目次

Network Policy as Codeを理解するための前提

MicrosoftのPolicy as Code guidanceは、policy definitionをsource controlへ置き、変更のたびにtest / validateする考え方を示している。 Azure Policyにはdefinition、initiative、assignment、exemption等のartifactがあり、definitionだけversion管理してもproduction behaviorを再現できない。assignment scopeとparameterまでcode/review対象にする。

新policyはenforcementを無効にした状態で影響を評価し、compliance結果・remediation・permissionを確認してから段階的にenforceする。 Bicep/Terraform等のIaCはVNet/subnet/NSG/route table/Firewall/DNS等のresource desired stateを管理する。一方Azure Policyはcompliance guardrailであり、同じresource propertyを複数systemが書く場合はsingle-writerを決める。

AVNMのNetwork Group dynamic membership、connectivity/security/routing configurationもcentral intentであり、portal-only変更にせずsource/review/deploy evidenceを残す。 test PASSだけではnetwork change完了ではない。effective route/security、DNS、actual traffic、failure/recoveryをruntimeで確認し、pipeline evidenceと紐付ける。

大scopeのPolicy/AVNM/IaC変更はblast radiusが大きい。management group全体へ一括deployせず、canary subscription / Network Group / regionからwaveを拡大する。

通信や判断の流れを追う
Platform policyShared servicesSpoke / Workload運用・変更

Ownership / Control / Data plane boundary

Source of truth

Git等にdefinition / module / assignment intentを置き、reviewableなchangeとして扱う。

Control systems

IaC / Azure Policy / AVNMそれぞれのwrite authorityを明示し、同一propertyの競合を避ける。

Deployment

pipelineからscope / region / waveを制御し、plan/compliance/deploy evidenceを残す。

Runtime

effective route/security/DNS/trafficを観測し、declared intentとdata planeの差をdriftとして扱う。

Architecture model

読み方『codeに書いてある』だけではsource of truthにならない。portal hotfixや別pipelineが同じresourceを書けるならauthorityが競合する。artifactごとにsingle writerとemergency-change reconciliationを定義する。

設計判断

判断軸推奨する問い設計時に固定するもの
AuthorityVNet/NSG/UDR/AVNM/Policyの各propertyを誰が書くか。system of record、single writer、break-glass path。
Repository modelplatform policyとworkload IaCを同repo/別repoのどこで分離するか。ownership、CODEOWNERS相当、module version、release process。
Test levelssyntaxだけでなく何をpre-deployで検証するか。lint/schema、plan/what-if、Policy compliance preview、fixture。
Enforcement rolloutaudit→enforceをどのscopeで進めるか。canary subscription、wave、exemption、stop condition。
Driftportal change / external system changeをどう検知・戻すか。scheduled plan、Policy compliance、AVNM deploy/effective state、alert。
Runtime acceptancenetwork config適用後に何をobservable PASSにするか。traffic matrix、DNS、effective route/security、failure recovery。

実装・展開の順序

  1. authority mapを作る。 resource/property単位でIaC・Policy・AVNM・manual emergencyのwriterを列挙し、競合を解消する。
  2. current stateをimport/inventoryする。 legacy portal configurationを無視してcodeを上書きせず、driftとunknown ownershipを先に分類する。
  3. policyをsource controlする。 definitionだけでなくinitiative/assignment/parameter/exemptionをreview可能にする。
  4. pre-deploy testを行う。 schema/lint、IaC plan/what-if、Policy disabled-enforcementで影響を確認し、unexpected resource countをgateにする。
  5. canaryへ反映する。 selected subscription / group / regionへdeployし、runtime traffic matrixまでPASSしたら次waveへ進む。
  6. post-deploy driftを監視する。 emergency portal changeは許容期間を定め、codeへreconcileされない変更を継続状態にしない。

Platform team / Workload team の責任分界

領域Platform / central teamWorkload / application team
Platform repositoryshared modules、central Policy/AVNM intent、release pipelineを所有。approved module/versionを利用し、application-specific inputを提供。
Workload IaCguardrailとinterfaceを提供。workload VNet/subnet/NSG/service integrationをcodeで管理。
Policydefinition/initiative/assignment/exemption標準を管理。compliance violationをremediateし、例外理由を維持。
AVNMNetwork Group/config/deployment pipelineを管理。membership metadataを維持し、data-plane testを実施。
Emergency changebreak-glassとreconciliation SLAを定義。必要時にincident evidenceを残し、必ずsourceへ戻す。

Repository / pipeline model

Example — conceptual layout
platform-network/
  modules/              # VNet / routing / firewall shared IaC
  policy/
    definitions/
    initiatives/
    assignments/
    exemptions/
  avnm/
    network-groups/
    connectivity/
    security-admin/
    routing/
  tests/
    policy-fixtures/
    route-matrix/
    negative-flows/
  environments/
    canary/
    prod/
PR gate
  • schema/lintがPASS
  • scope/resource count差分をreview
  • ownerとrollbackを明記
Canary gate
  • Policy complianceがexpected
  • effective route/securityが一致
  • positive/negative trafficがPASS
Promotion gate
  • canaryにregressionなし
  • next waveのblast radius承認
  • rollback artifactがknown-good
Post-deploy gate
  • drift 0または承認済み
  • runtime telemetry正常
  • emergency/manual changeをsourceへreconcile

Verification / review evidence

設計レビューで残す証拠

  • source commit / PR / reviewers / change reason
  • IaC plan/what-ifとresource count差分
  • Policy compliance previewとexemption一覧
  • AVNM configuration/deployment version
  • canary runtime verification result
  • post-deploy drift scanとmanual change reconciliation

runtimeで確認すること

  • effective routes / security rulesがsource intentと一致すること
  • required DNS resolution / Private Endpoint / hybrid flowが成立すること
  • negative flowがfail-closedであること
  • Policy enforcementがunexpected legacy resourceを破壊していないこと
  • portal/manual driftが検知されること
  • rollback artifactを適用してknown-good flowへ戻せること
Azure CLI — Policy inventory (read-only)
az policy definition list -o table
az policy assignment list -o table
az policy state summarize -o jsonc
Azure CLI — Azure resources (read-only)
az resource list --query "[].{Name:name,Type:type,Group:resourceGroup}" -o table

Common failure modes

症状 / anti-pattern原因になりやすい設計確認・是正
TerraformとPolicyが同じpropertyを行ったり来たり変更single-writerがなくmodify/remediationとIaCが競合。property authorityを定義し、Policyはaudit/denyかIaC側へ統合する。
PRはPASSだがproduction断static testだけでdata-plane acceptanceがない。canary traffic matrix、effective route/security、DNS testをpromotion gateへ。
Policy enableで大量non-compliance/remediationdisabled-enforcement/audit期間なしで大scopeへ展開。compliance preview→exception整理→canary→waveの順へ変更。
portal hotfixが翌日IaCで消えるemergency changeをsourceへreconcileしていない。break-glass ticketとsource reconciliation SLAを必須化。
AVNM membershipだけportalで変更central network intentの一部がsource control外。Network Group/config/deployment evidenceを同じrelease processへ統合。

Change safety / rollback

一括変更を避ける: rollbackは『前commitへgit revert』だけでは完了しない。前versionのPolicy assignment/parameter、IaC resource state、AVNM configuration/deployment targetを再現できるartifactを保持し、適用後にeffective route/security/DNSとreal trafficがknown-goodへ戻ったことまで確認する。

Official sources