kaeken(嘉永島健司)のTech探究ブログ

主に情報科学/情報技術全般に関する知見をポストします。(最近は、特にData Science、機械学習、深層学習、統計学、Python、数学、ビッグデータ)

Azure Policy 概要まとめ

overview

Azure Policy documentation | Microsoft Learn

Overview

  • Azure Policy evaluates resources by comparing them to business rules in JSON format, known as policy definitions.
  • Policy initiatives group several rules for simplified management.
  • Policies can be assigned to any Azure scope, including management groups, subscriptions, resource groups, or individual resources.
  • Subscopes can be excluded from policy assignments if necessary.

Evaluation Outcomes

  • Resources are evaluated during creation, update, policy assignment, and every 24 hours.
  • Evaluation determines if resources are compliant or not.

Control the Response to an Evaluation

  • Responses to non-compliance include denying changes, logging changes, altering resources, deploying compliant resources, and blocking actions.

Remediate Non-compliant Resources

  • Azure Policy can remediate existing non-compliant resources without needing to alter the resource directly.

Azure Policy and Azure RBAC

  • Azure Policy focuses on resource state compliance without concern for user permissions.
  • Azure RBAC manages user actions and permissions.
  • Azure Policy can block actions even if Azure RBAC allows it.

Permissions in Azure Policy

  • Permissions for Azure Policy are managed through Microsoft.Authorization and Microsoft.PolicyInsights.
  • Roles include Resource Policy Contributor, Owner, Contributor, and Reader.
  • Custom roles can be created for specific permissions.

Azure Virtual Network Manager

  • Requires special permissions to create, edit, or delete Azure Virtual Network Manager dynamic group policies.
  • Managed through Azure RBAC only.

Resources Covered by Azure Policy

  • Policies can be assigned at management group level, but only subscription or resource group level resources are evaluated.

Recommendations for Managing Policies

  • Start with audit effects to track policy impact.
  • Consider organizational hierarchies for creating and assigning policies.
  • Use initiative definitions for grouping policies.
  • Manage policies as code with manual reviews on changes.

概要

  • Azure Policyは、JSON形式で記述されたビジネスルール、いわゆるポリシー定義と、それらのリソースのプロパティを比較することによりリソースを評価します。
  • ポリシーイニシアチブは、複数のルールをグループ化して管理を簡素化します。
  • ポリシーは、管理グループ、サブスクリプション、リソースグループ、または個々のリソースなど、任意のAzureスコープに割り当てることができます。
  • 必要に応じて、ポリシー割り当てからサブスコープを除外することができます。

評価結果

  • リソースは、作成、更新、ポリシー割り当て、および24時間ごとに評価されます。
  • 評価は、リソースが準拠しているかどうかを決定します。

評価への対応を制御する

  • 非準拠リソースへの対応には、変更の拒否、変更の記録、リソースの変更、準拠リソースのデプロイ、およびアクションのブロックが含まれます。

非準拠リソースの修正

  • Azure Policyは、直接リソースを変更することなく、既存の非準拠リソースを修正することができます。

Azure PolicyとAzure RBAC

  • Azure Policyは、ユーザーの権限に関係なく、リソースの状態の準拠を保証することに焦点を当てています。
  • Azure RBACは、ユーザーアクションと権限を管理します。
  • Azure Policyは、Azure RBACが許可していてもアクションをブロックすることができます。

Azure Policyでの権限

  • Azure Policyの権限は、Microsoft.AuthorizationおよびMicrosoft.PolicyInsightsを通じて管理されます。
  • ロールには、リソースポリシーコントリビューター、オーナー、コントリビューター、およびリーダーが含まれます。
  • 特定の権限に対してカスタムロールを作成することができます。

Azure Virtual Network Manager

  • Azure Virtual Network Managerダイナミックグループポリシーを作成、編集、または削除するための特別な権限が必要です。
  • Azure RBACのみを通じて管理されます。

Azure Policyによってカバーされるリソース

ポリシーを管理するための推奨事項

  • ポリシーの影響を追跡するために、監査効果から始めます。
  • ポリシーを作成および割り当てる際には、組織の階層を考慮します。
  • ポリシーをグルーピングするためにイニシアチブ定義を使用します。
  • 変更に対するポリシー定義、イニシアチブ、および割り当てをコードとして管理します。

Getting Started with Azure Policy and Azure RBAC

  • Key Differences: Azure Policy evaluates resource properties for compliance, while Azure RBAC manages user actions.
  • DenyAction Effect: Azure Policy can block specific resource actions.
  • Visibility: Policy definitions, initiatives, and assignments are visible to all users, promoting transparency.

