CertificateClient class

KeyVault 証明書機能と対話するクライアント

コンストラクター

CertificateClient(string, TokenCredential, CertificateClientOptions)

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

プロパティ

vaultUrl

コンテナーへのベース URL

メソッド

backupCertificate(string, OperationOptions)

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

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
const backup = await client.backupCertificate("MyCertificate");

証明書のバックアップを生成します

beginCreateCertificate(string, CertificatePolicy, BeginCreateCertificateOptions)

新しい証明書を作成します。 これが最初のバージョンの場合は、証明書リソースが作成されます。 この関数は、証明書が完全に回復されるまで無期限に待機できる実行時間の長い操作ポーリング を返します。

メモ:証明書のポリシーの としてissuerName送信Selfすると、自己署名証明書が作成されます。

この操作を行うには、証明書/作成アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const certificatePolicy = {
  issuerName: "Self",
  subject: "cn=MyCert"
};
const createPoller = await client.beginCreateCertificate("MyCertificate", certificatePolicy);

// The pending certificate can be obtained by calling the following method:
const pendingCertificate = createPoller.getResult();

// Serializing the poller
const serialized = createPoller.toString();

// A new poller can be created with:
// const newPoller = await client.beginCreateCertificate("MyCertificate", certificatePolicy, { resumeFrom: serialized });

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

証明書を作成します。

beginDeleteCertificate(string, CertificatePollerOptions)

DELETE 操作は、Azure Key Vaultに格納されているすべての証明書に適用されます。 DELETE は、証明書の個々のバージョンに適用できません。 この関数は、証明書が完全に回復されるまで無期限に待機できる実行時間の長い操作ポーリング を返します。

この操作には、証明書/削除アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const createPoller = await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
await createPoller.pollUntilDone();

const deletePoller = await client.beginDeleteCertificate("MyCertificate");

// Serializing the poller
const serialized = deletePoller.toString();

// A new poller can be created with:
// const newPoller = await client.beginDeleteCertificate("MyCertificate", { resumeFrom: serialized });

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

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

beginRecoverDeletedCertificate(string, CertificatePollerOptions)

指定したコンテナー内の削除された証明書を回復します。 この操作は、論理的な削除が有効なコンテナーでのみ実行できます。 この操作 この関数は、証明書が完全に回復されるまで無期限に待機できる実行時間の長い操作ポーリング を返します。

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

使用例:

const client = new CertificateClient(url, credentials);

const deletePoller = await client.beginDeleteCertificate("MyCertificate");
await deletePoller.pollUntilDone();

const recoverPoller = await client.beginRecoverDeletedCertificate("MyCertificate");

// Serializing the poller
const serialized = deletePoller.toString();

// A new poller can be created with:
// const newPoller = await client.beginRecoverDeletedCertificate("MyCertificate", { resumeFrom: serialized });

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

削除された証明書を回復します

createIssuer(string, string, CreateIssuerOptions)

createIssuer 操作は、指定した証明書発行者を追加または更新します。 この操作には、証明書/setissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Test");

指定した証明書発行者を設定します。

deleteCertificateOperation(string, OperationOptions)

作成中の指定した証明書の作成操作を削除します。 証明書は作成されなくなりました。 この操作には、証明書/更新アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
await client.deleteCertificateOperation("MyCertificate");
await client.getCertificateOperation("MyCertificate"); // Throws error: Pending certificate not found: "MyCertificate"

証明書の操作を削除する

deleteContacts(OperationOptions)

すべての証明書の連絡先を削除します。 この操作には、certificates/managecontacts アクセス許可が必要です。

使用例:

let client = new CertificateClient(url, credentials);
await client.setContacts([{
  email: "b@b.com",
  name: "b",
  phone: "222222222222"
}]);
await client.deleteContacts();

すべての証明書の連絡先を削除します

deleteIssuer(string, OperationOptions)

deleteIssuer 操作は、指定された証明書発行者をコンテナーから完全に削除します。 この操作には、certificates/manageissuers/deleteissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Provider");
await client.deleteIssuer("IssuerName");

指定した証明書発行者を削除します。

getCertificate(string, OperationOptions)

証明書のポリシーを含む、特定の証明書から利用可能な最新の情報を取得します。 この操作には、証明書/取得アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const poller = await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
await poller.pollUntilDone();
const certificate = await client.getCertificate("MyCertificate");
console.log(certificate);

