Azure Managed CCF (Managed CCF) は、機密アプリケーションをデプロイするための新しいセキュリティで保護されたサービスです。 Azure Managed CCF の詳細については、「 Azure Managed Confidential Consortium Framework について」を参照してください。
Azure アカウントをお持ちでない場合は、開始する前に 無料アカウント を作成してください。
API リファレンス ドキュメント | ライブラリのソース コード | パッケージ (Maven 中央リポジトリ)
[前提条件]
- Azure サブスクリプション - 無料で作成します。
- Azure SDK for Java でサポートされている Java Development Kit (JDK) バージョン。
- Windows または Linux を実行しているコンピューター上の OpenSSL。
設定
このクイック スタートでは、Azure ID ライブラリと Azure CLI または Azure PowerShell を使用して、Azure サービスに対するユーザーの認証を行います。 開発者は、Windows または Linux Code を実行しているコンピューターで Visual Studio を使用して、呼び出しを認証することもできます。 詳細については、「 Azure IDENTITY クライアント ライブラリを使用してクライアントを認証する」を参照してください。
Azure にサインインする
Azure CLI az login コマンドまたは Azure PowerShell Connect-AzAccount コマンドレットを使用して Azure にサインインします。
az login
CLI または PowerShell で既定のブラウザーを開くことができる場合は、そのブラウザーが開き、Azure サインイン ページが読み込まれます。 それ以外の場合は、 https://aka.ms/devicelogin にアクセスし、ターミナルに表示される認証コードを入力します。
メッセージが表示されたら、ブラウザーでアカウントの資格情報を使用してサインインします。
依存関係をインストールする
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-confidentialledger</artifactId>
<version>1.0.0-beta.3</version>
</dependency>
リソース グループを作成する
リソース グループは、Azure リソースがデプロイおよび管理される論理コンテナーです。 Azure PowerShell New-AzResourceGroup コマンドレットを使用して、southcentralus の場所に myResourceGroup という名前のリソース グループを作成します。
New-AzResourceGroup -Name "myResourceGroup" -Location "SouthCentralUS"
リソース プロバイダーを登録する
リソースを作成する前に、Azure Managed CCF リソースの種類をサブスクリプションに登録する必要があります。
az feature registration create --namespace Microsoft.ConfidentialLedger --name ManagedCCF
az provider register --namespace Microsoft.ConfidentialLedger
メンバーの作成
メンバーのキー ペアを生成します。 次のコマンドが完了すると、メンバーの公開キーが member0_cert.pem に保存され、秘密キーが member0_privk.pemに保存されます。
openssl ecparam -out "member0_privk.pem" -name "secp384r1" -genkey
openssl req -new -key "member0_privk.pem" -x509 -nodes -days 365 -out "member0_cert.pem" -"sha384" -subj=/CN="member0"
Java アプリケーションを作成する
Azure SDK for Java ライブラリ (azure-resourcemanager-confidentialledger) を使用すると、作成と削除、サブスクリプションに関連付けられているリソースの一覧表示、特定のリソースの詳細の表示など、マネージド CCF リソースに対する操作を行うことができます。 次のコードでは、マネージド CCF リソースのプロパティを作成して表示します。
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.profile.AzureProfile;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager;
import com.azure.resourcemanager.confidentialledger.fluent.models.ManagedCcfInner;
import com.azure.resourcemanager.confidentialledger.models.DeploymentType;
import com.azure.resourcemanager.confidentialledger.models.LanguageRuntime;
import com.azure.resourcemanager.confidentialledger.models.ManagedCcfProperties;
import com.azure.resourcemanager.confidentialledger.models.MemberIdentityCertificate;
import java.util.*;
public class AzureJavaSdkClient {
public static void main(String[] args) {
try {
AzureProfile profile = new AzureProfile("<tenant id>","<subscription id>", AzureEnvironment.AZURE);
ConfidentialLedgerManager manager = ConfidentialLedgerManager.authenticate(new DefaultAzureCredentialBuilder().build(), profile);
MemberIdentityCertificate member0 = new MemberIdentityCertificate()
.withCertificate("-----BEGIN CERTIFICATE-----\nMIIBvjCCAUSgAwIBAgIUA0YHcPpUCtd...0Yet/xU4G0d71ZtULNWo\n-----END CERTIFICATE-----")
.withTags(Map.of("Dept", "IT"));
List<MemberIdentityCertificate> members = new ArrayList<MemberIdentityCertificate>();
members.add(member0);
DeploymentType deployment = new DeploymentType().withAppSourceUri("").withLanguageRuntime(LanguageRuntime.JS);
ManagedCcfProperties properties = new ManagedCcfProperties()
.withDeploymentType(deployment)
.withNodeCount(5)
.withMemberIdentityCertificates(members);
ManagedCcfInner inner = new ManagedCcfInner().withProperties(properties).withLocation("southcentralus");
// Send Create request
manager.serviceClient().getManagedCcfs().create("myResourceGroup", "confidentialbillingapp", inner);
// Print the Managed CCF resource properties
ManagedCcfInner app = manager.serviceClient().getManagedCcfs().getByResourceGroup("myResourceGroup", "confidentialbillingapp");
printAppInfo(app);
// Delete the resource
manager.serviceClient().getManagedCcfs().delete("myResourceGroup", "confidentialbillingapp");
} catch (ManagementException ex) {
// The x-ms-correlation-request-id is located in the Header
System.out.println(ex.getResponse().getHeaders().toString());
System.out.println(ex);
}
}
private static void printAppInfo(ManagedCcfInner app) {
System.out.println("App Name: " + app.name());
System.out.println("App Id: " + app.id());
System.out.println("App Location: " + app.location());
System.out.println("App type: " + app.type());
System.out.println("App Properties Uri: " + app.properties().appUri());
System.out.println("App Properties Language Runtime: " + app.properties().deploymentType().languageRuntime());
System.out.println("App Properties Source Uri: " + app.properties().deploymentType().appSourceUri());
System.out.println("App Properties NodeCount: " + app.properties().nodeCount());
System.out.println("App Properties Identity Uri: " + app.properties().identityServiceUri());
System.out.println("App Properties Cert 0: " + app.properties().memberIdentityCertificates().get(0).certificate());
System.out.println("App Properties Cert tags: " + app.properties().memberIdentityCertificates().get(0).tags());
}
}
リソースのクリーンアップ
その他のマネージド CCF 記事は、このクイック スタートに基づいて構築できます。 後続のクイック スタートとチュートリアルを引き続き使用する予定の場合は、これらのリソースをそのまま使用することをお望みかもしれません。
それ以外の場合は、この記事で作成したリソースが完了したら、Azure CLI az group delete コマンドを使用して、リソース グループとそのすべての含まれるリソースを削除します。
az group delete --resource-group myResourceGroup
次のステップ
このクイック スタートでは、Azure SDK for Java を使用してマネージド CCF リソースを作成しました。 Azure Managed CCF とアプリケーションとの統合方法の詳細については、次の記事に進んでください。