Business Problem
IDSentinel Solutions operated Azure workloads using service principal client secrets stored in application configuration files and environment variables. These static credentials were manually rotated on an ad hoc basis, had no expiration enforcement, and were shared across multiple pipeline stages. When a developer left the organization, there was no reliable process to determine which workloads held copies of credentials they had originally provisioned. The security team had no audit trail showing which workload accessed which secret and when.
This was the same class of problem documented in Scenario 09 — AWS IAM Least Privilege, where AWS workloads relied on long-lived access keys rather than role assumption. Scenario 14 extends the non-human identity governance narrative to Azure, using the platform-native credential elimination mechanism: Managed Identity.
Risk
- Static client secrets decoupled from the workload — a secret provisioned for a VM could be copied into a pipeline, retained by a departing developer, or stored in config files with no workload binding
- No resource-scoped authorization boundary — a single secret granted access to every resource the principal was assigned to, regardless of which workload legitimately needed it
- Legacy vault-level access policies could not restrict access to individual secrets and did not produce per-operation audit events consumable by the SIEM
- SOC 2 CC6.1 non-compliant — shared static credentials with no workload binding, no expiration policy, and no per-operation audit trail
Scope
| Component | Detail |
|---|---|
| Cloud Platform | Microsoft Azure |
| Workload VM | IDS-NHI-VM (Ubuntu Server 24.04 LTS, South Central US) |
| Identity Mechanism | Azure Managed Identity — System-Assigned and User-Assigned |
| Target Resource | Azure Key Vault — kv-idsentinel-azureuser (RBAC authorization mode) |
| Authentication Protocol | OAuth 2.0 bearer token via Instance Metadata Service (IMDS) |
| Authorization Model | Azure RBAC — Key Vault Secrets User role |
| Audit Destination | Key Vault diagnostic logs → Log Analytics (law-idsentinel-nhi) |
| Compliance Target | SOC 2 CC6.1, CC6.3, CC6.6 |
| Cross-Cloud Reference | Scenario 09 — AWS IAM Least Privilege (STS role assumption pattern) |
Solution Design — 3 Workstreams
Managed Identity Configuration
System-assigned Managed Identity enabled on IDS-NHI-VM — Azure creates a corresponding Entra ID service principal with no credentials. Lifecycle tied to the VM; identity deleted automatically on deprovisioning. User-assigned managed identity also provisioned to document decision criteria between the two types.
Key Vault RBAC Authorization
Key Vault provisioned with Azure RBAC permission model — role assignments can be scoped to individual secrets, integrates with PIM, and all data-plane operations produce audit events. Key Vault Secrets User role assigned to the VM's managed identity — read access to secret values only, no write or management permissions.
Audit Trail and Lifecycle Validation
Key Vault diagnostic settings forward AuditEvent logs to Log Analytics. Audit log captures each retrieval event with managed identity Object ID, operation type, HTTP status, and timestamp. Break/fix evidence captured before and after role assignment — confirms authorization boundary enforced at platform layer independently of workload code.

Implementation
-
01
Enable System-Assigned Managed Identity
System-assigned Managed Identity enabled on IDS-NHI-VM via the Azure portal Identity blade. Enabling the identity created a corresponding service principal in Entra ID with no credentials attached. The principal's Object ID was recorded for use in the role assignment and for correlating audit log entries back to the workload.
// 01-managed-identity-enabled
-
02
Provision Key Vault in RBAC Mode
Azure Key Vault
kv-idsentinel-azureuserprovisioned with the Azure RBAC permission model selected at creation. This authorization model cannot be changed after vault creation without reprovisioning. RBAC mode chosen over legacy access policies for secret-level scoping, PIM integration, and per-operation audit event generation. A test secret was added as the target resource for validation.// 02-keyvault-rbac-mode
-
03
Break/Fix — 403 Before Role Assignment
Before any role assignment was made, a Python script was executed on IDS-NHI-VM via Azure Serial Console. The script called the IMDS endpoint to acquire a bearer token scoped to Key Vault, then attempted to retrieve the secret. The request returned 403 Forbidden.
- Finding: Token acquisition via IMDS succeeded — managed identity authenticated correctly to Entra ID — but the authorization check at the vault failed because no role assignment existed
- Key principle: Authentication and authorization are independent controls. A valid Entra ID token does not confer access to a resource without a corresponding RBAC assignment on that resource
// 03-403-before-role-assignment
-
04
Assign Key Vault Secrets User Role
Key Vault Secrets User role assigned to the VM's managed identity principal in the Key Vault Access Control (IAM) blade, scoped to the vault level. The built-in role grants Get and List operations on secret values only — no write, delete, or management permissions, and no access to keys or certificates in the same vault.
// 04-role-assignment
-
05
Validation — Credential-Free Secret Retrieval
After role assignment propagation, the same Python script was executed again on IDS-NHI-VM. The script called the IMDS endpoint, received a scoped bearer token, and presented it to Key Vault. The secret value was returned successfully. No client ID, client secret, certificate, or stored credential appeared anywhere in the script — the only authentication material was the short-lived IMDS token, scoped to the target resource and never written to disk.
// 05-successful-retrieval
-
06
Audit Trail Validation — Log Analytics
Key Vault diagnostic settings configured to forward AuditEvent logs to Log Analytics workspace
law-idsentinel-nhi. A KQL query against the AzureDiagnostics table confirmed the SecretGet event with the managed identity Object ID as the caller, operation type, HTTP 200 result code, and timestamp — providing the workload-attributable access trail that was missing under the static credential model.// 06-keyvault-audit-log
-
07
System-Assigned vs. User-Assigned Managed Identity
User-assigned managed identity
id-idsentinel-sharedprovisioned as a standalone Azure resource and assigned to IDS-NHI-VM to demonstrate that a single VM can carry both identity types simultaneously. Key distinction: a user-assigned identity persists independently of any single resource — it can span multiple VMs and survives resource replacement, making it the correct pattern for scale sets or blue-green deployments where the replacement VM must inherit existing role assignments without manual reassignment.// 07-user-assigned-identity
// 08-both-identity-types
Outcome
Control Coverage
| Control | Framework | Evidence |
|---|---|---|
| CC6.1 — Logical Access Controls | SOC 2 | Managed identity eliminates shared static credentials; RBAC enforces least privilege scoped to the vault |
| CC6.3 — Access Removal | SOC 2 | System-assigned identity deleted automatically on VM deprovisioning; no orphaned principal risk |
| CC6.6 — Logical Access Boundaries | SOC 2 | IMDS endpoint non-routable from outside the VM; token scoped to target resource only |
| CC6.8 — Unauthorized Access Prevention | SOC 2 | No extractable credential exists; 403 break/fix evidence demonstrates platform-enforced access boundary |
| AC-2 — Account Management | NIST 800-53 | Managed identity lifecycle tied to resource lifecycle; no separate deprovisioning process required |
| AC-6 — Least Privilege | NIST 800-53 | Key Vault Secrets User role scoped to read operations only; no write or management permissions granted |
Files
-
scripts/get_token.pyIMDS token acquisition and Key Vault secret retrieval — no stored credentials -
scripts/New-KeyVaultRoleAssignment.ps1Role assignment automation via Az PowerShell -
scripts/Validate-ManagedIdentityAccess.ps1End-to-end configuration validation script -
scripts/query-audit-log.kqlKQL query for Log Analytics — surfaces managed identity secret access events -
diagrams/azure-managed-identity.pngIMDS token acquisition flow and cross-cloud NHI architecture diagram -
screenshots/Implementation evidence at each stage — identity enablement through audit trail validation