証明書の名前から証明書を取得します (証明書ポリシーを含む)

getCertificateOperation(string, CertificatePollerOptions)

指定した証明書に関連付けられている作成操作を取得します。 この操作には、証明書/取得アクセス許可が必要です。 この関数は、証明書が完全に回復されるまで無期限に待機できる実行時間の長い操作ポーリング ャーを返します。

使用例:

const client = new CertificateClient(url, credentials);
const createPoller = await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});

const poller = await client.getCertificateOperation("MyCertificate");
const pendingCertificate = poller.getResult();

const certificateOperation = poller.getOperationState().certificateOperation;
console.log(certificateOperation);

証明書のポーリング操作を取得します

getCertificatePolicy(string, OperationOptions)

getCertificatePolicy 操作は、指定されたキー コンテナー内の指定された証明書ポリシー リソースを返します。 この操作には、証明書/取得アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
const policy = await client.getCertificatePolicy("MyCertificate");
console.log(policy);

証明書のポリシーを取得します

getCertificateVersion(string, string, OperationOptions)

特定のバージョンの特定の証明書に関する情報を取得します。 証明書のポリシーは返されません。 この操作には、証明書/取得アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const poller = await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
await poller.pollUntilDone();
const certificateWithPolicy = await client.getCertificate("MyCertificate");
const certificate = await client.getCertificateVersion("MyCertificate", certificateWithPolicy.properties.version!);
console.log(certificate);

証明書の名前と指定したバージョンから証明書を取得します

getContacts(OperationOptions)

指定したキー コンテナー内の証明書連絡先リソースのセットを返します。 この操作には、certificates/managecontacts アクセス許可が必要です。

使用例:

let client = new CertificateClient(url, credentials);
await client.setContacts([{
  email: "b@b.com",
  name: "b",
  phone: "222222222222"
}]);
const contacts = await client.getContacts();
console.log(contacts);

証明書の連絡先を設定します。

getDeletedCertificate(string, OperationOptions)

は、削除された証明書情報とその属性 (保持間隔、スケジュールされた完全削除、現在の削除復旧レベルなど) を取得します。 この操作には、証明書/取得アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const deletedCertificate = await client.getDeletedCertificate("MyDeletedCertificate");
console.log("Deleted certificate:", deletedCertificate);

削除された証明書を取得します

getIssuer(string, OperationOptions)

getIssuer 操作は、指定したキー コンテナー内の指定された証明書発行者リソースを返します。 この操作には、certificates/manageissuers/getissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Test");
const certificateIssuer = await client.getIssuer("IssuerName");
console.log(certificateIssuer);

指定した証明書発行者を取得します。

importCertificate(string, Uint8Array, ImportCertificateOptions)

秘密キーを含む、既存の有効な証明書を Azure Key Vault にインポートします。 インポートする証明書は、PFX または PEM 形式にすることができます。 証明書が PEM 形式の場合、PEM ファイルには x509 証明書だけでなく、キーが含まれている必要があります。 この操作には、証明書/インポートのアクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
// See: @azure/keyvault-secrets
const certificateSecret = await secretClient.getSecret("MyCertificate");
const base64EncodedCertificate = certificateSecret.value!;
let buffer: Uint8Array;

if (isNode) {
  buffer = Buffer.from(base64EncodedCertificate, "base64");
} else {
  buffer = Uint8Array.from(atob(base64EncodedCertificate), (c) => c.charCodeAt(0));
}

await client.importCertificate("MyCertificate", buffer);

証明書のシークレット値から証明書をインポートします

listDeletedCertificates(ListDeletedCertificatesOptions)

削除された状態で回復または消去の準備ができている現在のコンテナー内の証明書を取得します。 この操作には、削除固有の情報が含まれます。 この操作には、certificates/get/list アクセス許可が必要です。 この操作は、論理的な削除が有効なコンテナーでのみ有効にすることができます。

使用例:

const client = new CertificateClient(url, credentials);
for await (const deletedCertificate of client.listDeletedCertificates()) {
  console.log(deletedCertificate);
}
for await (const page of client.listDeletedCertificates().byPage()) {
  for (const deletedCertificate of page) {
    console.log(deletedCertificate);
  }
}

削除された証明書を一覧表示します

listPropertiesOfCertificates(ListPropertiesOfCertificatesOptions)

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

使用例:

