Share via


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)

모든 인증서 연락처를 삭제합니다. 이 작업을 수행하려면 인증서/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 작업은 자격 증명 모음에서 지정된 인증서 발급자를 영구적으로 제거합니다. 이 작업을 수행하려면 인증서/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)

지정된 키 자격 증명 모음의 인증서 연락처 리소스 집합을 반환합니다. 이 작업을 수행하려면 인증서/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 작업은 지정된 키 자격 증명 모음에 지정된 인증서 발급자 리소스를 반환합니다. 이 작업을 수행하려면 인증서/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)

현재 자격 증명 모음에서 삭제된 상태이며 복구 또는 제거 준비가 된 인증서를 검색합니다. 이 작업에는 삭제 관련 정보가 포함됩니다. 이 작업을 수행하려면 인증서/가져오기/목록 권한이 필요합니다. 이 작업은 일시 삭제 사용 자격 증명 모음에서만 사용하도록 설정할 수 있습니다.

사용 예제:

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)

지정된 키 자격 증명 모음의 인증서 발급자 리소스 집합을 반환합니다. 이 작업을 수행하려면 인증서/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)

복구 가능성 없이 지정된 인증서를 되돌릴 수 없는 삭제를 수행합니다. 복구 수준에서 '제거 가능'을 지정하지 않으면 작업을 사용할 수 없습니다. 이 작업을 수행하려면 인증서/제거 권한이 필요합니다.

예제 사용법:

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)

키 자격 증명 모음에 대한 인증서 연락처를 설정합니다. 이 작업을 수행하려면 인증서/managecontacts 권한이 필요합니다.

예제 사용법:

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)

모든 인증서 연락처를 삭제합니다. 이 작업을 수행하려면 인증서/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 작업은 자격 증명 모음에서 지정된 인증서 발급자를 영구적으로 제거합니다. 이 작업을 수행하려면 인증서/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)

지정된 키 자격 증명 모음의 인증서 연락처 리소스 집합을 반환합니다. 이 작업을 수행하려면 인증서/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 작업은 지정된 키 자격 증명 모음에 지정된 인증서 발급자 리소스를 반환합니다. 이 작업을 수행하려면 인증서/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)

현재 자격 증명 모음에서 삭제된 상태이며 복구 또는 제거 준비가 된 인증서를 검색합니다. 이 작업에는 삭제 관련 정보가 포함됩니다. 이 작업을 수행하려면 인증서/가져오기/목록 권한이 필요합니다. 이 작업은 일시 삭제 사용 자격 증명 모음에서만 사용하도록 설정할 수 있습니다.

사용 예제:

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)

지정된 키 자격 증명 모음의 인증서 발급자 리소스 집합을 반환합니다. 이 작업을 수행하려면 인증서/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)

복구 가능성 없이 지정된 인증서를 되돌릴 수 없는 삭제를 수행합니다. 복구 수준에서 '제거 가능'을 지정하지 않으면 작업을 사용할 수 없습니다. 이 작업을 수행하려면 인증서/제거 권한이 필요합니다.

예제 사용법:

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)

키 자격 증명 모음에 대한 인증서 연락처를 설정합니다. 이 작업을 수행하려면 인증서/managecontacts 권한이 필요합니다.

예제 사용법:

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

선택적 매개 변수

반환