4.7. Azure Active Directory アプリケーションの作成
Azure Active Directory (AD) アプリケーションを作成するには、以下の手順を行います。Azure AD アプリケーションは、クラスター内のすべてのノードに対する HA 操作のアクセスを許可し、自動化します。
前提条件
- Azure コマンドラインインターフェイス (CLI) がシステムにインストールされている。
- Microsoft Azure サブスクリプションの管理者または所有者である。Azure AD アプリケーションを作成するには、この承認が必要です。
手順
HA クラスター内の任意のノードで、Azure アカウントにログインします。
$ az login
Azure フェンスエージェントのカスタムロールの
json
設定ファイルを作成します。次の設定を使用します。ただし、<subscription-id> はご自身のサブスクリプション ID に置き換えます。{ "Name": "Linux Fence Agent Role", "description": "Allows to power-off and start virtual machines", "assignableScopes": [ "/subscriptions/<subscription-id>" ], "actions": [ "Microsoft.Compute/*/read", "Microsoft.Compute/virtualMachines/powerOff/action", "Microsoft.Compute/virtualMachines/start/action" ], "notActions": [], "dataActions": [], "notDataActions": [] }
Azure フェンスエージェントのカスタムロールを定義します。前の手順で作成した
json
ファイルを使用します。$ az role definition create --role-definition azure-fence-role.json { "assignableScopes": [ "/subscriptions/<my-subscription-id>" ], "description": "Allows to power-off and start virtual machines", "id": "/subscriptions/<my-subscription-id>/providers/Microsoft.Authorization/roleDefinitions/<role-id>", "name": "<role-id>", "permissions": [ { "actions": [ "Microsoft.Compute/*/read", "Microsoft.Compute/virtualMachines/powerOff/action", "Microsoft.Compute/virtualMachines/start/action" ], "dataActions": [], "notActions": [], "notDataActions": [] } ], "roleName": "Linux Fence Agent Role", "roleType": "CustomRole", "type": "Microsoft.Authorization/roleDefinitions" }
-
Azure Web コンソールインターフェイスで、Virtual Machine を選択
左側のメニューの Identity をクリックします。 - On を選択→ Save をクリック→ Yes をクリックして確認します。
-
Azure role assignments
Add role assignment をクリックします。 -
ロールに必要な Scope (例:
Resource Group
) を選択します。 - 必要な Resource Group を選択します。
- オプション: 必要に応じて Subscription を変更します。
- Linux Fence Agent Role ロールを選択します。
- Save をクリックします。
検証
Azure AD に表示されるノードを表示します。
# fence_azure_arm --msi -o list node1, node2, [...]
このコマンドでクラスター上のすべてのノードが出力された場合、AD アプリケーションは正常に設定されています。