const client = new CertificateClient(url, credentials);
// All in one call
for await (const certificateProperties of client.listPropertiesOfCertificates()) {
  console.log(certificateProperties);
}
// By pages
for await (const page of client.listPropertiesOfCertificates().byPage()) {
  for (const certificateProperties of page) {
    console.log(certificateProperties);
  }
}

指定した証明書のすべてのバージョンを一覧表示します。

listPropertiesOfCertificateVersions(string, OperationOptions)

指定したキー コンテナー内の証明書のバージョンを返します。 この操作には、証明書/リストのアクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
for await (const certificateProperties of client.listPropertiesOfCertificateVersions("MyCertificate")) {
  console.log(certificateProperties.version!);
}

証明書のバージョンを一覧表示します。

listPropertiesOfIssuers(OperationOptions)

指定したキー コンテナー内の証明書発行者リソースのセットを返します。 この操作には、certificates/manageissuers/getissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Test");
// All in one call
for await (const issuerProperties of client.listPropertiesOfIssuers()) {
  console.log(issuerProperties);
}
// By pages
for await (const page of client.listPropertiesOfIssuers().byPage()) {
  for (const issuerProperties of page) {
    console.log(issuerProperties);
  }
}

証明書の発行者を一覧表示します。

mergeCertificate(string, Uint8Array[], OperationOptions)

サービスで現在使用できるキー ペアを使用して、証明書または証明書チェーンのマージを実行します。 この操作を行うには、証明書/作成アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Unknown",
  subject: "cn=MyCert"
});
const poller = await client.getCertificateOperation("MyCertificate");
const { csr } = poller.getOperationState().certificateOperation!;
const base64Csr = Buffer.from(csr!).toString("base64");
const wrappedCsr = ["-----BEGIN CERTIFICATE REQUEST-----", base64Csr, "-----END CERTIFICATE REQUEST-----"].join("\n");

const fs = require("fs");
fs.writeFileSync("test.csr", wrappedCsr);

// Certificate available locally made using:
//   openssl genrsa -out ca.key 2048
//   openssl req -new -x509 -key ca.key -out ca.crt
// You can read more about how to create a fake certificate authority here: https://gist.github.com/Soarez/9688998

const childProcess = require("child_process");
childProcess.execSync("openssl x509 -req -in test.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out test.crt");
const base64Crt = fs.readFileSync("test.crt").toString().split("\n").slice(1, -1).join("");

await client.mergeCertificate("MyCertificate", [Buffer.from(base64Crt)]);

署名された証明書要求を保留中の証明書にマージします

purgeDeletedCertificate(string, OperationOptions)

指定した証明書の元に戻せない削除を実行します。回復の可能性はありません。 回復レベルで 'Purgeable' が指定されていない場合、この操作は使用できません。 この操作には、証明書/消去アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const deletePoller = await client.beginDeleteCertificate("MyCertificate");
await deletePoller.pollUntilDone();
// Deleting a certificate takes time, make sure to wait before purging it
client.purgeDeletedCertificate("MyCertificate");

削除された証明書を取得します

restoreCertificateBackup(Uint8Array, OperationOptions)

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

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
const backup = await client.backupCertificate("MyCertificate");
const poller = await client.beginDeleteCertificate("MyCertificate");
await poller.pollUntilDone();
// Some time is required before we're able to restore the certificate
await client.restoreCertificateBackup(backup!);

バックアップから証明書を復元します

setContacts(CertificateContact[], OperationOptions)

キー コンテナーの証明書の連絡先を設定します。 この操作には、証明書/管理のアクセス許可が必要です。

使用例:

let client = new CertificateClient(url, credentials);
await client.setContacts([{
  email: "b@b.com",
  name: "b",
  phone: "222222222222"
}]);

証明書の連絡先を設定します。

updateCertificatePolicy(string, CertificatePolicy, OperationOptions)

指定した証明書の証明書ポリシーを更新します。 この操作には、証明書/更新アクセス許可が必要です。 証明書のポリシーを取得します

updateCertificateProperties(string, string, UpdateCertificateOptions)

指定した証明書に指定した更新プログラムを適用します。更新される要素は、証明書の属性のみです。 この操作には、証明書/更新アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});

// You may pass an empty string for version which will update
// the latest version of the certificate
await client.updateCertificateProperties("MyCertificate", "", {
  tags: {
    customTag: "value"
  }
});

