Azure Managed Instance for Apache Cassandra のカスタマー マネージド キー

Azure Managed Instance for Apache Cassandra では、独自のキーを使用してディスク上のデータを暗号化できます。 この記事では、Azure Key Vault を使用してカスタマー マネージド キーを実装する方法について説明します。

前提条件

  • Azure Key Vault を使用してシークレットを設定します。 詳細については、「Azure Key Vault の概要」を参照してください。

  • リソース グループに仮想ネットワークをデプロイします。

  • Azure Cosmos DB サービス プリンシパルをメンバーとして使用して、ネットワーク共同作成者ロールを適用します。 次のコマンドを使用します:

        az role assignment create \
        --assignee a232010e-820c-4083-83bb-3ace5fc29d0b \
        --role 4d97b98b-1d4f-4787-a291-c67834d212e7 \
        --scope /subscriptions/<subscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<vnetName>
    

    仮想ネットワークに適切なロールを適用すると、Azure Managed Instance for Apache Cassandra クラスターをデプロイするときのエラーを回避するのに役立ちます。 詳細については、「Azure CLI を使用して Azure Managed Instance for Apache Cassandra クラスターを作成する」を参照してください。

この記事では、Azure CLI バージョン 2.30.0 以降が必要です。 Azure Cloud Shell を使用している場合は、最新バージョンが既にインストールされています。

システム割り当て ID を使用してクラスターを作成する

  1. 次のコマンドを使用してクラスターを作成します。 <subscriptionID><resourceGroupName><vnetName>、および <subnetName> を適切な値に置き換えます。

    subnet="/subscriptions/<subscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>"
    cluster="thvankra-cmk-test-wcus"
    group="thvankra-nova-cmk-test"
    region="westcentralus"
    password="PlaceholderPassword"
    
    az managed-cassandra cluster create \
        --identity-type SystemAssigned \
        --resource-group $group \
        --location $region \
        --cluster-name $cluster \
        --delegated-management-subnet-id $subnet \
        --initial-cassandra-admin-password $password
    
  2. 作成されたクラスターの ID 情報を取得します:

    az managed-cassandra cluster show -c $cluster -g $group
    

    出力には、次の例のような ID セクションが含まれています。 後で使用するために principalId 値をコピーします。

      "identity": {
        "principalId": "1aa51c7f-196a-4013-a656-1ccabfdc54e0",
        "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
        "type": "SystemAssigned"
      }
    
  3. Azure portal で、キー コンテナーに移動し、[アクセス ポリシー] を選択します。 次に、[アクセス ポリシーの追加] を選択して、キーのアクセス ポリシーを作成します。

    Screenshot that shows the pane for access policies in the Azure portal.

  4. キーのアクセス許可で、[取得][折り返す][折り返しを解除] を選択します。 [プリンシパルの選択] ボックスを選択して、[プリンシパル] ウィンドウを開きます。 前に取得したクラスターの principalId 値を入力し、[選択] ボタンを 選択します。 (ポータルで、クラスターのプリンシパル ID をクラスターの名前で検索することもできます。)

    Screenshot that shows an example of adding a principal for an access policy.

    警告

    キー コンテナーで消去保護が有効になっていることを確認します。 そうしないと、データセンターのデプロイは失敗します。

  5. [追加] を選択してアクセス ポリシーを追加し、[保存] を選択します。

    Screenshot that shows the button for saving an access policy.

  6. キー識別子を取得するには、[キー] を選択し、キーを選択します。

    Screenshot that shows the pane for selecting a key.

  7. 現在のバージョンを選択します。

    Screenshot that shows the box for selecting the current version of a key.

  8. 後で使用するためにキー識別子を保存します。

    Screenshot that shows copying a key identifier to the clipboard.

  9. <key identifier> を、マネージド ディスク (managed-disk-customer-key-uri) とバックアップ ストレージ (backup-storage-customer-key-uri) の暗号化の両方に対して同じキー (前の手順でコピーした URI) に置き換えて、データセンターを作成します。 前に使用した subnet の値と同じ値を使用します。

    managedDiskKeyUri = "<key identifier>"
    backupStorageKeyUri = "<key identifier>"
    group="thvankra-nova-cmk-test"
    region="westcentralus"
    cluster="thvankra-cmk-test-2"
    dc="dc1"
    nodecount=3
    subnet="/subscriptions/<subscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>"
    
    az managed-cassandra datacenter create \
        --resource-group $group \
        --cluster-name $cluster \
        --data-center-name $dc \
        --managed-disk-customer-key-uri $managedDiskKeyUri \
        --backup-storage-customer-key-uri $backupStorageKeyUri \
        --node-count $nodecount \
        --delegated-subnet-id $subnet \
        --data-center-location $region \
        --sku Standard_DS14_v2
    

ID 情報なしで既存のクラスターに ID を割り当てることもできます:

az managed-cassandra cluster update --identity-type SystemAssigned -g $group -c $cluster

キーのローテーション

キーを更新するには、次のコマンドを使用します:

managedDiskKeyUri = "<key identifier>"
backupStorageKeyUri = "<key identifier>"
    
az managed-cassandra datacenter update \
    --resource-group $group \
    --cluster-name $cluster \ 
    --data-center-name $dc \
    --managed-disk-customer-key-uri $managedDiskKeyUri \
    --backup-storage-customer-key-uri $backupStorageKeyUri