Share via


KeyClient class

KeyClient には、Azure Key Vaultで KeyVaultKey を管理するメソッドが用意されています。 クライアントでは、KeyVaultKeys の作成、取得、更新、削除、消去、バックアップ、復元、一覧表示がサポートされています。 クライアントでは、論理的な削除が有効な Azure Key Vaultの DeletedKey の一覧表示もサポートされています。

コンストラクター

KeyClient(string, TokenCredential, KeyClientOptions)

KeyClient のインスタンスを作成します。

使用例:

import { KeyClient } from "@azure/keyvault-keys";
import { DefaultAzureCredential } from "@azure/identity";

let vaultUrl = `https://<MY KEYVAULT HERE>.vault.azure.net`;
let credentials = new DefaultAzureCredential();

let client = new KeyClient(vaultUrl, credentials);

プロパティ

vaultUrl

コンテナーへのベース URL

メソッド

backupKey(string, BackupKeyOptions)

指定したキーのバックアップをクライアントにダウンロードするように要求します。 キーのすべてのバージョンがダウンロードされます。 この操作には、キー/バックアップのアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let backupContents = await client.backupKey("MyKey");

指定したキーをバックアップします。

beginDeleteKey(string, BeginDeleteKeyOptions)

削除操作は、Azure Key Vaultに格納されているすべてのキーに適用されます。 キーの個々のバージョンを削除することはできません。特定のキーのすべてのバージョンのみを一度に削除できます。

この関数は、キーが削除されるまで無期限に待機できる実行時間の長い操作ポーリング ャーを返します。

この操作には、keys/delete のアクセス許可が必要です。

使用例:

const client = new KeyClient(url, credentials);
await client.createKey("MyKey", "EC");
const poller = await client.beginDeleteKey("MyKey");

// Serializing the poller
const serialized = poller.toString();
// A new poller can be created with:
// await client.beginDeleteKey("MyKey", { resumeFrom: serialized });

// Waiting until it's done
const deletedKey = await poller.pollUntilDone();
console.log(deletedKey);

指定したキー コンテナーからキーを削除します。

beginRecoverDeletedKey(string, BeginRecoverDeletedKeyOptions)

指定したコンテナー内の削除されたキーを回復します。 この操作は、論理的な削除が有効なコンテナーでのみ実行できます。

この関数は、削除されたキーが回復されるまで無期限に待機できる実行時間の長い操作ポーリング ャーを返します。

この操作には、キー/回復アクセス許可が必要です。

使用例:

const client = new KeyClient(url, credentials);
await client.createKey("MyKey", "EC");
const deletePoller = await client.beginDeleteKey("MyKey");
await deletePoller.pollUntilDone();
const poller = await client.beginRecoverDeletedKey("MyKey");

// Serializing the poller
const serialized = poller.toString();
// A new poller can be created with:
// await client.beginRecoverDeletedKey("MyKey", { resumeFrom: serialized });

// Waiting until it's done
const key = await poller.pollUntilDone();
console.log(key);

削除されたキーを最新バージョンに回復します。

createEcKey(string, CreateEcKeyOptions)

createEcKey メソッドは、Azure Key Vaultで新しい楕円曲線キーを作成します。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 キー/作成アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let result = await client.createEcKey("MyKey", { curve: "P-256" });

新しいキーを作成して格納し、キー パラメーターとプロパティをクライアントに返します。

createKey(string, string, CreateKeyOptions)

キーの作成操作を使用して、Azure Key Vaultで任意のキーの種類を作成できます。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 キー/作成アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
// Create an elliptic-curve key:
let result = await client.createKey("MyKey", "EC");

新しいキーを作成して格納し、キー パラメーターとプロパティをクライアントに返します。

createOctKey(string, CreateOctKeyOptions)

createOctKey メソッドは、Azure Key Vaultに新しい OCT キーを作成します。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 キー/作成アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let result = await client.createOctKey("MyKey", { hsm: true });

新しいキーを作成して格納し、キー パラメーターとプロパティをクライアントに返します。