証明書を更新する

updateIssuer(string, UpdateIssuerOptions)

updateIssuer 操作は、指定した証明書発行者エンティティに対して更新を実行します。 この操作には、証明書/setissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Test");
await client.updateIssuer("IssuerName", {
  provider: "Provider2"
});

指定した証明書発行者を更新します。

コンストラクターの詳細

CertificateClient(string, TokenCredential, CertificateClientOptions)

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

new CertificateClient(vaultUrl: string, credential: TokenCredential, clientOptions?: CertificateClientOptions)

パラメーター

vaultUrl

string

コンテナーへのベース URL。 この URL が有効なKey Vault リソースを参照していることを検証する必要があります。 詳細については、https://aka.ms/azsdk/blog/vault-uri を参照してください。

credential
TokenCredential

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

clientOptions
CertificateClientOptions

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

プロパティの詳細

vaultUrl

コンテナーへのベース URL

vaultUrl: string

プロパティ値

string

メソッドの詳細

backupCertificate(string, OperationOptions)

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

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
const backup = await client.backupCertificate("MyCertificate");

証明書のバックアップを生成します

function backupCertificate(certificateName: string, options?: OperationOptions): Promise<undefined | Uint8Array>

パラメーター

certificateName

string

証明書の名前

options
OperationOptions

省略可能なパラメーター

戻り値

Promise<undefined | Uint8Array>

beginCreateCertificate(string, CertificatePolicy, BeginCreateCertificateOptions)

新しい証明書を作成します。 これが最初のバージョンの場合は、証明書リソースが作成されます。 この関数は、証明書が完全に回復されるまで無期限に待機できる実行時間の長い操作ポーリング を返します。

メモ:証明書のポリシーの としてissuerName送信Selfすると、自己署名証明書が作成されます。

この操作を行うには、証明書/作成アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const certificatePolicy = {
  issuerName: "Self",
  subject: "cn=MyCert"
};
const createPoller = await client.beginCreateCertificate("MyCertificate", certificatePolicy);

// The pending certificate can be obtained by calling the following method:
const pendingCertificate = createPoller.getResult();

// Serializing the poller
const serialized = createPoller.toString();

// A new poller can be created with:
// const newPoller = await client.beginCreateCertificate("MyCertificate", certificatePolicy, { resumeFrom: serialized });

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

証明書を作成します。

function beginCreateCertificate(certificateName: string, policy: CertificatePolicy, options?: BeginCreateCertificateOptions): Promise<PollerLikeWithCancellation<CreateCertificateState, KeyVaultCertificateWithPolicy>>

パラメーター

certificateName

string

証明書の名前

options
BeginCreateCertificateOptions

省略可能なパラメーター

戻り値

beginDeleteCertificate(string, CertificatePollerOptions)

DELETE 操作は、Azure Key Vaultに格納されているすべての証明書に適用されます。 DELETE は、証明書の個々のバージョンに適用できません。 この関数は、証明書が完全に回復されるまで無期限に待機できる実行時間の長い操作ポーリング を返します。

この操作には、証明書/削除アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const createPoller = await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
await createPoller.pollUntilDone();

const deletePoller = await client.beginDeleteCertificate("MyCertificate");

// Serializing the poller
const serialized = deletePoller.toString();

// A new poller can be created with:
// const newPoller = await client.beginDeleteCertificate("MyCertificate", { resumeFrom: serialized });

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

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

function beginDeleteCertificate(certificateName: string, options?: CertificatePollerOptions): Promise<PollerLike<DeleteCertificateState, DeletedCertificate>>

パラメーター

certificateName

string

証明書の名前。

options
CertificatePollerOptions

省略可能なパラメーター

戻り値

beginRecoverDeletedCertificate(string, CertificatePollerOptions)

指定したコンテナー内の削除された証明書を回復します。 この操作は、論理的な削除が有効なコンテナーでのみ実行できます。 この操作 この関数は、証明書が完全に回復されるまで無期限に待機できる実行時間の長い操作ポーリング を返します。

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

使用例:

const client = new CertificateClient(url, credentials);

const deletePoller = await client.beginDeleteCertificate("MyCertificate");
await deletePoller.pollUntilDone();

const recoverPoller = await client.beginRecoverDeletedCertificate("MyCertificate");

// Serializing the poller
const serialized = deletePoller.toString();

