githubEdit

Azure Key Vault Credential Extraction

1) Set variables

$VaultName = "VAULT_NAME"

2) Set the current Azure subscription

$SubscriptionID = SUBSCRIPTION_ID"
az account set --subscription $SubscriptionID

3) List and store the secrets

$secretsJson = az keyvault secret list --vault-name $VaultName -o json
$secrets = $secretsJson | ConvertFrom-Json

4) List and store the keys

$keysJson = az keyvault key list --vault-name $VaultName -o json
$keys = $keysJson | ConvertFrom-Json

5) Output the secrets

Write-Host "Secrets in vault $VaultName"
foreach ($secret in $secrets) {
    Write-Host $secret.id
}

6) Output the keys

7) Set variables

8) Set the current Azure subscription

9) Retrieve and output the secret values

10) Check if any of these extracted credentials are valid existing Entra ID users

11) Get all secrets from key vault

Last updated