createRsaKey(string, CreateRsaKeyOptions)

createRSAKey メソッドは、Azure Key Vaultで新しい RSA キーを作成します。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 キー/作成アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let result = await client.createRsaKey("MyKey", { keySize: 2048 });

新しいキーを作成して格納し、キー パラメーターとプロパティをクライアントに返します。

getCryptographyClient(string, GetCryptographyClientOptions)

指定されたキーの CryptographyClient を取得します。

使用例:

let client = new KeyClient(url, credentials);
// get a cryptography client for a given key
let cryptographyClient = client.getCryptographyClient("MyKey");
getDeletedKey(string, GetDeletedKeyOptions)

getDeletedKey メソッドは、指定された削除されたキーとそのプロパティを返します。 この操作には、キー/取得アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let key = await client.getDeletedKey("MyDeletedKey");

指定した削除されたキーを取得します。

getKey(string, GetKeyOptions)

getKey メソッドは、指定されたキーを取得し、Azure Key Vaultに格納されているすべてのキーに適用されます。 この操作には、キー/取得アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let key = await client.getKey("MyKey");

指定したキー コンテナーから指定したキーを取得します。

getKeyRotationPolicy(string, GetKeyRotationPolicyOptions)

Key Vault キーのローテーション ポリシーを取得します。 既定では、すべてのキーには、有効期限の 30 日前に通知するポリシーがあります。

この操作には、キー/取得アクセス許可が必要です。 使用例:

let client = new KeyClient(vaultUrl, credentials);
let result = await client.getKeyRotationPolicy("myKey");
getRandomBytes(number, GetRandomBytesOptions)

マネージド HSM からランダムな値を含む要求されたバイト数を取得します。 この操作には、managedHsm/rng アクセス許可が必要です。

使用例:

let client = new KeyClient(vaultUrl, credentials);
let { bytes } = await client.getRandomBytes(10);
importKey(string, JsonWebKey_2, ImportKeyOptions)

キーのインポート操作は、任意の種類のキーを Azure Key Vaultにインポートするために使用できます。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 この操作には、キー/インポートアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
// Key contents in myKeyContents
let result = await client.importKey("MyKey", myKeyContents);

外部で作成されたキーをインポートして格納し、キー パラメーターとプロパティをクライアントに返します。

listDeletedKeys(ListDeletedKeysOptions)

コンテナー内の削除されたキーを反復処理します。 完全なキー識別子とプロパティは、応答で提供されます。 キーの値は返されません。 この操作には、キー/リストのアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
for await (const deletedKey of client.listDeletedKeys()) {
  console.log("deleted key: ", deletedKey);
}

コンテナー内のすべてのキーを一覧表示する

listPropertiesOfKeys(ListPropertiesOfKeysOptions)

コンテナー内のすべてのキーの最新バージョンを反復処理します。 完全なキー識別子とプロパティは、応答で提供されます。 キーの値は返されません。 この操作には、キー/リストのアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
for await (const keyProperties of client.listPropertiesOfKeys()) {
  const key = await client.getKey(keyProperties.name);
  console.log("key: ", key);
}

コンテナー内のすべてのキーを一覧表示する

listPropertiesOfKeyVersions(string, ListPropertiesOfKeyVersionsOptions)

コンテナー内の指定されたキーのすべてのバージョンを反復処理します。 完全なキー識別子、プロパティ、タグが応答で提供されます。 この操作には、キー/リストのアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
for await (const keyProperties of client.listPropertiesOfKeyVersions("MyKey")) {
  const key = await client.getKey(keyProperties.name);
  console.log("key version: ", key);
}
purgeDeletedKey(string, PurgeDeletedKeyOptions)

削除されたキーの消去操作では、回復の可能性なしにキーが完全に削除されます。 この操作は、論理的な削除が有効なコンテナーでのみ有効にすることができます。 この操作には、キー/消去アクセス許可が必要です。

使用例:

const client = new KeyClient(url, credentials);
const deletePoller = await client.beginDeleteKey("MyKey")
await deletePoller.pollUntilDone();
await client.purgeDeletedKey("MyKey");