// A new poller can be created with:
// const newPoller = await client.beginRecoverDeletedCertificate("MyCertificate", { resumeFrom: serialized });

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

削除された証明書を回復します

function beginRecoverDeletedCertificate(certificateName: string, options?: CertificatePollerOptions): Promise<PollerLike<RecoverDeletedCertificateState, KeyVaultCertificateWithPolicy>>

パラメーター

certificateName

string

削除された証明書の名前

options
CertificatePollerOptions

省略可能なパラメーター

戻り値

createIssuer(string, string, CreateIssuerOptions)

createIssuer 操作は、指定した証明書発行者を追加または更新します。 この操作には、証明書/setissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Test");

指定した証明書発行者を設定します。

function createIssuer(issuerName: string, provider: string, options?: CreateIssuerOptions): Promise<CertificateIssuer>

パラメーター

issuerName

string

発行元の名前です。

provider

string

発行者プロバイダー。

options
CreateIssuerOptions

省略可能なパラメーター

戻り値

deleteCertificateOperation(string, OperationOptions)

作成中の指定した証明書の作成操作を削除します。 証明書は作成されなくなりました。 この操作には、証明書/更新アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
await client.deleteCertificateOperation("MyCertificate");
await client.getCertificateOperation("MyCertificate"); // Throws error: Pending certificate not found: "MyCertificate"

証明書の操作を削除する

function deleteCertificateOperation(certificateName: string, options?: OperationOptions): Promise<CertificateOperation>

パラメーター

certificateName

string

証明書の名前

options
OperationOptions

省略可能なパラメーター

戻り値

deleteContacts(OperationOptions)

すべての証明書の連絡先を削除します。 この操作には、certificates/managecontacts アクセス許可が必要です。

使用例:

let client = new CertificateClient(url, credentials);
await client.setContacts([{
  email: "b@b.com",
  name: "b",
  phone: "222222222222"
}]);
await client.deleteContacts();

すべての証明書の連絡先を削除します

function deleteContacts(options?: OperationOptions): Promise<undefined | CertificateContact[]>

パラメーター

options
OperationOptions

省略可能なパラメーター

戻り値

Promise<undefined | CertificateContact[]>

deleteIssuer(string, OperationOptions)

deleteIssuer 操作は、指定された証明書発行者をコンテナーから完全に削除します。 この操作には、certificates/manageissuers/deleteissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Provider");
await client.deleteIssuer("IssuerName");

指定した証明書発行者を削除します。

function deleteIssuer(issuerName: string, options?: OperationOptions): Promise<CertificateIssuer>

パラメーター

issuerName

string

発行元の名前です。

options
OperationOptions

省略可能なパラメーター

戻り値

getCertificate(string, OperationOptions)

証明書のポリシーを含む、特定の証明書から利用可能な最新の情報を取得します。 この操作には、証明書/取得アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const poller = await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
await poller.pollUntilDone();
const certificate = await client.getCertificate("MyCertificate");
console.log(certificate);

証明書の名前から証明書を取得します (証明書ポリシーを含む)

function getCertificate(certificateName: string, options?: OperationOptions): Promise<KeyVaultCertificateWithPolicy>

パラメーター

certificateName

string

証明書の名前

options
OperationOptions

省略可能なパラメーター

戻り値

getCertificateOperation(string, CertificatePollerOptions)

指定した証明書に関連付けられている作成操作を取得します。 この操作には、証明書/取得アクセス許可が必要です。 この関数は、証明書が完全に回復されるまで無期限に待機できる実行時間の長い操作ポーリング ャーを返します。

使用例:

const client = new CertificateClient(url, credentials);
const createPoller = await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});

const poller = await client.getCertificateOperation("MyCertificate");
const pendingCertificate = poller.getResult();

const certificateOperation = poller.getOperationState().certificateOperation;
console.log(certificateOperation);

証明書のポーリング操作を取得します

function getCertificateOperation(certificateName: string, options?: CertificatePollerOptions): Promise<PollerLikeWithCancellation<CertificateOperationState, KeyVaultCertificateWithPolicy>>

パラメーター

certificateName

string

証明書の名前

options
CertificatePollerOptions

省略可能なパラメーター

戻り値

getCertificatePolicy(string, OperationOptions)

getCertificatePolicy 操作は、指定されたキー コンテナー内の指定された証明書ポリシー リソースを返します。 この操作には、証明書/取得アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
const policy = await client.getCertificatePolicy("MyCertificate");
console.log(policy);

