次の方法で共有


マネージド ID の使用

Microsoft Entra マネージド ID を使用して、サブスクリプション内のクラスターを管理するためのアクセス許可を Azure CycleCloud に付与します。 この方法は、 サービス プリンシパルを使用する代わりに機能します。 マネージド ID を CycleCloud VM に割り当てて、ストレージ、Key Vault、Azure Container Registries などの Azure リソースへのアクセスを提供します。

マネージド ID を使用した CycleCloud VM のアクセス許可

CycleCloud は、HPC クラスターを管理するために Azure Resource Manager への多くの呼び出しを自動化します。 この自動化には、CycleCloud に対する特定のアクセス許可が必要です。 このアクセス権を CycleCloud に付与するには、サービス プリンシパルを設定するか、 CycleCloud VM にマネージド ID を 割り当てます。

サービス プリンシパルではなく、 システム割り当て マネージド ID またはUser-Assigned マネージド ID を 使用してこれらのアクセス許可を付与することをお勧めします。

Azure VM に Azure CycleCloud をインストールし、マネージド ID を VM に割り当てると、[ サブスクリプションの追加] ダイアログの動作が少し異なります。 このダイアログボックスでは、 マネージド ID 認証オプションが有効になり、事前選択されます。 また、 サブスクリプション ID にホスト VM のサブスクリプションも入力します。

サブスクリプションマネージド ID の追加

サブスクリプションマネージド ID の追加

[ アプリ登録 認証] オプションを選択すると、引き続き標準の資格情報セットを入力できます。 このオプションを選択すると、標準フィールドがフォームに表示されます。 別の サブスクリプション ID を使用することもできます。指定された値は便宜上のためだけに使用されます。

システム割り当てマネージド ID を使用する場合は、[ClientID] フィールドを空白のままにします。 ただし、User-Assigned マネージド ID で CycleCloud を使用する場合は、クラスター オーケストレーションに使用する特定のマネージド ID の ClientID に ClientID を設定します。

収納ロッカーへのアクセス

CycleCloud VM 上のクラスター オーケストレーションにマネージド ID を使用するだけでなく、ストレージ アカウントとクラスター ノードからのロッカー アクセスのためにユーザー割り当てマネージド ID をクラスターに割り当てするように CycleCloud を構成できます。 この方法では、ストレージ アカウントの共有アクセス キーから派生した SAS トークンではなく、ユーザー割り当てマネージド ID を使用します。

共有アクセス キーではなくユーザー割り当てマネージド ID を使用するようにクラスターを構成するには、ストレージ アカウント スコープで ストレージ BLOB データ 閲覧者 アクセス権を持つ専用のユーザー割り当てマネージド ID を作成します。 まず、Azure サブスクリプションでストレージ アカウントとユーザー割り当てマネージド ID を作成します。 次に、[サブスクリプションの追加] ダイアログの [ストレージ ロッカーの構成] セクションで、[Locker ID] ドロップダウンから新しいマネージド ID を選択し、[ストレージ アカウント] ドロップダウンからストレージ アカウントを選択します。

CycleCloud のカスタム ロールとマネージド ID を作成する

十分なアクセス権を提供する最も簡単なオプションは、サブスクリプションの Contributor ロールと Storage Blob Data Contributor ロールをシステム割り当てマネージド ID として CycleCloud VM に割り当てることです。 ただし、 Contributor ロールの特権レベルは、CycleCloud が必要とするよりも高くなります。 カスタム ロールを作成して VM に割り当てることができます。 同様に、既にストレージ アカウントを作成している場合は、サブスクリプション スコープではなく、ストレージ アカウント スコープで Storage Blob Data Contributor ロールを割り当てます。

このロールは、CycleCloud のすべての機能を対象とします。

