Azure Key Vault Secrets Management

Azure Key Vault Secrets Management project cover
Project CategoryCloud Security
PlatformMicrosoft Azure
Core TechnologiesAzure Key Vault, Azure CLI, Microsoft Entra ID, Linux
Project FocusSecure secrets storage and controlled retrieval

Project Overview

Built a centralized secrets-management solution in Azure Key Vault and validated secure secret retrieval from an Ubuntu virtual machine through Azure CLI.

1. Business Scenario

Application credentials should not be stored in source code or local configuration files. This implementation moves API keys, database passwords, and connection strings into a controlled vault with authenticated access.

2. Project Objectives

3. Lab Environment

Component Value
Cloud Platform Microsoft Azure
Subscription Azure subscription 1
Region East US 2
Resource Group rg-ycs-keyvault-lab-01
Key Vault kv-ycs-01
Virtual Machine vm-ycs-app-01
Operating System Ubuntu Server 24.04 LTS
Authentication Azure Device Login
Access Method Native SSH
Management Tool Azure CLI

4. Resources Created

Resource Type Resource Name
Resource Group rg-ycs-keyvault-lab-01
Azure Key Vault kv-ycs-01
Linux Virtual Machine vm-ycs-app-01
Secret ApiKey
Secret DatabasePassword
Secret StorageConnectionString

5. Project Architecture

The architecture illustrates the implemented access flow: an administrator connects to the Ubuntu VM over SSH, Azure CLI authenticates the user through Microsoft Entra ID using Device Code authentication, and the authenticated CLI session retrieves the three configured secrets from Azure Key Vault over encrypted HTTPS/TLS communication.

Azure Key Vault secrets management architecture showing SSH access, Microsoft Entra ID authentication, Azure CLI, and secure secret retrieval

Architecture — Ubuntu VM uses Azure CLI with Microsoft Entra user authentication to retrieve ApiKey, DatabasePassword, and StorageConnectionString from Azure Key Vault.

6. Technologies Used

7. Security Features Implemented

The project demonstrates the following security practices:

8. Implementation Steps

8.1 Create the Resource Group

A dedicated Resource Group was created to organize all project resources under a single management boundary.

Property Value
Resource Group rg-ycs-keyvault-lab-01
Region East US 2

Using a dedicated Resource Group simplifies administration, access control, cost tracking, and resource cleanup after the project is completed.

Azure Key Vault Secrets Management project screenshot

Resource Manager — Resource groups showing rg-ycs-keyvault-lab-01 in East US 2.

8.2 Deploy Azure Key Vault

A new Azure Key Vault was deployed successfully using Azure Resource Manager.

Property Value
Deployment Name kv-ycs-01
Resource Type Key Vault
Resource Name kv-ycs-01
Deployment Status Successful

The Key Vault acts as a centralized and highly secure repository for storing application secrets, passwords, certificates, and cryptographic keys.

Azure Key Vault Secrets Management project screenshot

Deployment overview confirming kv-ycs-01 was deployed successfully to rg-ycs-keyvault-lab-01.

8.3 Create Application Secrets

Three application secrets were created inside Azure Key Vault.

Secret Name Purpose
ApiKey API authentication key
DatabasePassword Database credentials
StorageConnectionString Azure Storage connection string

All secrets are encrypted at rest by Azure Key Vault and protected through Azure security controls.

Azure Key Vault Secrets Management project screenshot

kv-ycs-01 Secrets pane confirming ApiKey, DatabasePassword, and StorageConnectionString were created and enabled.

8.4 Verify Secret Configuration

The StorageConnectionString secret was opened to verify its configuration.

Verified properties included:

The secret was confirmed as enabled and ready for secure retrieval.

Azure Key Vault Secrets Management project screenshot

StorageConnectionString secret properties — confirmed enabled. The secret value is redacted for this portfolio.

8.5 Create Ubuntu Virtual Machine

An Ubuntu Server virtual machine was provisioned to simulate an application server accessing Azure Key Vault.

Property Value
VM Name vm-ycs-app-01
Operating System Ubuntu Server 24.04 LTS
Region East US 2
Authentication Local User
Username azureuser

The virtual machine represents a production workload that securely retrieves secrets from Azure Key Vault.

8.6 Configure SSH Connectivity

Azure automatically generated the SSH connection information.

Property Value
Protocol SSH
Port 22
Public IP 20.246.80.154
Username azureuser

Azure verified that TCP port 22 was accessible through the Network Security Group. This validation confirms that remote administrative access is available.

Azure Key Vault Secrets Management project screenshot

Native SSH connection blade — port 22 verified as accessible. The source (client) IP address is redacted for privacy.

8.7 Connect to the Linux Virtual Machine

A secure SSH session was established from Windows PowerShell.

Command executed:

ssh azureuser@20.246.80.154

After entering the local account password, the connection was successfully established. The administrator was presented with the Ubuntu login banner and shell prompt.