指定したキーを完全に削除します。

releaseKey(string, string, ReleaseKeyOptions)

マネージド HSM からキーを解放します。

リリース キー操作は、すべてのキーの種類に適用できます。 この操作では、キーをエクスポート可能とマークし、キー/リリースアクセス許可を設定する必要があります。

使用例:

let client = new KeyClient(vaultUrl, credentials);
let result = await client.releaseKey("myKey", target)
restoreKeyBackup(Uint8Array, RestoreKeyBackupOptions)

バックアップされたキーとそのすべてのバージョンを資格情報コンテナーに復元します。 この操作には、キー/復元アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let backupContents = await client.backupKey("MyKey");
// ...
let key = await client.restoreKeyBackup(backupContents);

バックアップされたキーをコンテナーに復元します。

rotateKey(string, RotateKeyOptions)

キーの新しいバージョンを生成して、キー ポリシーに基づいてキーをローテーションします。 この操作には、キー/回転アクセス許可が必要です。

使用例:

let client = new KeyClient(vaultUrl, credentials);
let key = await client.rotateKey("MyKey");
updateKeyProperties(string, string, UpdateKeyPropertiesOptions)

updateKeyProperties メソッドは、既存の格納されているキーの指定されたプロパティを変更します。 要求で指定されていないプロパティは変更されません。 キー自体の値は変更できません。 この操作には、キー/設定のアクセス許可が必要です。

使用例:

let keyName = "MyKey";
let client = new KeyClient(vaultUrl, credentials);
let key = await client.getKey(keyName);
let result = await client.updateKeyProperties(keyName, key.properties.version, { enabled: false });

指定したキー コンテナー内の指定したキーに関連付けられているプロパティを更新します。

updateKeyProperties(string, UpdateKeyPropertiesOptions)

updateKeyProperties メソッドは、既存の格納されているキーの最新バージョンの指定されたプロパティを変更します。 要求で指定されていないプロパティは変更されません。 キー自体の値は変更できません。 この操作には、キー/設定のアクセス許可が必要です。

使用例:

let keyName = "MyKey";
let client = new KeyClient(vaultUrl, credentials);
let key = await client.getKey(keyName);
let result = await client.updateKeyProperties(keyName, { enabled: false });

指定したキー コンテナー内の指定したキーに関連付けられているプロパティを更新します。

updateKeyRotationPolicy(string, KeyRotationPolicyProperties, UpdateKeyRotationPolicyOptions)

Key Vault キーのローテーション ポリシーを更新します。 この操作には、キー/更新アクセス許可が必要です。

使用例:

let client = new KeyClient(vaultUrl, credentials);
const setPolicy = await client.updateKeyRotationPolicy("MyKey", myPolicy);

コンストラクターの詳細

KeyClient(string, TokenCredential, KeyClientOptions)

KeyClient のインスタンスを作成します。

使用例:

import { KeyClient } from "@azure/keyvault-keys";
import { DefaultAzureCredential } from "@azure/identity";

let vaultUrl = `https://<MY KEYVAULT HERE>.vault.azure.net`;
let credentials = new DefaultAzureCredential();

let client = new KeyClient(vaultUrl, credentials);
new KeyClient(vaultUrl: string, credential: TokenCredential, pipelineOptions?: KeyClientOptions)

パラメーター

vaultUrl

string

Key Vaultの URL。 この図形 https://${your-key-vault-name}.vault.azure.netは である必要があります。 この URL が有効なKey Vaultまたは Managed HSM リソースを参照していることを検証する必要があります。 詳細については、https://aka.ms/azsdk/blog/vault-uri を参照してください。

credential
TokenCredential

サービスへの要求を TokenCredential 認証するために使用されるインターフェイスを実装する オブジェクト。 パッケージを @azure/identity 使用して、ニーズに合った資格情報を作成します。

pipelineOptions
KeyClientOptions

Key Vault API 要求を構成するために使用されるパイプライン オプション。 既定のパイプライン構成を使用するには、このパラメーターを省略します。

プロパティの詳細

