Interview Prep/Azure/Identity, Access and Governance

A VM application needs to read blobs from one container. How do you set up access without keys?

IntermediateScenarioIdentity, Access and Governance
Answer

Situation read → Managed identity plus a data-plane role scoped to the container.

What I'd do →

  1. Enable a system-assigned identity: az vm identity assign -g rg -n vm-app
  2. Grant the data role at container scope:
    az role assignment create --assignee <principalId> --role "Storage Blob Data Reader" \
      --scope "/subscriptions/<sub>/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/stshop/blobServices/default/containers/reports"
    
  3. In code use DefaultAzureCredential; on the VM test with az login --identity && az storage blob list --account-name stshop -c reports --auth-mode login
  4. Disable shared key access on the account once nothing uses keys

Why → No secret anywhere, access scoped to one container, and access is revoked by removing one role assignment.

Interview tip → Point out --auth-mode login; without it the CLI tries account keys.

Azure All Azure questions Roadmap: Azure core services

More on Identity, Access and Governance