🔐 Ditching Storage Account Keys: OAuth and Managed Identity for Azure Files REST API
TL;DR
- ✅ Managed identities can authenticate to Azure Files via REST API using OAuth tokens — no storage account keys required
- ⚠️ The
x-ms-file-request-intent: backupheader is mandatory — without it, all OAuth requests return HTTP 400 - 🎯 For OAuth-based access over the Azure Files REST API, assign the Storage File Data Privileged Reader or Storage File Data Privileged Contributor role, scoped appropriately (for example, at the file share level). For SMB access, use the dedicated Storage File Data SMB Share roles instead.
- 🕐 OAuth tokens expire after ~1 hour — implement caching and proactive refresh
- 📦 No additional SMB OAuth configuration is required on the storage account when using OAuth authentication over the REST API.
OAuth-based REST access can be introduced alongside existing Shared Key or SAS usage during migration.