az keyvault secret
Manage Key Vault secrets.
Commands
| Name | Description | Type | Status |
|---|---|---|---|
| az keyvault secret delete |
Delete all versions of a secret without purging it. |
Core | Preview |
| az keyvault secret list |
List secret metadata across all pages. |
Core | Preview |
| az keyvault secret list-versions |
List every version of a secret without its values. |
Core | Preview |
| az keyvault secret set |
Set a secret or create a new version. |
Core | Preview |
| az keyvault secret set-attributes |
Update secret attributes without changing its value. |
Core | Preview |
| az keyvault secret show |
Retrieve secret metadata or explicitly retrieve its value. |
Core | Preview |
az keyvault secret delete
Delete all versions of a secret without purging it.
Delete the named secret and all versions. Requires secrets/delete permission and explicit --yes confirmation. Output retains recovery metadata where returned by the service. The command never purges or bypasses purge protection. Recovery is not exposed in the CLI. A retained soft-deleted name cannot simply be reused as a new secret.
az keyvault secret delete --name
[--profile]
[--vault-name]
[--vault-url]
[--yes]
Examples
Confirm deletion
az keyvault secret delete --vault-name myvault --name app-password --yes
Required Parameters
secret name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Use the named connection profile.
Azure public-cloud vault name.
Root HTTPS vault URL. Use instead of vault name.
Confirm deletion of all secret versions.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az keyvault secret list
List secret metadata across all pages.
List base secret identifiers and attributes without retrieving values. Requires secrets/list permission. --maxresults sets the page size between 1 and 25, not the total result limit. Continuation requests stay within the selected vault.
az keyvault secret list [--maxresults]
[--profile]
[--vault-name]
[--vault-url]
Examples
List secrets
az keyvault secret list --vault-name myvault
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Page size from 1 to 25. All pages are returned.
Use the named connection profile.
Azure public-cloud vault name.
Root HTTPS vault URL. Use instead of vault name.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az keyvault secret list-versions
List every version of a secret without its values.
Return version identifiers and metadata across all pages. Requires secrets/list permission. --maxresults controls page size from 1 to 25, not total results.
az keyvault secret list-versions --name
[--maxresults]
[--profile]
[--vault-name]
[--vault-url]
Examples
List versions
az keyvault secret list-versions --vault-name myvault --name app-password
Required Parameters
secret name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Page size from 1 to 25. All pages are returned.
Use the named connection profile.
Azure public-cloud vault name.
Root HTTPS vault URL. Use instead of vault name.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az keyvault secret set
Set a secret or create a new version.
Set a UTF-8 secret using exactly one of --file or --value. Prefer a protected file to avoid putting the value in shell history or process arguments. File contents, including trailing newlines, are preserved. Values must not exceed 25 KiB. Requires secrets/set permission. The response contains metadata, not the value. No vault is created.
az keyvault secret set --name
[--content-type]
[--enabled]
[--expires]
[--file]
[--not-before]
[--profile]
[--tags]
[--value]
[--vault-name]
[--vault-url]
Examples
Set from a file
az keyvault secret set --vault-name myvault --name app-password --file ./secret.txt
Set with attributes
az keyvault secret set --vault-name myvault --name app-password --file ./secret.txt --enabled false --expires 2027-01-01T00:00:00Z --tags owner=app
Required Parameters
secret name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Secret content type.
Whether the secret is enabled: true or false.
Expiration timestamp in UTC.
UTF-8 secret file; contents are preserved including newlines.
Not-before timestamp in UTC.
Use the named connection profile.
Tags in NAME=VALUE form.
Secret value. Prefer --file to avoid shell history.
Azure public-cloud vault name.
Root HTTPS vault URL. Use instead of vault name.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az keyvault secret set-attributes
Update secret attributes without changing its value.
Update the latest or specified version's enabled state, expiration, not-before time, content type or tags. Supply at least one update. Omitted properties remain unchanged; explicit --enabled false is preserved. Requires secrets/set permission. Tags supplied here replace the existing tag collection. Output contains metadata only. Use set to create a new secret value/version.
az keyvault secret set-attributes --name
[--content-type]
[--enabled]
[--expires]
[--not-before]
[--profile]
[--tags]
[--vault-name]
[--vault-url]
[--version]
Examples
Disable a secret
az keyvault secret set-attributes --vault-name myvault --name app-password --enabled false
Update expiry
az keyvault secret set-attributes --vault-name myvault --name app-password --expires 2027-01-01T00:00:00Z
Required Parameters
secret name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Secret content type.
Whether the secret is enabled: true or false.
Expiration timestamp in UTC.
Not-before timestamp in UTC.
Use the named connection profile.
Tags in NAME=VALUE form.
Azure public-cloud vault name.
Root HTTPS vault URL. Use instead of vault name.
secret version. Omit for latest.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az keyvault secret show
Retrieve secret metadata or explicitly retrieve its value.
Get the latest version, or select one with --version. Requires secrets/get permission. Output has no secret-value property unless --as-plain-text is supplied; that option returns the value directly. Plaintext output can be captured by the terminal or calling process, so use it only when needed.
az keyvault secret show --name
[--as-plain-text]
[--profile]
[--vault-name]
[--vault-url]
[--version]
Examples
Get metadata
az keyvault secret show --vault-name myvault --name app-password
Retrieve a value explicitly
az keyvault secret show --vault-name myvault --name app-password --as-plain-text
Required Parameters
secret name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Explicitly return the plaintext secret value.
Use the named connection profile.
Azure public-cloud vault name.
Root HTTPS vault URL. Use instead of vault name.
secret version. Omit for latest.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.