証明書のポリシーを取得します

function getCertificatePolicy(certificateName: string, options?: OperationOptions): Promise<CertificatePolicy>

パラメーター

certificateName

string

証明書の名前

options
OperationOptions

省略可能なパラメーター

戻り値

getCertificateVersion(string, string, OperationOptions)

特定のバージョンの特定の証明書に関する情報を取得します。 証明書のポリシーは返されません。 この操作には、証明書/取得アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const poller = await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
await poller.pollUntilDone();
const certificateWithPolicy = await client.getCertificate("MyCertificate");
const certificate = await client.getCertificateVersion("MyCertificate", certificateWithPolicy.properties.version!);
console.log(certificate);

証明書の名前と指定したバージョンから証明書を取得します

function getCertificateVersion(certificateName: string, version: string, options?: OperationOptions): Promise<KeyVaultCertificate>

パラメーター

certificateName

string

証明書の名前

version

string

証明書の特定のバージョン

options
OperationOptions

省略可能なパラメーター

戻り値

getContacts(OperationOptions)

指定したキー コンテナー内の証明書連絡先リソースのセットを返します。 この操作には、certificates/managecontacts アクセス許可が必要です。

使用例:

let client = new CertificateClient(url, credentials);
await client.setContacts([{
  email: "b@b.com",
  name: "b",
  phone: "222222222222"
}]);
const contacts = await client.getContacts();
console.log(contacts);

証明書の連絡先を設定します。

function getContacts(options?: OperationOptions): Promise<undefined | CertificateContact[]>

パラメーター

options
OperationOptions

省略可能なパラメーター

戻り値

Promise<undefined | CertificateContact[]>

getDeletedCertificate(string, OperationOptions)

は、削除された証明書情報とその属性 (保持間隔、スケジュールされた完全削除、現在の削除復旧レベルなど) を取得します。 この操作には、証明書/取得アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const deletedCertificate = await client.getDeletedCertificate("MyDeletedCertificate");
console.log("Deleted certificate:", deletedCertificate);

削除された証明書を取得します

function getDeletedCertificate(certificateName: string, options?: OperationOptions): Promise<DeletedCertificate>

パラメーター

certificateName

string

証明書の名前

options
OperationOptions

省略可能なパラメーター

戻り値

getIssuer(string, OperationOptions)

getIssuer 操作は、指定したキー コンテナー内の指定された証明書発行者リソースを返します。 この操作には、certificates/manageissuers/getissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Test");
const certificateIssuer = await client.getIssuer("IssuerName");
console.log(certificateIssuer);

指定した証明書発行者を取得します。

function getIssuer(issuerName: string, options?: OperationOptions): Promise<CertificateIssuer>

パラメーター

issuerName

string

発行元の名前です。

options
OperationOptions

省略可能なパラメーター

戻り値

importCertificate(string, Uint8Array, ImportCertificateOptions)

秘密キーを含む、既存の有効な証明書を Azure Key Vault にインポートします。 インポートする証明書は、PFX または PEM 形式にすることができます。 証明書が PEM 形式の場合、PEM ファイルには x509 証明書だけでなく、キーが含まれている必要があります。 この操作には、証明書/インポートのアクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
// See: @azure/keyvault-secrets
const certificateSecret = await secretClient.getSecret("MyCertificate");
const base64EncodedCertificate = certificateSecret.value!;
let buffer: Uint8Array;

if (isNode) {
  buffer = Buffer.from(base64EncodedCertificate, "base64");
} else {
  buffer = Uint8Array.from(atob(base64EncodedCertificate), (c) => c.charCodeAt(0));
}

await client.importCertificate("MyCertificate", buffer);

証明書のシークレット値から証明書をインポートします

function importCertificate(certificateName: string, certificateBytes: Uint8Array, options?: ImportCertificateOptions): Promise<KeyVaultCertificateWithPolicy>

パラメーター

certificateName

string

証明書の名前

certificateBytes

Uint8Array

X.509 証明書と秘密キーの両方を含む証明書の PFX または ASCII PEM 形式の値

options
ImportCertificateOptions

省略可能なパラメーター

戻り値

listDeletedCertificates(ListDeletedCertificatesOptions)