Azure Key Vault Secrets Management project screenshot

Windows PowerShell — SSH session established, Ubuntu 24.04.4 LTS login banner displayed.

8.8 Install Azure CLI

Azure CLI was installed inside Ubuntu to allow secure interaction with Azure resources.

The installation completed successfully and included:

Azure CLI provides a command-line interface for managing Azure resources directly from Linux.

Azure Key Vault Secrets Management project screenshot

Azure CLI package installation completing successfully on the Ubuntu virtual machine.

8.9 Authenticate Azure CLI

Azure CLI authentication was initiated using Device Code authentication.

Command executed:

az login --use-device-code

Azure generated a temporary authentication code and instructed the user to visit Microsoft's device login portal. This authentication method is commonly used for systems without a graphical web browser.

Azure Key Vault Secrets Management project screenshot

az login --use-device-code — Azure generates a one-time device
code (redacted here since it grants sign-in access).

8.10 Complete Microsoft Authentication

The authentication code generated by Azure CLI was entered into Microsoft's authentication page.

Azure Key Vault Secrets Management project screenshot

Microsoft device login page — entering the one-time code (redacted).

After successful authentication, Azure CLI established an authenticated session using the Microsoft Entra user identity. The CLI could then access Azure resources according to the permissions assigned to that identity, without storing the user password in the terminal session.

Azure Key Vault Secrets Management project screenshot

Microsoft Azure CLI confirming successful sign-in.

9. Azure CLI Operations, Validation, and Project Outcome

9.1 Verify Azure Authentication

After completing the Device Code authentication process, the active Azure subscription was verified using Azure CLI.

Command executed:

az account show

Purpose

The command displays information about the currently authenticated Azure account and confirms that Azure CLI is connected to the correct subscription.

Verification Results

The following information was successfully returned:

This validation confirms that Azure CLI is authenticated with the intended Microsoft Entra user identity and connected to the expected Azure subscription.

Azure Key Vault Secrets Management project screenshot

az account show — subscription and tenant details confirmed
(tenant/subscription IDs and account email redacted for
privacy).

9.2 List Available Secrets

After authentication was verified, Azure CLI was used to display all secrets stored inside Azure Key Vault.

Command executed:

az keyvault secret list \
--vault-name kv-ycs-01 \
--output table

Result

Azure CLI successfully returned the following secrets:

Secret
ApiKey
DatabasePassword
StorageConnectionString

This confirmed that:

Azure Key Vault Secrets Management project screenshot

az keyvault secret list — all three secrets returned with their
status confirmed as enabled.

9.3 Retrieve the API Key

The API key stored inside Azure Key Vault was retrieved using Azure CLI.

Command executed:

az keyvault secret show \
--vault-name kv-ycs-01 \
--name ApiKey \
--query value -o tsv

Purpose

Instead of storing API credentials inside application source code, Azure Key Vault securely stores the secret and returns it only after successful authentication.

Result

Azure CLI successfully returned the stored API key.

Azure Key Vault Secrets Management project screenshot

az keyvault secret show — ApiKey retrieved successfully. The
returned value is redacted for this portfolio.

9.4 Retrieve the Database Password

The database password was retrieved directly from Azure Key Vault.

Command executed:

az keyvault secret show \
--vault-name kv-ycs-01 \
--name DatabasePassword \
--query value -o tsv

Purpose

This command demonstrates secure retrieval of database credentials without embedding passwords inside application configuration files.

Result

The password was successfully returned by Azure Key Vault after verifying the user's identity and permissions.

Azure Key Vault Secrets Management project screenshot

az keyvault secret show — DatabasePassword retrieved
successfully. The returned value is redacted for this
portfolio.

9.5 Retrieve the Storage Connection String

The final secret retrieved from Azure Key Vault was the storage connection string.

Command executed:

az keyvault secret show \
--vault-name kv-ycs-01 \
--name StorageConnectionString \
--query value -o tsv

Purpose

Applications commonly use storage connection strings to access Azure Storage Accounts. Storing them in Azure Key Vault prevents accidental exposure and simplifies credential management.

Result

Azure CLI successfully retrieved the connection string stored in the Key Vault.

Azure Key Vault Secrets Management project screenshot

az keyvault secret show — StorageConnectionString retrieved
successfully. The returned value is redacted for this
portfolio.

10. Implementation Validation and Security Outcomes

The completed lab was validated across deployment, authentication, connectivity, and secret retrieval.

Validation ItemStatus
Dedicated Resource GroupCompleted
Azure Key Vault DeploymentCompleted
Ubuntu VM and SSH ConnectivityCompleted
Azure CLI InstallationCompleted
Microsoft Entra User AuthenticationCompleted
Azure Subscription VerificationCompleted
Secret EnumerationCompleted
Secure Secret RetrievalCompleted

Security Outcomes

← Back to Main Page↑ Back to Top