Access Azure Key Vault Secrets and Keys with Azure CLI

List all your Azure Key Vaults

Azure:~$
Azure:~$ az keyvault list --query [0].name
"my-keyvault-93456"
Azure:~$
Azure:~$ az keyvault list --query [0].name --output tsv
my-keyvault-93456
Azure:~$

Azure Key Vault in Azure GUI

Show secret of entry 'MyPassword' of your Azure Key Vault

Azure:~$
Azure:~$ az keyvault secret show  --name MyPassword  --vault-name $(az keyvault list --query[0].name --output tsv)  --query value  --output tsv
ThisIsYourVerySecureAndOfcourseLongPasswordIMeanPassSentence
Azure:~$
Azure:~$

Azure Key Vault Secrets in Azure GUI

Show key of entry 'SomeExampleKey' of your Azure Key Vault

The key 

Azure:~$
Azure:~$ az keyvault key show  --name SomeExampleKey  --vault-name $(az keyvault list --query [0].name --output tsv)
{
  "attributes": {
    "created": "2021-03-31T19:27:21+00:00",
    "enabled": true,
    "expires": null,
    "notBefore": null,
    "recoveryLevel": "Recoverable+Purgeable",
    "updated": "2021-03-31T19:27:21+00:00"
  },
  "key": {
    "crv": "P-256",
    "d": null,
    "dp": null,
    "dq": null,
    "e": null,
    "k": null,
    "keyOps": [
      "sign",
      "verify"
    ],
    "kid": "https://my-keyvault-93456.vault.azure.net/keys/SomeExampleKey/413xxxxxxxxxxxxxxbb8d6",
    "kty": "EC",
    "n": null,
    "p": null,
    "q": null,
    "qi": null,
    "t": null,
    "x": "OBlxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxVlBrE=",
    "y": "Gi/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+XRE="
  },
  "managed": null,
  "tags": null
}
Azure:~$

 
 
More Azure CLI commands for Azure Key Vault can be found here: https://docs.microsoft.com/en-us/cli/azure/keyvault?view=azure-cli-latest

1 comment:

Cyber security - What helps in 2027 and in the future

AI is changing the pace of offensive security. New vulnerabilities and their exploitation are found faster and attacks are now executed by a...