Skip to content

Commit a78863e

Browse files
committed
Track 2 javascript quickstart
1 parent bfc5620 commit a78863e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Azure Key Vault helps safeguard cryptographic keys and secrets used by cloud app
2626
## Prerequisites
2727

2828
- An Azure subscription - [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
29-
- Curent [Node.js] for your operating system.
29+
- Current [Node.js](https://nodejs.org) for your operating system.
3030
- [Azure CLI](/cli/azure/install-azure-cli?view=azure-cli-latest) or [Azure PowerShell](/powershell/azure/overview)
3131

3232
This quickstart assumes you are running [Azure CLI](/cli/azure/install-azure-cli?view=azure-cli-latest) in a Linux terminal window.
@@ -37,13 +37,13 @@ This quickstart assumes you are running [Azure CLI](/cli/azure/install-azure-cli
3737

3838
From the console window, install the Azure Key Vault secrets library for Node.js.
3939

40-
```shell
40+
```console
4141
npm install @azure/keyvault-secrets
4242
```
4343

4444
For this quickstart, you will need to install the azure.identity package as well:
4545

46-
```shell
46+
```console
4747
npm install @azure/identity
4848
```
4949

@@ -126,7 +126,6 @@ The entire console app is available at https://github.com/Azure-Samples/key-vaul
126126
Add the following directives to the top of your code:
127127

128128
```javascript
129-
import os
130129
const { DefaultAzureCredential } = require("@azure/identity");
131130
const { SecretClient } = require("@azure/keyvault-secrets");
132131
```
@@ -135,7 +134,7 @@ const { SecretClient } = require("@azure/keyvault-secrets");
135134

136135
Authenticating to your key vault and creating a key vault client depends on the environmental variables from the [Set environmental variables](#set-environmental-variables) step above, and the [SecretClient constructor](/javascript/api/@azure/keyvault-secrets/secretclient?view=azure-node-latest#secretclient-string--tokencredential--pipelineoptions-).
137136

138-
The name of your key vault is expanded to the key vault URI, in the format "https://<your-key-vault-name>.vault.azure.net".
137+
The name of your key vault is expanded to the key vault URI, in the format `https://<your-key-vault-name>.vault.azure.net`.
139138

140139
```javascript
141140
const keyVaultName = process.env["KEY_VAULT_NAME"];
@@ -150,7 +149,7 @@ const client = new SecretClient(KVUri, credential);
150149
Now that your application is authenticated, you can put a secret into your keyvault using the [client.setSecret method](/javascript/api/@azure/keyvault-secrets/secretclient?view=azure-node-latest#setsecret-string--string--setsecretoptions-) This requires a name for the secret -- we're using "mySecret" in this sample.
151150

152151
```javascript
153-
wait client.setSecret(secretName, secretValue);
152+
await client.setSecret(secretName, secretValue);
154153
```
155154

156155
You can verify that the secret has been set with the [az keyvault secret show](/cli/azure/keyvault/secret?view=azure-cli-latest#az-keyvault-secret-show) command:
@@ -174,7 +173,7 @@ Your secret is now saved as `retrievedSecret.value`.
174173
Finally, let's delete the secret from your key vault with the [client.beginDeleteSecret method](/javascript/api/@azure/keyvault-secrets/secretclient?view=azure-node-latest#begindeletesecret-string--begindeletesecretoptions-).
175174

176175
```javascript
177-
wait client.beginDeleteSecret(secretName)
176+
await client.beginDeleteSecret(secretName)
178177
```
179178

180179
You can verify that the secret is gone with the [az keyvault secret show](/cli/azure/keyvault/secret?view=azure-cli-latest#az-keyvault-secret-show) command:

0 commit comments

Comments
 (0)