削除された状態で回復または消去の準備ができている現在のコンテナー内の証明書を取得します。 この操作には、削除固有の情報が含まれます。 この操作には、certificates/get/list アクセス許可が必要です。 この操作は、論理的な削除が有効なコンテナーでのみ有効にすることができます。

使用例:

const client = new CertificateClient(url, credentials);
for await (const deletedCertificate of client.listDeletedCertificates()) {
  console.log(deletedCertificate);
}
for await (const page of client.listDeletedCertificates().byPage()) {
  for (const deletedCertificate of page) {
    console.log(deletedCertificate);
  }
}

削除された証明書を一覧表示します

function listDeletedCertificates(options?: ListDeletedCertificatesOptions): PagedAsyncIterableIterator<DeletedCertificate, DeletedCertificate[], PageSettings>

パラメーター

options
ListDeletedCertificatesOptions

省略可能なパラメーター

戻り値

listPropertiesOfCertificates(ListPropertiesOfCertificatesOptions)

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

使用例:

const client = new CertificateClient(url, credentials);
// All in one call
for await (const certificateProperties of client.listPropertiesOfCertificates()) {
  console.log(certificateProperties);
}
// By pages
for await (const page of client.listPropertiesOfCertificates().byPage()) {
  for (const certificateProperties of page) {
    console.log(certificateProperties);
  }
}

指定した証明書のすべてのバージョンを一覧表示します。

function listPropertiesOfCertificates(options?: ListPropertiesOfCertificatesOptions): PagedAsyncIterableIterator<CertificateProperties, CertificateProperties[], PageSettings>

パラメーター

options
ListPropertiesOfCertificatesOptions

省略可能なパラメーター

戻り値

listPropertiesOfCertificateVersions(string, OperationOptions)

指定したキー コンテナー内の証明書のバージョンを返します。 この操作には、証明書/リストのアクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
for await (const certificateProperties of client.listPropertiesOfCertificateVersions("MyCertificate")) {
  console.log(certificateProperties.version!);
}

証明書のバージョンを一覧表示します。

function listPropertiesOfCertificateVersions(certificateName: string, options?: OperationOptions): PagedAsyncIterableIterator<CertificateProperties, CertificateProperties[], PageSettings>

パラメーター

certificateName

string

証明書の名前。

options
OperationOptions

省略可能なパラメーター

戻り値

listPropertiesOfIssuers(OperationOptions)

指定したキー コンテナー内の証明書発行者リソースのセットを返します。 この操作には、certificates/manageissuers/getissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Test");
// All in one call
for await (const issuerProperties of client.listPropertiesOfIssuers()) {
  console.log(issuerProperties);
}
// By pages
for await (const page of client.listPropertiesOfIssuers().byPage()) {
  for (const issuerProperties of page) {
    console.log(issuerProperties);
  }
}

証明書の発行者を一覧表示します。

function listPropertiesOfIssuers(options?: OperationOptions): PagedAsyncIterableIterator<IssuerProperties, IssuerProperties[], PageSettings>

パラメーター

options
OperationOptions

省略可能なパラメーター

戻り値

mergeCertificate(string, Uint8Array[], OperationOptions)

サービスで現在使用できるキー ペアを使用して、証明書または証明書チェーンのマージを実行します。 この操作を行うには、証明書/作成アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Unknown",
  subject: "cn=MyCert"
});
const poller = await client.getCertificateOperation("MyCertificate");
const { csr } = poller.getOperationState().certificateOperation!;
const base64Csr = Buffer.from(csr!).toString("base64");
const wrappedCsr = ["-----BEGIN CERTIFICATE REQUEST-----", base64Csr, "-----END CERTIFICATE REQUEST-----"].join("\n");

const fs = require("fs");
fs.writeFileSync("test.csr", wrappedCsr);

// Certificate available locally made using:
//   openssl genrsa -out ca.key 2048
//   openssl req -new -x509 -key ca.key -out ca.crt
// You can read more about how to create a fake certificate authority here: https://gist.github.com/Soarez/9688998

const childProcess = require("child_process");
childProcess.execSync("openssl x509 -req -in test.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out test.crt");
const base64Crt = fs.readFileSync("test.crt").toString().split("\n").slice(1, -1).join("");

await client.mergeCertificate("MyCertificate", [Buffer.from(base64Crt)]);

署名された証明書要求を保留中の証明書にマージします