vaultUrl

コンテナーへのベース URL

vaultUrl: string

プロパティ値

string

メソッドの詳細

backupKey(string, BackupKeyOptions)

指定したキーのバックアップをクライアントにダウンロードするように要求します。 キーのすべてのバージョンがダウンロードされます。 この操作には、キー/バックアップのアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let backupContents = await client.backupKey("MyKey");

指定したキーをバックアップします。

function backupKey(name: string, options?: BackupKeyOptions): Promise<undefined | Uint8Array>

パラメーター

name

string

キーの名前です。

options
BackupKeyOptions

省略可能なパラメーター。

戻り値

Promise<undefined | Uint8Array>

beginDeleteKey(string, BeginDeleteKeyOptions)

削除操作は、Azure Key Vaultに格納されているすべてのキーに適用されます。 キーの個々のバージョンを削除することはできません。特定のキーのすべてのバージョンのみを一度に削除できます。

この関数は、キーが削除されるまで無期限に待機できる実行時間の長い操作ポーリング ャーを返します。

この操作には、keys/delete のアクセス許可が必要です。

使用例:

const client = new KeyClient(url, credentials);
await client.createKey("MyKey", "EC");
const poller = await client.beginDeleteKey("MyKey");

// Serializing the poller
const serialized = poller.toString();
// A new poller can be created with:
// await client.beginDeleteKey("MyKey", { resumeFrom: serialized });

// Waiting until it's done
const deletedKey = await poller.pollUntilDone();
console.log(deletedKey);

指定したキー コンテナーからキーを削除します。

function beginDeleteKey(name: string, options?: BeginDeleteKeyOptions): Promise<PollerLike<PollOperationState<DeletedKey>, DeletedKey>>

パラメーター

name

string

キーの名前です。

options
BeginDeleteKeyOptions

省略可能なパラメーター。

戻り値

beginRecoverDeletedKey(string, BeginRecoverDeletedKeyOptions)

指定したコンテナー内の削除されたキーを回復します。 この操作は、論理的な削除が有効なコンテナーでのみ実行できます。

この関数は、削除されたキーが回復されるまで無期限に待機できる実行時間の長い操作ポーリング ャーを返します。

この操作には、キー/回復アクセス許可が必要です。

使用例:

const client = new KeyClient(url, credentials);
await client.createKey("MyKey", "EC");
const deletePoller = await client.beginDeleteKey("MyKey");
await deletePoller.pollUntilDone();
const poller = await client.beginRecoverDeletedKey("MyKey");

// Serializing the poller
const serialized = poller.toString();
// A new poller can be created with:
// await client.beginRecoverDeletedKey("MyKey", { resumeFrom: serialized });

// Waiting until it's done
const key = await poller.pollUntilDone();
console.log(key);

削除されたキーを最新バージョンに回復します。

function beginRecoverDeletedKey(name: string, options?: BeginRecoverDeletedKeyOptions): Promise<PollerLike<PollOperationState<DeletedKey>, DeletedKey>>

パラメーター

name

string

削除されたキーの名前。

options
BeginRecoverDeletedKeyOptions

省略可能なパラメーター。

戻り値

createEcKey(string, CreateEcKeyOptions)

createEcKey メソッドは、Azure Key Vaultで新しい楕円曲線キーを作成します。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 キー/作成アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let result = await client.createEcKey("MyKey", { curve: "P-256" });

新しいキーを作成して格納し、キー パラメーターとプロパティをクライアントに返します。

function createEcKey(name: string, options?: CreateEcKeyOptions): Promise<KeyVaultKey>

パラメーター

name

string

キーの名前です。

options
CreateEcKeyOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

createKey(string, string, CreateKeyOptions)

キーの作成操作を使用して、Azure Key Vaultで任意のキーの種類を作成できます。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 キー/作成アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
// Create an elliptic-curve key:
let result = await client.createKey("MyKey", "EC");

新しいキーを作成して格納し、キー パラメーターとプロパティをクライアントに返します。

function createKey(name: string, keyType: string, options?: CreateKeyOptions): Promise<KeyVaultKey>

