Skip to content

Commit 0e46a1e

Browse files
committed
Key Vault Certificates - Quickstart JS - passwordless
1 parent e593575 commit 0e46a1e

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

articles/key-vault/certificates/quick-create-node.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ title: Quickstart - Azure Key Vault certificate client library for JavaScript (
33
description: Learn how to create, retrieve, and delete certificates from an Azure key vault using the JavaScript client library
44
author: msmbaldwin
55
ms.author: mbaldwin
6-
ms.date: 01/04/2023
6+
ms.date: 02/01/2023
77
ms.service: key-vault
88
ms.subservice: certificates
99
ms.topic: quickstart
1010
ms.devlang: javascript
11-
ms.custom: devx-track-js, mode-api
11+
ms.custom: devx-track-js, mode-api, passwordless-js
1212
---
1313

1414
# Quickstart: Azure Key Vault certificate client library for JavaScript (version 4)
@@ -84,30 +84,35 @@ Create a Node.js application that uses your key vault.
8484
8585
## Grant access to your key vault
8686
87-
Create an access policy for your key vault that grants key permissions to your user account
87+
Create a vault access policy for your key vault that grants key permissions to your user account
8888
8989
```azurecli
90-
az keyvault set-policy --name <YourKeyVaultName> --upn [email protected] --key-permissions delete get list create purge
90+
az keyvault set-policy --name <YourKeyVaultName> --upn [email protected] --certificate-permissions delete get list create purge update
9191
```
9292

9393
## Set environment variables
9494

9595
This application is using key vault name as an environment variable called `KEY_VAULT_NAME`.
9696

97-
Windows
97+
### [Windows](#tab/windows)
98+
9899
```cmd
99100
set KEY_VAULT_NAME=<your-key-vault-name>
100101
````
101102
103+
### [PowerShell](#tab/powershell)
104+
102105
Windows PowerShell
103106
```powershell
104107
$Env:KEY_VAULT_NAME="<your-key-vault-name>"
105108
```
106109

107-
macOS or Linux
110+
### [macOS or Linux](#tab/linux)
111+
108112
```cmd
109113
export KEY_VAULT_NAME=<your-key-vault-name>
110114
```
115+
---
111116

112117
## Code example
113118

@@ -117,6 +122,20 @@ These code samples demonstrate how to create a client, set a certificate, retrie
117122

118123
1. Create new text file and paste the following code into the **index.js** file.
119124

125+
This code uses the following [Key Vault Certificate classes and methods](/javascript/api/overview/azure/keyvault-certificates-readme):
126+
127+
* [DefaultAzureCredential](/javascript/api/@azure/identity/#@azure-identity-getdefaultazurecredential)
128+
* [CertificateClient class](/javascript/api/@azure/keyvault-certificates/certificateclient)
129+
* [beginCreateCertificate](/javascript/api/@azure/keyvault-certificates/certificateclient#@azure-keyvault-certificates-certificateclient-begincreatecertificate)
130+
* [getCertificate](/javascript/api/@azure/keyvault-certificates/certificateclient#@azure-keyvault-certificates-certificateclient-getcertificate)
131+
* [getCertificateVersion](/javascript/api/@azure/keyvault-certificates/certificateclient#@azure-keyvault-certificates-certificateclient-getcertificateversion)
132+
* [updateCertificateProperties](/javascript/api/@azure/keyvault-certificates/certificateclient#@azure-keyvault-certificates-certificateclient-updatecertificateproperties)
133+
* [updateCertificatePolicy](/javascript/api/@azure/keyvault-certificates/certificateclient#@azure-keyvault-certificates-certificateclient-updatecertificateproperties)
134+
* [beginDeleteCertificate](/javascript/api/@azure/keyvault-certificates/certificateclient#@azure-keyvault-certificates-certificateclient-begindeletecertificate)
135+
* [PollerLike Interface](/javascript/api/@azure/core-lro/pollerlike)
136+
* [getResult](/javascript/api/@azure/core-lro/pollerlike#@azure-core-lro-pollerlike-getresult)
137+
* [pollUntilDone](/javascript/api/@azure/core-lro/pollerlike@azure-core-lro-pollerlike-polluntildone)
138+
120139
```javascript
121140
const { CertificateClient, DefaultCertificatePolicy } = require("@azure/keyvault-certificates");
122141
const { DefaultAzureCredential } = require("@azure/identity");
@@ -127,10 +146,10 @@ These code samples demonstrate how to create a client, set a certificate, retrie
127146
// - AZURE_TENANT_ID: The tenant ID in Azure Active Directory
128147
// - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant
129148
// - AZURE_CLIENT_SECRET: The client secret for the registered application
130-
const url = process.env["AZURE_KEY_VAULT_URI"] || "<keyvault-url>";
131149
const credential = new DefaultAzureCredential();
132150

133151
const keyVaultName = process.env["KEY_VAULT_NAME"];
152+
if(!keyVaultName) throw new Error("KEY_VAULT_NAME is empty");
134153
const url = "https://" + keyVaultName + ".vault.azure.net";
135154

136155
const client = new CertificateClient(url, credential);

0 commit comments

Comments
 (0)