Azureポリシーを使用したサブスクリプションの一時停止の設定
Azureアカウントをロックまたはロック解除するポリシーをルートレベルで作成します。Azureアドミニストレーターは、Azureサブスクリプション、リソースグループ、またはリソースをロックして、誤って削除したり変更したりしないようにします。
始める前に
権限が既に設定されていることを確認してください。詳細については、「Azureでのアカウント一時停止の設定」を参照してください。
必要なロール:Azure アドミン
手順
- Azure組織にサインインします。
- [ユーザー] を検索して選択します。
- ユーザー名リストで、ユーザーを選択します。
- ナビゲーションペインから、[ アサインされたロール] を選択します。
- [管理] ロールで、[割り当ての追加] を選択してグローバル管理者ロールを追加します。
- 検索ボックスに Microsoft Entra ID と入力し、 Microsoft Entra ID > プロパティ.
-
[Azure リソースのアクセス管理] で、切り替えを [はい] に設定します。
このオプションを使用すると、このテナント内のすべての Azure サブスクリプションと管理グループへのアクセスを管理できます。
- [ポリシー] を検索して選択します。
- [+ ポリシー定義] を選択します。
-
次のように入力します。
- [定義の場所] の省略記号を使用してテナントルートグループを選択します。
管理グループまたはサブスクリプションのいずれかを選択できます。テナントルートグループを選択した場合は、すべての子サブスクリプションも管理できます。
- ポリシー定義の名前を入力します。例:LockAccount_policy。
- ポリシー定義の目的の説明。
- [ポリシールール] で、次の JSON コードをコピーします。
{ "properties": { "displayName": "CAM_LockAccount_Policy", "policyType": "Custom", "mode": "All", "description": "Blocks the creation of resources and configurations that fall under Azure Policy enforcement.", "parameters": { "allowedResourceTypes": { "type": "Array", "metadata": { "displayName": "Allowed Resource Types", "description": "List of resource types that are allowed for creation. Any resource type not listed here will be blocked.", "strongType": "resourceTypes" }, "defaultValue": [] }, "allowedLocations": { "type": "Array", "metadata": { "displayName": "Allowed Locations", "description": "List of allowed Azure regions for resource creation." }, "defaultValue": [] }, "effect": { "type": "String", "metadata": { "displayName": "Effect", "description": "The effect determines what happens when the policy rule is evaluated to match" }, "allowedValues": [ "Audit", "Deny", "Disabled" ], "defaultValue": "Deny" } }, "policyRule": { "if": { "anyOf": [ { "not": { "field": "type", "in": "[parameters('allowedResourceTypes')]" } }, { "not": { "field": "location", "in": "[parameters('allowedLocations')]" } } ] }, "then": { "effect": "[parameters('effect')]" } } } } - [Save (保存)] を選択します。注:ポリシーが作成されているかどうかを確認するには、[PolicyDefinitions] に移動します。フィルターの [スコープ] と [ポリシータイプ] を変更して、ポリシーを見つけます。
- ポリシー名を選択し、 定義 ID をコピーします。
注:この定義 ID は、 アカウントの一時停止構成を作成するするときに必要です。 - [定義の場所] の省略記号を使用してテナントルートグループを選択します。