Delete Secret - Delete Secret

Deletes a secret from a specified key vault.
The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied to an individual version of a secret. This operation requires the secrets/delete permission.

DELETE {vaultBaseUrl}/secrets/{secret-name}?api-version=7.0

URI Parameters

Name In Required Type Description
vaultBaseUrl
path True
  • string

The vault name, for example https://myvault.vault.azure.net.

secret-name
path True
  • string

The name of the secret.

api-version
query True
  • string

Client API version.

Responses

Name Type Description
200 OK

The deleted secret and information on when the secret will be deleted, and how to recover the deleted secret.

Other Status Codes

Key Vault error response describing why the operation failed.

Examples

DeleteSecret

Sample Request

DELETE {vaultBaseUrl}/secrets/GetDeletedSecretTest?api-version=7.0

Sample Response

{
  "recoveryId": "https://kv-sdk-test.vault-int.azure-int.net/deletedsecrets/GetDeletedSecretTest",
  "deletedDate": 1493938433,
  "scheduledPurgeDate": 1501714433,
  "id": "https://kv-sdk-test.vault-int.azure-int.net/secrets/GetDeletedSecretTest/b595353d9c39413d80626575b3b5d865",
  "attributes": {
    "enabled": true,
    "created": 1493938433,
    "updated": 1493938433,
    "recoveryLevel": "Recoverable+Purgeable"
  }
}

Definitions

DeletedSecretBundle

A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged.

DeletionRecoveryLevel

Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval.

Error

The key vault server error.

KeyVaultError

The key vault error exception.

SecretAttributes

The secret management attributes.

DeletedSecretBundle

A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged.

Name Type Description
attributes

The secret management attributes.

contentType
  • string

The content type of the secret.

deletedDate
  • integer

The time when the secret was deleted, in UTC

id
  • string

The secret id.

kid
  • string

If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV certificate.

managed
  • boolean

True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed will be true.

recoveryId
  • string

The url of the recovery object, used to identify and recover the deleted secret.

scheduledPurgeDate
  • integer

The time when the secret is scheduled to be purged, in UTC

tags
  • object

Application specific metadata in the form of key-value pairs.

value
  • string

The secret value.

DeletionRecoveryLevel

Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval.

Name Type Description
Purgeable
  • string
Recoverable
  • string
Recoverable+ProtectedSubscription
  • string
Recoverable+Purgeable
  • string

Error

The key vault server error.

Name Type Description
code
  • string

The error code.

innererror

The key vault server error.

message
  • string

The error message.

KeyVaultError

The key vault error exception.

Name Type Description
error

The key vault server error.

SecretAttributes

The secret management attributes.

Name Type Description
created
  • integer

Creation time in UTC.

enabled
  • boolean

Determines whether the object is enabled.

exp
  • integer

Expiry date in UTC.

nbf
  • integer

Not before date in UTC.

recoveryLevel

Reflects the deletion recovery level currently in effect for secrets in the current vault. If it contains 'Purgeable', the secret can be permanently deleted by a privileged user; otherwise, only the system can purge the secret, at the end of the retention interval.

updated
  • integer

Last updated time in UTC.