function mergeCertificate(certificateName: string, x509Certificates: Uint8Array[], options?: OperationOptions): Promise<KeyVaultCertificateWithPolicy>

パラメーター

certificateName

string

証明書の名前

x509Certificates

Uint8Array[]

マージする証明書

options
OperationOptions

省略可能なパラメーター

戻り値

purgeDeletedCertificate(string, OperationOptions)

指定した証明書の元に戻せない削除を実行します。回復の可能性はありません。 回復レベルで 'Purgeable' が指定されていない場合、この操作は使用できません。 この操作には、証明書/消去アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
const deletePoller = await client.beginDeleteCertificate("MyCertificate");
await deletePoller.pollUntilDone();
// Deleting a certificate takes time, make sure to wait before purging it
client.purgeDeletedCertificate("MyCertificate");

削除された証明書を取得します

function purgeDeletedCertificate(certificateName: string, options?: OperationOptions): Promise<null>

パラメーター

certificateName

string

消去する削除された証明書の名前

options
OperationOptions

省略可能なパラメーター

戻り値

Promise<null>

restoreCertificateBackup(Uint8Array, OperationOptions)

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

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});
const backup = await client.backupCertificate("MyCertificate");
const poller = await client.beginDeleteCertificate("MyCertificate");
await poller.pollUntilDone();
// Some time is required before we're able to restore the certificate
await client.restoreCertificateBackup(backup!);

バックアップから証明書を復元します

function restoreCertificateBackup(backup: Uint8Array, options?: OperationOptions): Promise<KeyVaultCertificateWithPolicy>

パラメーター

backup

Uint8Array

復元元のバックアップ証明書

options
OperationOptions

省略可能なパラメーター

戻り値

setContacts(CertificateContact[], OperationOptions)

キー コンテナーの証明書の連絡先を設定します。 この操作には、証明書/管理のアクセス許可が必要です。

使用例:

let client = new CertificateClient(url, credentials);
await client.setContacts([{
  email: "b@b.com",
  name: "b",
  phone: "222222222222"
}]);

証明書の連絡先を設定します。

function setContacts(contacts: CertificateContact[], options?: OperationOptions): Promise<undefined | CertificateContact[]>

パラメーター

contacts

CertificateContact[]

使用する連絡先

options
OperationOptions

省略可能なパラメーター

戻り値

Promise<undefined | CertificateContact[]>

updateCertificatePolicy(string, CertificatePolicy, OperationOptions)

指定した証明書の証明書ポリシーを更新します。 この操作には、証明書/更新アクセス許可が必要です。 証明書のポリシーを取得します

function updateCertificatePolicy(certificateName: string, policy: CertificatePolicy, options?: OperationOptions): Promise<CertificatePolicy>

パラメーター

certificateName

string

証明書の名前

policy
CertificatePolicy

証明書ポリシー

options
OperationOptions

省略可能なパラメーター

戻り値

updateCertificateProperties(string, string, UpdateCertificateOptions)

指定した証明書に指定した更新プログラムを適用します。更新される要素は、証明書の属性のみです。 この操作には、証明書/更新アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.beginCreateCertificate("MyCertificate", {
  issuerName: "Self",
  subject: "cn=MyCert"
});

// You may pass an empty string for version which will update
// the latest version of the certificate
await client.updateCertificateProperties("MyCertificate", "", {
  tags: {
    customTag: "value"
  }
});

証明書を更新する

function updateCertificateProperties(certificateName: string, version: string, options?: UpdateCertificateOptions): Promise<KeyVaultCertificate>

パラメーター

certificateName

string

証明書の名前

version

string

更新する証明書のバージョン (空の文字列によって最新バージョンが更新されます)

options
UpdateCertificateOptions

更新する内容を含むオプション

戻り値

updateIssuer(string, UpdateIssuerOptions)

updateIssuer 操作は、指定した証明書発行者エンティティに対して更新を実行します。 この操作には、証明書/setissuers アクセス許可が必要です。

使用例:

const client = new CertificateClient(url, credentials);
await client.createIssuer("IssuerName", "Test");
await client.updateIssuer("IssuerName", {
  provider: "Provider2"
});

指定した証明書発行者を更新します。

function updateIssuer(issuerName: string, options?: UpdateIssuerOptions): Promise<CertificateIssuer>

パラメーター

issuerName

string

発行元の名前です。

options
UpdateIssuerOptions

省略可能なパラメーター

戻り値