パラメーター

name

string

キーの名前です。

keyType

string

キーの型。 次のいずれか: 'EC'、'EC-HSM'、'RSA'、'RSA-HSM'、'oct'。

options
CreateKeyOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

createOctKey(string, CreateOctKeyOptions)

createOctKey メソッドは、Azure Key Vaultに新しい OCT キーを作成します。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 キー/作成アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let result = await client.createOctKey("MyKey", { hsm: true });

新しいキーを作成して格納し、キー パラメーターとプロパティをクライアントに返します。

function createOctKey(name: string, options?: CreateOctKeyOptions): Promise<KeyVaultKey>

パラメーター

name

string

キーの名前です。

options
CreateOctKeyOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

createRsaKey(string, CreateRsaKeyOptions)

createRSAKey メソッドは、Azure Key Vaultで新しい RSA キーを作成します。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 キー/作成アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let result = await client.createRsaKey("MyKey", { keySize: 2048 });

新しいキーを作成して格納し、キー パラメーターとプロパティをクライアントに返します。

function createRsaKey(name: string, options?: CreateRsaKeyOptions): Promise<KeyVaultKey>

パラメーター

name

string

キーの名前です。

options
CreateRsaKeyOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

getCryptographyClient(string, GetCryptographyClientOptions)

指定されたキーの CryptographyClient を取得します。

使用例:

let client = new KeyClient(url, credentials);
// get a cryptography client for a given key
let cryptographyClient = client.getCryptographyClient("MyKey");
function getCryptographyClient(keyName: string, options?: GetCryptographyClientOptions): CryptographyClient

パラメーター

keyName

string

戻り値

getDeletedKey(string, GetDeletedKeyOptions)

getDeletedKey メソッドは、指定された削除されたキーとそのプロパティを返します。 この操作には、キー/取得アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let key = await client.getDeletedKey("MyDeletedKey");

指定した削除されたキーを取得します。

function getDeletedKey(name: string, options?: GetDeletedKeyOptions): Promise<DeletedKey>

パラメーター

name

string

キーの名前です。

options
GetDeletedKeyOptions

省略可能なパラメーター。

戻り値

Promise<DeletedKey>

getKey(string, GetKeyOptions)

getKey メソッドは、指定されたキーを取得し、Azure Key Vaultに格納されているすべてのキーに適用されます。 この操作には、キー/取得アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let key = await client.getKey("MyKey");

指定したキー コンテナーから指定したキーを取得します。

function getKey(name: string, options?: GetKeyOptions): Promise<KeyVaultKey>

パラメーター

name

string

キーの名前です。

options
GetKeyOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

getKeyRotationPolicy(string, GetKeyRotationPolicyOptions)

Key Vault キーのローテーション ポリシーを取得します。 既定では、すべてのキーには、有効期限の 30 日前に通知するポリシーがあります。

この操作には、キー/取得アクセス許可が必要です。 使用例:

let client = new KeyClient(vaultUrl, credentials);
let result = await client.getKeyRotationPolicy("myKey");
function getKeyRotationPolicy(keyName: string, options?: GetKeyRotationPolicyOptions): Promise<KeyRotationPolicy>

パラメーター

keyName

string

キーの名前です。

options
GetKeyRotationPolicyOptions

省略可能なパラメーター。

戻り値

getRandomBytes(number, GetRandomBytesOptions)

マネージド HSM からランダムな値を含む要求されたバイト数を取得します。 この操作には、managedHsm/rng アクセス許可が必要です。

使用例:

let client = new KeyClient(vaultUrl, credentials);
let { bytes } = await client.getRandomBytes(10);
function getRandomBytes(count: number, options?: GetRandomBytesOptions): Promise<Uint8Array>

パラメーター

count

number

1 から 128 までの範囲で生成するバイト数。

options
GetRandomBytesOptions

省略可能なパラメーター。

戻り値

Promise<Uint8Array>

importKey(string, JsonWebKey_2, ImportKeyOptions)