Azure RBAC Permissions in Azure Policy

  • Permissions: Managed by Microsoft.Authorization and Microsoft.PolicyInsights.
  • Roles: Resource Policy Contributor role covers most operations, with Owner having full rights, and Contributor and Reader having access to read operations.
  • Custom Roles: Can be created if built-in roles do not meet needs.

Special Permissions for Azure Virtual Network Manager

  • Azure Virtual Network Manager: Requires specific Azure RBAC permissions for managing dynamic group policies.

Resources Covered by Azure Policy

  • Scope: Policies are evaluated for resources at the subscription or resource group level.

Recommendations for Managing Policies

  • Start with Audit Effects: To assess policy impact without enforcement.
  • Organizational Hierarchies: Consider when creating definitions and assignments.
  • Initiative Definitions: Recommended for grouping policy definitions.
  • Manual Reviews: For changes to policy definitions, initiatives, and assignments.

Azure PolicyとAzure RBACの概要

  • 主な違い: Azure Policyはリソースのプロパティを評価してコンプライアンスを確認し、Azure RBACはユーザーアクションを管理します。
  • DenyAction効果: Azure Policyは特定のリソースアクションをブロックできます。
  • 可視性: ポリシー定義、イニシアティブ、および割り当てはすべてのユーザーに表示され、透明性を促進します。

Azure PolicyのAzure RBAC権限

  • 権限: Microsoft.AuthorizationおよびMicrosoft.PolicyInsightsによって管理されます。
  • ロール: リソースポリシーコントリビューターロールはほとんどの操作をカバーし、オーナーは完全な権限を持ち、コントリビューターとリーダーは読み取り操作へのアクセスを持ちます。
  • カスタムロール: 組み込みのロールがニーズを満たさない場合に作成できます。

Azure Virtual Network Managerの特別な権限

  • Azure Virtual Network Manager: 動的グループポリシーを管理するための特定のAzure RBAC権限が必要です。

Azure Policyによってカバーされるリソース

ポリシーを管理するための推奨事項

  • 監査効果から始める: 強制実施なしでポリシーの影響を評価します。
  • 組織の階層構造を考慮する: 定義と割り当てを作成する際に考慮します。
  • イニシアティブ定義を使用する: ポリシー定義をグルーピングすることを推奨します。
  • 手動レビュー: ポリシー定義、イニシアティブ、および割り当ての変更に対して。

Azure Policy Objects

Policy Definition - Creating a policy in Azure begins with a policy definition. - Definitions enforce conditions with a specific effect if conditions are met. - Azure Policy offers built-in policies and allows for custom definitions. - Policy assignment is required to implement policies through various tools like the Azure portal, PowerShell, or Azure CLI.

Policy Parameters - Parameters simplify management by making definitions more generic. - They allow for reusable policy definitions in different scenarios by changing parameter values during assignment.

Initiative Definition - An initiative definition groups policy definitions towards a singular goal. - It simplifies managing and assigning policies by treating them as a single item. - Initiative parameters reduce redundancy by using parameters across policies within the initiative.

Assignments - An assignment applies a policy definition or initiative to a specific scope. - Assignments are inherited by child resources but can exclude subscopes. - Policy assignments use the latest state of their assigned definition or initiative when evaluating resources.

Azure Policyオブジェクト

ポリシー定義 - Azureでのポリシー作成は、ポリシー定義から始まります。 - 定義は特定の条件が満たされた場合の効果を強制します。 - Azure Policyはビルトインポリシーを提供し、カスタム定義も可能です。 - ポリシーを実装するには、Azureポータル、PowerShell、またはAzure CLIなどのツールを通じてポリシーを割り当てる必要があります。

ポリシーのパラメータ - パラメータは、定義をより汎用的にすることで管理を簡素化します。 - 異なるシナリオでポリシー定義を再利用できるようにすることで、割り当て時にパラメータ値を変更します。

イニシアティブ定義 - イニシアティブ定義は、単一の目標に向けたポリシー定義をグループ化します。 - それらを単一のアイテムとして扱うことで、ポリシーの管理と割り当てを簡素化します。 - イニシアティブのパラメータは、イニシアティブ内のポリシー間でパラメータを使用することで冗長性を減らします。

割り当て - 割り当ては、特定のスコープにポリシー定義またはイニシアティブを適用します。 - 割り当ては子リソースに継承されますが、サブスコープを除外することができます。 - ポリシー割り当ては、リソースを評価する際に割り当てられた定義またはイニシアティブの最新の状態を使用します