Skip to main content

1. Log in to Azure

First, authenticate your local machine with Azure:
If you have multiple subscriptions, set the one you want to use:

2. Create an Azure Key Vault

Run the following command to create a Key Vault in a resource group:
🔹 Replace <your-resource-group> with your existing resource group. If you don’t have one, create it:
Then, create the Key Vault:

3. Store a Secret in Key Vault

Let’s add a secret named demo-app with a sample value:
You can add more secrets:

4. Retrieve the Secret

Now, fetch the secret value:
🔹 Expected output:
If you want to retrieve and export it into a .env file:
For multiple secrets:

5. Verify .env File

Expected output:

6. Grant Access to Your Machine (If Needed)

If you get a permission error, give your account access:
Or for a Service Principal:

7. Cleanup (Optional)

If you want to delete the Key Vault:

Summary

This should get everything working smoothly. Let me know if you face any issues!