キーのインポート操作は、任意の種類のキーを Azure Key Vaultにインポートするために使用できます。 名前付きのキーが既に存在する場合は、Azure Key Vault によりキーの新しいバージョンが作成されます。 この操作には、キー/インポートアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
// Key contents in myKeyContents
let result = await client.importKey("MyKey", myKeyContents);

外部で作成されたキーをインポートして格納し、キー パラメーターとプロパティをクライアントに返します。

function importKey(name: string, key: JsonWebKey_2, options?: ImportKeyOptions): Promise<KeyVaultKey>

パラメーター

name

string

インポートされたキーの名前。

key
JsonWebKey

JSON Web キー。

options
ImportKeyOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

listDeletedKeys(ListDeletedKeysOptions)

コンテナー内の削除されたキーを反復処理します。 完全なキー識別子とプロパティは、応答で提供されます。 キーの値は返されません。 この操作には、キー/リストのアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
for await (const deletedKey of client.listDeletedKeys()) {
  console.log("deleted key: ", deletedKey);
}

コンテナー内のすべてのキーを一覧表示する

function listDeletedKeys(options?: ListDeletedKeysOptions): PagedAsyncIterableIterator<DeletedKey, DeletedKey[], PageSettings>

パラメーター

options
ListDeletedKeysOptions

省略可能なパラメーター。

戻り値

listPropertiesOfKeys(ListPropertiesOfKeysOptions)

コンテナー内のすべてのキーの最新バージョンを反復処理します。 完全なキー識別子とプロパティは、応答で提供されます。 キーの値は返されません。 この操作には、キー/リストのアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
for await (const keyProperties of client.listPropertiesOfKeys()) {
  const key = await client.getKey(keyProperties.name);
  console.log("key: ", key);
}

コンテナー内のすべてのキーを一覧表示する

function listPropertiesOfKeys(options?: ListPropertiesOfKeysOptions): PagedAsyncIterableIterator<KeyProperties, KeyProperties[], PageSettings>

パラメーター

options
ListPropertiesOfKeysOptions

省略可能なパラメーター。

戻り値

listPropertiesOfKeyVersions(string, ListPropertiesOfKeyVersionsOptions)

コンテナー内の指定されたキーのすべてのバージョンを反復処理します。 完全なキー識別子、プロパティ、タグが応答で提供されます。 この操作には、キー/リストのアクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
for await (const keyProperties of client.listPropertiesOfKeyVersions("MyKey")) {
  const key = await client.getKey(keyProperties.name);
  console.log("key version: ", key);
}
function listPropertiesOfKeyVersions(name: string, options?: ListPropertiesOfKeyVersionsOptions): PagedAsyncIterableIterator<KeyProperties, KeyProperties[], PageSettings>

パラメーター

name

string

バージョンをフェッチするキーの名前

options
ListPropertiesOfKeyVersionsOptions

省略可能なパラメーター。

戻り値

purgeDeletedKey(string, PurgeDeletedKeyOptions)

削除されたキーの消去操作では、回復の可能性なしにキーが完全に削除されます。 この操作は、論理的な削除が有効なコンテナーでのみ有効にすることができます。 この操作には、キー/消去アクセス許可が必要です。

使用例:

const client = new KeyClient(url, credentials);
const deletePoller = await client.beginDeleteKey("MyKey")
await deletePoller.pollUntilDone();
await client.purgeDeletedKey("MyKey");

指定したキーを完全に削除します。

function purgeDeletedKey(name: string, options?: PurgeDeletedKeyOptions): Promise<void>

パラメーター

name

string

キーの名前です。

options
PurgeDeletedKeyOptions

省略可能なパラメーター。

戻り値

Promise<void>

releaseKey(string, string, ReleaseKeyOptions)

マネージド HSM からキーを解放します。

リリース キー操作は、すべてのキーの種類に適用できます。 この操作では、キーをエクスポート可能とマークし、キー/リリースアクセス許可を設定する必要があります。

使用例:

let client = new KeyClient(vaultUrl, credentials);
let result = await client.releaseKey("myKey", target)
function releaseKey(name: string, targetAttestationToken: string, options?: ReleaseKeyOptions): Promise<ReleaseKeyResult>

