Hi Hrishikesh Joshi,
Microsoft recommends using Azure AD authentication and Managed Identities for secure and scalable access to Azure File Shares—especially in Virtual Machine Scale Set (VMSS) scenarios where credential persistence can be problematic.
Azure Files supports Azure AD authentication, enabling access control based on Azure AD identities rather than relying on stored passwords or access keys.
You can use either system-assigned or user-assigned Managed Identities with your VMSS instances to authenticate to Azure Files, eliminating the need to store credentials in the Windows Credential Manager. For detailed steps, refer to: Configure managed identities with scale sets
Since Sysprep wipes Credential Manager data, it is recommended to automate the drive mapping process using a startup script that runs in the user context rather than under the SYSTEM account. You can do this by:
- Deploying the script using Azure Custom Script Extension, ensuring it runs under a user account.
- Using Task Scheduler to trigger the script at user login instead of at system startup.
Please refer the below documents:
https://learn.microsoft.com/en-us/azure/storage/files/storage-files-identity-ad-ds-enable
https://learn.microsoft.com/en-us/samples/azure/azure-quickstart-templates/vmss-azure-files-linux/
https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows
If the answer is helpful, please click "Accept Answer" and "Upvote it" as it can be helpful to others in the community.
Thank You.