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 →
- Enable a system-assigned identity:
az vm identity assign -g rg -n vm-app - 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" - In code use
DefaultAzureCredential; on the VM test withaz login --identity && az storage blob list --account-name stshop -c reports --auth-mode login - 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.
More on Identity, Access and Governance
A new developer joins and needs to deploy to the dev resource group only. How do you give access?BeginnerYour GitHub Actions workflow uses a client secret stored in a repo secret. Security wants it gone. What do you do?BeginnerAuditors ask "who has Owner on production, and why?" How do you answer and fix it?IntermediateTeams keep creating resources in random regions and without tags. How do you stop it?BeginnerA contractor needs temporary read access to logs for two weeks. How do you handle it?BeginnerYou need to let an app team create their own role assignments for their identities, without giving them Owner.Advanced