Cloud Keys 2020 Node.js Edition

Questions / Feedback?

CreateSecret Method

Creates a new secret.


azuresecrets.createSecret(secretName, contentType, [callback])


The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

'err' has 2 properties which hold detailed information:



This method creates a new secret with the given SecretName. If a secret with the specified SecretName already exists, a new version of it is created. The version Id of the newly-created secret is returned.

The secret value is taken from the specified LocalFile or the SecretData property. If the EncodeData property is enabled, the value will be base64-encoded before it is sent.

The value passed for SecretName must consist solely of alphanumeric characters and hyphens (-).

The ContentType parameter is optional, and can be set to any string value.

If there are any items in the Tag* properties, they will be applied to the newly-created secret. Secrets may have up to 15 tags.

The following configuration settings can also be used to send additional values when creating the secret, refer to their documentation for more information:

Note: If there is already a soft-deleted secret with the specified SecretName in the currently-selected Vault, then a new secret cannot be created with the same name. To resolve such a situation, the soft-deleted secret would need to be recovered (using RecoverSecret) or permanently deleted (using PurgeSecret) first.

Copyright (c) 2022 /n software inc. - All rights reserved.
Cloud Keys 2020 Node.js Edition - Version 20.0 [Build 8157]