Azure Key Vault は、セキュリティで保護されたキーを使用して、認証キー、ストレージ アカウント キー、データ暗号化キー、.pfx ファイル、パスワードを暗号化できるサービスです。 Azure Key Vault の詳細については、「Azure Key Vault とは」を参照してください。
Azure Key Vault Managed HSM は、FIPS 140-2 レベル 3 で検証された HSM を使用してクラウド アプリケーションの暗号化キーを保護できるようにする、フル マネージドの高可用性シングルテナントの標準準拠クラウド サービスです。 Azure Key Vault Managed HSM の詳細については、「Azure Key Vault Managed HSM とは」を参照してください。
Azure Key Vault キー ライブラリ クライアントは、マネージド HSM に対して実行する場合の RSA キー、楕円曲線 (EC) キー、および対称 (10 月) キーをサポートします。各キーは、ハードウェア セキュリティ モジュール (HSM) で対応しています。 キーとそのバージョンを作成、取得、更新、削除、消去、バックアップ、復元、および一覧表示する操作が提供されます。
Node.js アプリケーションで Azure Key Vault キー用のクライアント ライブラリを使用して、次の目的で使用します。
- 省略記号または RSA 暗号化を使用してキーを作成します。必要に応じてハードウェア セキュリティ モジュール (HSM) によってサポートされます。
- キーのインポート、削除、および更新。
- 属性を使用して、1 つ以上のキーと削除されたキーを取得します。
- 削除されたキーを回復し、バックアップされたキーを復元します。
- キーのバージョンを取得します。
このライブラリで使用できる暗号化クライアントを使用すると、次のアクセスも可能です。
- 暗号化
- 復 号 化
- 署名
- 確認
- キーの折り返し
- キーのラップ解除
注: このパッケージは、Azure Key Vault サービスの制限によりブラウザーで使用できません。ガイダンスについては、このドキュメント 参照してください。
主要なリンク:
作業の開始
現在サポートされている環境
[前提条件]
- Azure サブスクリプション
- 既存の Azure Key Vault。 キー コンテナーを作成する必要がある場合は、このドキュメントの の手順に従って、Azure Portal行うことができます。 または、次の手順 従って Azure CLI を使用します。
- Managed HSM を使用している場合、既存の Azure Key Vault Managed HSM。 Managed HSM を作成する必要がある場合は、Azure CLI を使用して、このドキュメントの 手順に従って作成できます。
パッケージをインストールする
npm を使用して Azure Key Vault キー クライアント ライブラリをインストールする
npm install @azure/keyvault-keys
ID ライブラリをインストールする
Azure Key Vault クライアントは、Azure ID ライブラリを使用して認証します。 npm を使用してインストールする
npm install @azure/identity
TypeScript の構成
TypeScript ユーザーには、Node 型の定義がインストールされている必要があります。
npm install @types/node
また、tsconfig.jsonで compilerOptions.allowSyntheticDefaultImports
を有効にする必要があります。
compilerOptions.esModuleInterop
を有効にした場合、allowSyntheticDefaultImports
は既定で有効になっています。 詳細については、TypeScript のコンパイラ オプション ハンドブックの を参照してください。
重要な概念
- キー クライアント は、JavaScript アプリケーションから Azure Key Vault API のキーに関連する API メソッドと対話するための主要なインターフェイスです。 初期化されると、キーの作成、読み取り、更新、および削除に使用できる基本的な一連のメソッドが提供されます。
- キー バージョン は、Key Vault 内のキーのバージョンです。 ユーザーが一意のキー名に値を割り当てるたびに、そのキーの新しい バージョン が作成されます。 名前でキーを取得すると、クエリに特定のバージョンが指定されていない限り、常に割り当てられた最新の値が返されます。
- 論理的な削除 、Key Vault では削除と削除を 2 つの個別の手順としてサポートできるため、削除されたキーはすぐに失われるわけではありません。 これは、Key Vault で論理的な削除 が有効 場合にのみ発生します。
- キー バックアップ は、作成された任意のキーから生成できます。 これらのバックアップはバイナリ データとして提供され、以前に削除されたキーの再生成にのみ使用できます。
- Cryptography クライアント は、Key Vault API のキー API メソッドと対話する別のインターフェイスです。 このクライアントは、Key Vault に既に作成されているキーを使用して実行できる暗号化操作にのみ焦点を当てています。 このクライアントの詳細については、「Cryptography」セクションを参照してください。
Azure Active Directory での認証
Key Vault サービスは、Azure Active Directory を使用して API への要求を認証します。
@azure/identity
パッケージには、アプリケーションでこれを行うために使用できるさまざまな資格情報の種類が用意されています。
@azure/identity
用の README には、作業を開始するための詳細とサンプルが用意されています。
Azure Key Vault サービスと対話するには、KeyClient
クラスのインスタンス、コンテナーの URL、資格情報オブジェクトを作成する必要があります。 このドキュメントに示す例では、DefaultAzureCredential
という名前の資格情報オブジェクトを使用します。これは、ローカルの開発環境や運用環境など、ほとんどのシナリオに適しています。 さらに、運用環境での認証には、マネージド ID を使用することをお勧めします。
認証のさまざまな方法とそれに対応する資格情報の種類の詳細については、Azure ID のドキュメントを参照してください。
簡単な例を次に示します。 まず、DefaultAzureCredential
と KeyClient
をインポートします。 これらをインポートしたら、次に Key Vault サービスに接続できます。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
// Build the URL to reach your key vault
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`; // or `https://${vaultName}.managedhsm.azure.net` for managed HSM.
// Lastly, create our keys client and connect to the service
const client = new KeyClient(url, credential);
Azure Key Vault サービス API バージョンの指定
既定では、このパッケージでは、7.2
されている最新の Azure Key Vault サービス バージョンが使用されます。 次に示すように、クライアント コンストラクターで serviceVersion
オプションを設定することで、使用されているサービスのバージョンを変更できます。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
// Build the URL to reach your key vault
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`; // or `https://${vaultName}.managedhsm.azure.net` for managed HSM.
// Change the Azure Key Vault service API version being used via the `serviceVersion` option
const client = new KeyClient(url, credential, {
serviceVersion: "7.0", // Or 7.1
});
例示
次のセクションでは、Azure Key Vault キーを使用する一般的なタスクの一部を説明するコード スニペットを示します。 ここで説明するシナリオは、次のもので構成されます。
- キーを作成します。
- キーを取得します。
- 属性を使用したキーの作成と更新。
- キーを削除します。
- キー のリストの反復処理をします。
キーの作成
createKey
は、Azure Key Vault に格納するキーを作成します。 同じ名前のキーが既に存在する場合は、新しいバージョンのキーが作成されます。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
const result = await client.createKey(keyName, "RSA");
console.log("result: ", result);
createKey
に送信される 2 番目のパラメーターは、キーの型です。 サポートされるキーの種類は、SKU と、Azure Key Vault と Azure Managed HSM のどちらを使用しているかによって異なります。 サポートされているキーの種類の up-to日付の一覧については、「キーの について」を参照してください
キーの取得
コンテナーからキーを読み取り戻す最も簡単な方法は、名前でキーを取得することです。 これにより、キーの最新バージョンが取得されます。 オプションのパラメーターの一部としてキーを指定する場合は、必要に応じて別のバージョンのキーを取得できます。
getKey
キー コンテナー内の以前のキー ストアを取得します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
const latestKey = await client.getKey(keyName);
console.log(`Latest version of the key ${keyName}: `, latestKey);
const specificKey = await client.getKey(keyName, { version: latestKey.properties.version! });
console.log(`The key ${keyName} at the version ${latestKey.properties.version!}: `, specificKey);
属性を使用したキーの作成と更新
次の属性は、Key Vault 内の任意のキーに割り当てることもできます。
-
tags
: キーの検索とフィルター処理に使用できるキー値のセット。 -
keyOps
: このキーが実行できる操作の配列 (encrypt
、decrypt
、sign
、verify
、wrapKey
、unwrapKey
)。 -
enabled
: キー値を読み取ることができるかどうかを決定するブール値。 -
notBefore
: キー値を取得できる日付を指定します。 -
expires
: キー値を取得できない日付。
これらの属性を持つオブジェクトは、次のように、キーの名前と値の直後にある createKey
の 3 番目のパラメーターとして送信できます。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
const result = await client.createKey(keyName, "RSA", {
enabled: false,
});
console.log("result: ", result);
これにより、同じキーの新しいバージョンが作成され、最新の属性が提供されます。
属性は、次のように、updateKeyProperties
を使用して既存のキー バージョンに更新することもできます。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
const result = await client.createKey(keyName, "RSA");
await client.updateKeyProperties(keyName, result.properties.version, {
enabled: false,
});
キーの削除
beginDeleteKey
メソッドは、キーの削除を開始します。
このプロセスは、必要なリソースが利用可能になるとすぐにバックグラウンドで発生します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
const poller = await client.beginDeleteKey(keyName);
await poller.pollUntilDone();
キー コンテナー 論理的な削除 が有効になっている場合、この操作では、キーに 削除された キーとしてのみラベルが付けられます。 削除されたキーは更新できません。 読み取り、回復、または消去のみが可能です。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
const poller = await client.beginDeleteKey(keyName);
// You can use the deleted key immediately:
const deletedKey = poller.getResult();
// The key is being deleted. Only wait for it if you want to restore it or purge it.
await poller.pollUntilDone();
// You can also get the deleted key this way:
await client.getDeletedKey(keyName);
// Deleted keys can also be recovered or purged:
// recoverDeletedKey also returns a poller, just like beginDeleteKey.
const recoverPoller = await client.beginRecoverDeletedKey(keyName);
await recoverPoller.pollUntilDone();
// And here is how to purge a deleted key
await client.purgeDeletedKey(keyName);
キーが完全に削除されるまでに時間がかかるため、beginDeleteKey
は、次のガイドラインに従って基になる実行時間の長い操作を追跡する Poller オブジェクトを返 https://azure.github.io/azure-sdk/typescript_design.html#ts-lro
受け取ったポーラーを使用すると、poller.getResult()
を呼び出して削除されたキーを取得できます。
また、キーが削除されるまで個々のサービス呼び出しを実行するか、プロセスが完了するまで待機することで、削除が完了するまで待機することもできます。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
const poller = await client.beginDeleteKey(keyName);
// You can use the deleted key immediately:
let deletedKey = poller.getResult();
// Or you can wait until the key finishes being deleted:
deletedKey = await poller.pollUntilDone();
console.log(deletedKey);
キーが完全に削除されるまで待機するもう 1 つの方法は、次のように個々の呼び出しを行うことです。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const poller = await client.beginDeleteKey(keyName);
while (!poller.isDone()) {
await poller.poll();
await delay(5000);
}
console.log(`The key ${keyName} is fully deleted`);
自動キー ローテーションの構成
KeyClient を使用すると、ローテーション ポリシーを指定することで、キーの自動キー ローテーションを構成できます。 さらに、KeyClient には、指定されたキーの新しいバージョンを作成することによって、キーをオンデマンドでローテーションするメソッドが用意されています。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
// Set the key's automated rotation policy to rotate the key 30 days before expiry.
const policy = await client.updateKeyRotationPolicy(keyName, {
lifetimeActions: [
{
action: "Rotate",
timeBeforeExpiry: "P30D",
},
],
// You may also specify the duration after which any newly rotated key will expire.
// In this case, any new key versions will expire after 90 days.
expiresIn: "P90D",
});
// You can get the current key rotation policy of a given key by calling the getKeyRotationPolicy method.
const currentPolicy = await client.getKeyRotationPolicy(keyName);
// Finally, you can rotate a key on-demand by creating a new version of the given key.
const rotatedKey = await client.rotateKey(keyName);
キーのリストの反復処理
KeyClient を使用すると、Azure Key Vault 内のすべてのキーを取得して反復処理できるほか、削除されたすべてのキーと特定のキーのバージョンを使用して反復処理できます。 次の API メソッドを使用できます。
-
listPropertiesOfKeys
は、削除されていないすべてのキーを最新バージョンの名前で一覧表示します。 -
listDeletedKeys
は、削除されたすべてのキーを最新バージョンの名前で一覧表示します。 -
listPropertiesOfKeyVersions
キー名に基づいて、キーのすべてのバージョンが一覧表示されます。
次のように使用できます。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
for await (const keyProperties of client.listPropertiesOfKeys()) {
console.log("Key properties: ", keyProperties);
}
for await (const deletedKey of client.listDeletedKeys()) {
console.log("Deleted: ", deletedKey);
}
for await (const versionProperties of client.listPropertiesOfKeyVersions(keyName)) {
console.log("Version properties: ", versionProperties);
}
これらのメソッドはすべて、使用可能なすべての結果 一度に 返されます。 ページごとに取得するには、次のように、使用する API メソッドを呼び出した直後に .byPage()
を追加します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
for await (const page of client.listPropertiesOfKeys().byPage()) {
for (const keyProperties of page) {
console.log("Key properties: ", keyProperties);
}
}
for await (const page of client.listDeletedKeys().byPage()) {
for (const deletedKey of page) {
console.log("Deleted key: ", deletedKey);
}
}
for await (const page of client.listPropertiesOfKeyVersions(keyName).byPage()) {
for (const versionProperties of page) {
console.log("Version: ", versionProperties);
}
}
暗号
このライブラリには、CryptographyClient
を通じて利用可能な暗号化ユーティリティのセットも用意されています。
KeyClient
と同様に、CryptographyClient
は、指定された資格情報のセットを使用して Azure Key Vault に接続します。 接続されると、CryptographyClient
はキーの暗号化、暗号化解除、署名、検証、ラップ、キーのラップ解除を行うことができます。
次に、KeyClient
と同様に、キー コンテナー サービスに接続できます。
接続しているキー コンテナーから環境変数にいくつかの設定をコピーする必要があります。 環境に入ると、次のコードを使用してアクセスできます。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
// Create or retrieve a key from the keyvault
const myKey = await client.createKey("MyKey", "RSA");
// Lastly, create our cryptography client and connect to the service
const cryptographyClient = new CryptographyClient(myKey, credential);
暗号化する
encrypt
はメッセージを暗号化します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const myKey = await client.createKey("MyKey", "RSA");
const cryptographyClient = new CryptographyClient(myKey.id, credential);
const encryptResult = await cryptographyClient.encrypt({
algorithm: "RSA1_5",
plaintext: Buffer.from("My Message"),
});
console.log("encrypt result: ", encryptResult.result);
復号化
decrypt
は、暗号化されたメッセージを復号化します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const myKey = await client.createKey("MyKey", "RSA");
const cryptographyClient = new CryptographyClient(myKey.id, credential);
const encryptResult = await cryptographyClient.encrypt({
algorithm: "RSA1_5",
plaintext: Buffer.from("My Message"),
});
console.log("encrypt result: ", encryptResult.result);
const decryptResult = await cryptographyClient.decrypt({
algorithm: "RSA1_5",
ciphertext: encryptResult.result,
});
console.log("decrypt result: ", decryptResult.result.toString());
署名
sign
は、メッセージのダイジェスト (ハッシュ) に署名を使用して暗号で署名します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
import { createHash } from "node:crypto";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
let myKey = await client.createKey("MyKey", "RSA");
const cryptographyClient = new CryptographyClient(myKey, credential);
const signatureValue = "MySignature";
const hash = createHash("sha256");
const digest = hash.update(signatureValue).digest();
console.log("digest: ", digest);
const signResult = await cryptographyClient.sign("RS256", digest);
console.log("sign result: ", signResult.result);
データに署名する
signData
は、署名を使用してメッセージに暗号で署名します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const myKey = await client.createKey("MyKey", "RSA");
const cryptographyClient = new CryptographyClient(myKey, credential);
const signResult = await cryptographyClient.signData("RS256", Buffer.from("My Message"));
console.log("sign result: ", signResult.result);
確認する
verify
は、署名されたダイジェストが指定された署名で署名されたことを暗号で確認します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
import { createHash } from "node:crypto";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const myKey = await client.createKey("MyKey", "RSA");
const cryptographyClient = new CryptographyClient(myKey, credential);
const hash = createHash("sha256");
hash.update("My Message");
const digest = hash.digest();
const signResult = await cryptographyClient.sign("RS256", digest);
console.log("sign result: ", signResult.result);
const verifyResult = await cryptographyClient.verify("RS256", digest, signResult.result);
console.log("verify result: ", verifyResult.result);
データの確認
verifyData
は、署名されたメッセージが指定された署名で署名されたことを暗号で確認します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const myKey = await client.createKey("MyKey", "RSA");
const cryptographyClient = new CryptographyClient(myKey, credential);
const buffer = Buffer.from("My Message");
const signResult = await cryptographyClient.signData("RS256", buffer);
console.log("sign result: ", signResult.result);
const verifyResult = await cryptographyClient.verifyData("RS256", buffer, signResult.result);
console.log("verify result: ", verifyResult.result);
キーのラップ
wrapKey
は、暗号化レイヤーでキーをラップします。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const myKey = await client.createKey("MyKey", "RSA");
const cryptographyClient = new CryptographyClient(myKey, credential);
const wrapResult = await cryptographyClient.wrapKey("RSA-OAEP", Buffer.from("My Key"));
console.log("wrap result:", wrapResult.result);
キーのラップ解除
unwrapKey
はラップされたキーのラップを解除します。
import { DefaultAzureCredential } from "@azure/identity";
import { KeyClient, CryptographyClient } from "@azure/keyvault-keys";
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const myKey = await client.createKey("MyKey", "RSA");
const cryptographyClient = new CryptographyClient(myKey, credential);
const wrapResult = await cryptographyClient.wrapKey("RSA-OAEP", Buffer.from("My Key"));
console.log("wrap result:", wrapResult.result);
const unwrapResult = await cryptographyClient.unwrapKey("RSA-OAEP", wrapResult.result);
console.log("unwrap result: ", unwrapResult.result);
トラブルシューティング
さまざまな障害シナリオを診断する方法の詳細については、トラブルシューティング ガイドの を参照してください。
ログ記録を有効にすると、エラーに関する有用な情報を明らかにするのに役立つ場合があります。 HTTP 要求と応答のログを表示するには、AZURE_LOG_LEVEL
環境変数を info
に設定します。 または、setLogLevel
で @azure/logger
を呼び出すことによって、実行時にログを有効にすることもできます。
import { setLogLevel } from "@azure/logger";
setLogLevel("info");
次のステップ
その他のコード サンプルについては、次のリンクを参照してください。
投稿
このライブラリに投稿する場合は、コードをビルドしてテストする方法の詳細については、投稿ガイド を参照してください。
Azure SDK for JavaScript