パラメーター

name

string

キーの名前です。

targetAttestationToken

string

キー リリースのターゲットの構成証明アサーション。

options
ReleaseKeyOptions

省略可能なパラメーター。

戻り値

Promise<ReleaseKeyResult>

restoreKeyBackup(Uint8Array, RestoreKeyBackupOptions)

バックアップされたキーとそのすべてのバージョンを資格情報コンテナーに復元します。 この操作には、キー/復元アクセス許可が必要です。

使用例:

let client = new KeyClient(url, credentials);
let backupContents = await client.backupKey("MyKey");
// ...
let key = await client.restoreKeyBackup(backupContents);

バックアップされたキーをコンテナーに復元します。

function restoreKeyBackup(backup: Uint8Array, options?: RestoreKeyBackupOptions): Promise<KeyVaultKey>

パラメーター

backup

Uint8Array

キー バンドルに関連付けられているバックアップ BLOB。

options
RestoreKeyBackupOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

rotateKey(string, RotateKeyOptions)

キーの新しいバージョンを生成して、キー ポリシーに基づいてキーをローテーションします。 この操作には、キー/回転アクセス許可が必要です。

使用例:

let client = new KeyClient(vaultUrl, credentials);
let key = await client.rotateKey("MyKey");
function rotateKey(name: string, options?: RotateKeyOptions): Promise<KeyVaultKey>

パラメーター

name

string

回転するキーの名前。

options
RotateKeyOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

updateKeyProperties(string, string, UpdateKeyPropertiesOptions)

updateKeyProperties メソッドは、既存の格納されているキーの指定されたプロパティを変更します。 要求で指定されていないプロパティは変更されません。 キー自体の値は変更できません。 この操作には、キー/設定のアクセス許可が必要です。

使用例:

let keyName = "MyKey";
let client = new KeyClient(vaultUrl, credentials);
let key = await client.getKey(keyName);
let result = await client.updateKeyProperties(keyName, key.properties.version, { enabled: false });

指定したキー コンテナー内の指定したキーに関連付けられているプロパティを更新します。

function updateKeyProperties(name: string, keyVersion: string, options?: UpdateKeyPropertiesOptions): Promise<KeyVaultKey>

パラメーター

name

string

キーの名前です。

keyVersion

string

キーのバージョン。

options
UpdateKeyPropertiesOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

updateKeyProperties(string, UpdateKeyPropertiesOptions)

updateKeyProperties メソッドは、既存の格納されているキーの最新バージョンの指定されたプロパティを変更します。 要求で指定されていないプロパティは変更されません。 キー自体の値は変更できません。 この操作には、キー/設定のアクセス許可が必要です。

使用例:

let keyName = "MyKey";
let client = new KeyClient(vaultUrl, credentials);
let key = await client.getKey(keyName);
let result = await client.updateKeyProperties(keyName, { enabled: false });

指定したキー コンテナー内の指定したキーに関連付けられているプロパティを更新します。

function updateKeyProperties(name: string, options?: UpdateKeyPropertiesOptions): Promise<KeyVaultKey>

パラメーター

name

string

キーの名前です。

options
UpdateKeyPropertiesOptions

省略可能なパラメーター。

戻り値

Promise<KeyVaultKey>

updateKeyRotationPolicy(string, KeyRotationPolicyProperties, UpdateKeyRotationPolicyOptions)

Key Vault キーのローテーション ポリシーを更新します。 この操作には、キー/更新アクセス許可が必要です。

使用例:

let client = new KeyClient(vaultUrl, credentials);
const setPolicy = await client.updateKeyRotationPolicy("MyKey", myPolicy);
function updateKeyRotationPolicy(keyName: string, policy: KeyRotationPolicyProperties, options?: UpdateKeyRotationPolicyOptions): Promise<KeyRotationPolicy>

パラメーター

keyName

string

キーの名前です。

options
UpdateKeyRotationPolicyOptions

省略可能なパラメーター。

戻り値