ユーザー定義エンドポイント (UDE) を使用すると、カスタム コードをレジャーと同じ信頼された実行環境 (TEE) で実行できます。 この機能により、機密性と整合性の保証の利点がカスタム コードに拡張されます。 また、承認のためのカスタム ロールベースのアクセス制御 (RBAC) もサポートされています。 UDEs は、以前は高度なユーザー定義関数と呼ばれていました。
注
UDEs を操作するには、REST API バージョン 2026-02-23 以降を使用してください。
ヒント
簡易なカスタム ロジックや台帳 API との直接統合など、より単純なシナリオについては、Azure Confidential Ledger のユーザー定義関数を参照してください。
活用事例
ユーザー定義エンドポイントが役に立つシナリオをいくつか次に示します。
- データの分析と集計: 機密情報は TEE で処理でき、集計された情報は関係者と共有できます。
- 機密情報の保護: 個人データ、クレジット スコア、正常性情報などの機密情報は、構成証明後に他の機密ワークロードと共有できます。
[前提条件]
- サブスクリプション所有者 - confidential ledger は、Azure サブスクリプションに対する 所有者 アクセス許可を持つユーザーのみが作成できます。 このクイック スタートを続行する前に、適切なアクセス権があることを確認してください。
このチュートリアルでは、台帳インスタンスを作成したことを前提としています。 Azure portal、Azure CLI、または Azure PowerShell を使用して作成できます。
アプリケーションの開発
台帳アプリケーションは TypeScript を使用して開発され、JavaScript バンドルにロールアップされます。 開発プロセスの詳細については、 Confidential Consortium Framework (CCF) のドキュメントを参照してください。
エンドポイント パスの長さは制限されており、一部のパスは予約されています。 詳細については、Azure confidential ledger limitsを参照してください。
重要
アプリケーションをデプロイし、台帳でカスタム RBAC を管理できるのは管理者だけです。 セクションの残りの部分では、管理者がコマンドを実行することを前提としています。
この機能を示すには、 azureconfidentialledger-app-samples リポジトリで利用できる銀行アプリケーションを使用します。
注
銀行業務アプリケーションでは、口座開設、カスタム ロールとアクションを使用した資金の入金と送金など、一般的に使用される銀行業務シナリオ用の API が公開されています。
Azure にサインインする
注
Azure機密台帳は、Microsoft Entra ID を標準でサポートしています。 アプリケーションが他の ID プロバイダーと統合されている場合は、カスタマー サポートに連絡して、それらを台帳で構成してもらってください。
Microsoft Entra ID トークンを取得します。
az login --use-device-code
az account get-access-token --resource https://confidential-ledger.azure.com
出力から生のトークン値をコピーします。
台帳 ID をダウンロードする
台帳は、サービス証明書と呼ばれる証明書によって一意に識別されます。 これは、台帳へのセキュリティで保護された接続を確立するために使用されます。 既知のエンドポイントからダウンロードし、servicer_cert.pem に保存します。
注
contoso は台帳の名前です。 これを適切な台帳名に置き換えます。
curl https://identity.confidential-ledger.core.azure.com/ledgerIdentity/contoso --silent | jq ' .ledgerTlsCertificate' | xargs echo -e > service_cert.pem
アプリケーションをデプロイする
/app/userDefinedEndpoints エンドポイントを呼び出して、JavaScript アプリケーション バンドルをデプロイします。
apiVersion="2026-02-23"
content_type_application_json="Content-Type: application/json"
bundle="/path/to/bundle.json"
authorization="Authorization: Bearer raw_token_value"
server_identity="--cacert service_cert.pem"
# Deploy the application
#
curl $server_identity -X PUT "https://contoso.confidential-ledger.azure.com/app/userDefinedEndpoints?api-version=$apiVersion" -H "$content_type_application_json" -H "$authorization" -d @$bundle
# View the application
#
curl $server_identity "https://contoso.confidential-ledger.azure.com/app/userDefinedEndpoints?api-version=$apiVersion" -H "$authorization"
注
ユーザー定義エンドポイントと ユーザー定義関数 (UDF) は、相互に排他的な機能です。 UDE が定義されている場合は UDF を作成または実行できません。その逆も同様です。 2 つを切り替えるには、「 UDF と UDE の切り替え」の手順に従います。
ロールとユーザーを作成する
銀行業務アプリケーションは、 マネージャー と 窓口という 2 つのペルソナを使用します。 それらを表すロールとユーザーを作成します。
注
各ユーザーは、一意の証明書で表されます。
注
アプリケーション ユーザーには、組み込みのロール (つまり、管理者、共同作成者、閲覧者) を割り当てることができます。 カスタム ロールでは大文字と小文字が区別されます。 組み込みロールでは大文字と小文字が区別されません。 ユーザーには複数のロールを割り当てることができます。
apiVersion="2026-02-23"
content_type_application_json="Content-Type: application/json"
content_type_merge_patch_json="Content-Type: application/merge-patch+json"
authorization="Authorization: Bearer raw_token_value"
curve="secp384r1"
server_identity="--cacert service_cert.pem"
# These actions must match (case-sensitive) the values defined in the application.
#
role_actions='{"roles":[{"role_name":"manager","role_actions":["/banking/accounts/post","/banking/accounts/put","/banking/accounts/get","/banking/accounts/patch"]},{"role_name":"teller","role_actions":["/banking/accounts/put","/banking/accounts/get","/banking/accounts/patch"]}]}'
# Create the roles.
#
curl $server_identity -X PUT "https://contoso.confidential-ledger.azure.com/app/roles?api-version=$apiVersion" -H "$content_type_application_json" -H "$authorization" -d $role_actions
# View the roles
#
curl $server_identity "https://contoso.confidential-ledger.azure.com/app/roles?api-version=$apiVersion" -H "$authorization"
# Create a certificate for the manager user.
#
openssl ecparam -out "manager_privk.pem" -name "$curve" -genkey
openssl req -new -key "manager_privk.pem" -x509 -nodes -days 365 -out "manager_cert.pem" -sha384 -subj=/CN="manager"
manager_cert_fingerprint=$(openssl x509 -in "manager_cert.pem" -noout -fingerprint -sha256 | cut -d "=" -f 2)
manager_user="{\"user_id\":\"$manager_cert_fingerprint\",\"assignedRoles\":[\"manager\"]}"
# Create a certificate for the teller user.
#
openssl ecparam -out "teller_privk.pem" -name "$curve" -genkey
openssl req -new -key "teller_privk.pem" -x509 -nodes -days 365 -out "teller_cert.pem" -sha384 -subj=/CN="teller"
teller_cert_fingerprint=$(openssl x509 -in "teller_cert.pem" -noout -fingerprint -sha256 | cut -d "=" -f 2)
teller_user="{\"user_id\":\"$teller_cert_fingerprint\",\"assignedRoles\":[\"teller\"]}"
# Create the manager user.
#
curl $server_identity -X PATCH "https://contoso.confidential-ledger.azure.com/app/ledgerUsers/$manager_cert_fingerprint?api-version=$apiVersion" -H "$content_type_merge_patch_json" -H "$authorization" -d $manager_user
# Create the teller user.
#
curl $server_identity -X PATCH "https://contoso.confidential-ledger.azure.com/app/ledgerUsers/$teller_cert_fingerprint?api-version=$apiVersion" -H "$content_type_merge_patch_json" -H "$authorization" -d $teller_user
# View the users
#
curl $server_identity "https://contoso.confidential-ledger.azure.com/app/ledgerUsers?api-version=$apiVersion" -H "$authorization"
ランタイム設定を更新する(オプション)
/app/userDefinedEndpoints/runtimeOptions エンドポイントを呼び出して、JavaScript ランタイム構成を更新します。
max_heap_bytes、max_stack_bytes、max_execution_time_ms、およびmax_cached_interpretersのオプションを設定できます。 台帳は、許可された範囲外の値を持つ要求を拒否します。 使用できる値については、Azure Confidential Ledger の制限を参照してください。 オプションを既定値にリセットするには、その値を null に設定します。
log_exception_detailsとreturn_exception_detailsをtrueまたはfalseに設定することもできます。
次の例では、最大実行時間を 2,000 ミリ秒に設定します。
apiVersion="2026-02-23"
content_type_merge_patch_json="Content-Type: application/merge-patch+json"
authorization="Authorization: Bearer raw_token_value"
runtime_options="{\"max_execution_time_ms\":2000}"
server_identity="--cacert service_cert.pem"
# Patch the runtime options
#
curl $server_identity -X PATCH "https://contoso.confidential-ledger.azure.com/app/userDefinedEndpoints/runtimeOptions?api-version=$apiVersion" -H "$content_type_merge_patch_json" -H "$authorization" -d $runtime_options
# View the runtime options
#
curl $server_identity "https://contoso.confidential-ledger.azure.com/app/userDefinedEndpoints/runtimeOptions?api-version=$apiVersion" -H "$authorization"
これで、アプリケーション エンドポイントを呼び出してトランザクションを送信する準備ができました。
リソースをクリーンアップする
このコレクションの他のクイックスタートとチュートリアルは、このクイックスタートに基づいています。 後続のクイック スタートおよびチュートリアルを引き続き実行する場合は、これらのリソースをそのまま残しておくことをお勧めします。
不要になったら、Azure CLI az group delete コマンドを使用して、リソース グループとすべての関連リソースを削除できます。
az group delete --name "myResourceGroup"
次のステップ
このチュートリアルでは、カスタム JavaScript アプリケーションをコンフィデンシャル レジャーのインスタンスにデプロイしました。 Azure Confidential Ledger の詳細と、それをアプリケーションと統合する方法については、次の記事に進んでください。