{
    "assignableScopes": [
      "/subscriptions/<SubscriptionId>"
    ],
    "description": "CycleCloud Orchestrator Role",
    "permissions": [
      {
        "actions": [
          "Microsoft.Authorization/*/read",
          "Microsoft.Authorization/roleAssignments/*",
          "Microsoft.Authorization/roleDefinitions/*",
          "Microsoft.Commerce/RateCard/read",
          "Microsoft.Compute/*/read",
          "Microsoft.Compute/availabilitySets/*",
          "Microsoft.Compute/disks/*",
          "Microsoft.Compute/images/read",
          "Microsoft.Compute/locations/usages/read",
          "Microsoft.Compute/register/action",
          "Microsoft.Compute/skus/read",
          "Microsoft.Compute/virtualMachines/*",
          "Microsoft.Compute/virtualMachineScaleSets/*",
          "Microsoft.Compute/virtualMachineScaleSets/virtualMachines/*",
          "Microsoft.ManagedIdentity/userAssignedIdentities/*/read",
          "Microsoft.ManagedIdentity/userAssignedIdentities/*/assign/action",
          "Microsoft.MarketplaceOrdering/offertypes/publishers/offers/plans/agreements/read",
          "Microsoft.MarketplaceOrdering/offertypes/publishers/offers/plans/agreements/write",
          "Microsoft.Network/*/read",
          "Microsoft.Network/locations/*/read",
          "Microsoft.Network/networkInterfaces/read",
          "Microsoft.Network/networkInterfaces/write",
          "Microsoft.Network/networkInterfaces/delete",
          "Microsoft.Network/networkInterfaces/join/action",
          "Microsoft.Network/networkSecurityGroups/read",
          "Microsoft.Network/networkSecurityGroups/write",
          "Microsoft.Network/networkSecurityGroups/delete",
          "Microsoft.Network/networkSecurityGroups/join/action",
          "Microsoft.Network/publicIPAddresses/read",
          "Microsoft.Network/publicIPAddresses/write",
          "Microsoft.Network/publicIPAddresses/delete",
          "Microsoft.Network/publicIPAddresses/join/action",
          "Microsoft.Network/register/action",
          "Microsoft.Network/virtualNetworks/read",
          "Microsoft.Network/virtualNetworks/subnets/read",
          "Microsoft.Network/virtualNetworks/subnets/join/action",
          "Microsoft.Resources/deployments/read",
          "Microsoft.Resources/subscriptions/resourceGroups/read",
          "Microsoft.Resources/subscriptions/resourceGroups/write",
          "Microsoft.Resources/subscriptions/resourceGroups/delete",
          "Microsoft.Resources/subscriptions/resourceGroups/resources/read",
          "Microsoft.Resources/subscriptions/operationresults/read",
          "Microsoft.Storage/*/read",
          "Microsoft.Storage/checknameavailability/read",
          "Microsoft.Storage/register/action",
          "Microsoft.Storage/storageAccounts/blobServices/containers/delete",
          "Microsoft.Storage/storageAccounts/blobServices/containers/read",
          "Microsoft.Storage/storageAccounts/blobServices/containers/write",
          "Microsoft.Storage/storageAccounts/blobServices/generateUserDelegationKey/action",
          "Microsoft.Storage/storageAccounts/read",
          "Microsoft.Storage/storageAccounts/listKeys/action",
          "Microsoft.Storage/storageAccounts/write"
        ],
        "dataActions": [
          "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/delete",
          "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read",
          "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write",
          "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/move/action",
          "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/add/action"
        ],
        "notActions": [],
        "notDataActions": []
      }
    ],
    "Name": "CycleCloud <SubscriptionId>",
    "roleType": "CustomRole",
    "type": "Microsoft.Authorization/roleDefinitions"
}

<SubscriptionId>は必ずサブスクリプション ID に置き換えてください。 このロールのスコープはサブスクリプションですが、必要に応じて 1 つのリソース グループにスコープを設定できます。 名前はテナントに対して一意である必要があります。

Von Bedeutung

カスタム ロールを使用するには、Microsoft Entra ID P1 ライセンスが必要です。 ライセンスの詳細については、 Microsoft Entra のプランと価格に関する説明を参照してください。

オプションのアクセス許可

クラスターごとに 1 つのリソース グループを使用するように CycleCloud をスコープしている場合は、 actionsから次のアクセス許可を削除できます。

          "Microsoft.Resources/subscriptions/resourceGroups/write",
          "Microsoft.Resources/subscriptions/resourceGroups/delete",

CycleCloud を使用してクラスター内に作成する VM にマネージド ID を割り当てない場合は、 actionsから次のアクセス許可を削除できます。

          "Microsoft.Authorization/*/read",
          "Microsoft.Authorization/roleAssignments/*",
          "Microsoft.Authorization/roleDefinitions/*",

Warnung

CycleCloud の将来のバージョンでは、VM にマネージド ID を割り当てる機能が必要です。 これらのアクセス許可を削除することはお勧めしません。

ロールの作成

Azure CLI を使用して、ロール定義からロールを作成できます。 このロールを使用して、Azure テナント内にロール定義を作成します。 テナントにロールが存在する場合は、適切なスコープを持つ ID にロールを割り当てます。

次の例は、Azure CLI を使用した基本的なフローを示しています。

# Create a custom role definition
az role definition create --role-definition role.json
# Create user identity
az identity create --name <name>
# Assign the custom role to the identity with proper scope
az role assignment create --role <CycleCloudRole> --assignee-object-id <identity-id> --scope <subscription>

これで、カスタム ロールが割り当てられ、ID にスコープが設定されます。 VM で使用できます。

マネージド ID を持つクラスター VM へのロールの割り当て

クラスター ノードには、多くの場合、Azure リソースへのアクセスが必要です。 たとえば、多くのクラスターでは、ワークロードを実行するために Azure Storage、Key Vault、または Azure Container Registries へのアクセスが必要です。 クラスター構成を使用してノードにシークレットまたは資格情報を渡す代わりに、 User-Assigned マネージド ID を 使用してアクセス資格情報を提供することを強くお勧めします。

Azure.Identities ノード プロパティを使用して、クラスター VM でユーザー割り当てマネージド ID を構成できます。 Azure.Identities プロパティを、マネージド ID リソース ID 文字列のコンマ区切りのリストに設定します。

[cluster sample]
...
    [[node defaults]]
    ...
    Azure.Identities = $ManagedServiceIdentity
...

[parameters Required Settings]
...
  [[parameter ManagedServiceIdentity]]
  ParameterType = Azure.ManagedIdentity
  Label = MSI Identity
  Description = The resource ID of the Managed Service Identity to apply to the nodes
...